# convertCurrency

**Identifier:** `coingecko_convertCurrency`

**Provider:** [CoinGecko](https://kirha.com/providers/coingecko.md)

Convert a value from one currency to another using current exchange rates.

## Run it with the CLI

```bash
kirha tools run coingecko_convertCurrency \
  --input '{
    "fromCurrency": "eur",
    "toCurrency": "eur",
    "value": 1
  }'
```

`--input` takes a JSON object that matches the input schema. Pass `--input -` to read it from stdin.

## Call it over HTTP

```bash
curl https://api.kirha.com/tools/v1/execute \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: **********' \
  --data '{
  "tool_name": "coingecko_convertCurrency",
  "input": {
    "fromCurrency": "eur",
    "toCurrency": "eur",
    "value": 1
  }
}'
```

Replace the stars with an API key from https://app.kirha.com/api-keys.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "fromCurrency": {
      "enum": [
        "eur",
        "usd",
        "gbp",
        "jpy",
        "aud",
        "sek",
        "btc",
        "eth",
        "cny",
        "chf"
      ],
      "type": "string"
    },
    "toCurrency": {
      "enum": [
        "eur",
        "usd",
        "gbp",
        "jpy",
        "aud",
        "sek",
        "btc",
        "eth",
        "cny",
        "chf"
      ],
      "type": "string"
    },
    "value": {
      "exclusiveMinimum": 0,
      "type": "number"
    }
  },
  "required": [
    "fromCurrency",
    "toCurrency",
    "value"
  ],
  "type": "object"
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "context": {
      "type": "string"
    },
    "convertedValue": {
      "type": "number"
    },
    "exchangeRate": {
      "type": "number"
    },
    "fromCurrency": {
      "type": "string"
    },
    "originalValue": {
      "type": "number"
    },
    "toCurrency": {
      "type": "string"
    }
  },
  "required": [
    "context",
    "convertedValue",
    "exchangeRate",
    "fromCurrency",
    "toCurrency",
    "originalValue"
  ],
  "type": "object"
}
```

-----

[All CoinGecko tools](https://kirha.com/providers/coingecko.md) · [< Back to tools list](https://kirha.com/tools.md)