> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.walletstech.com/llms.txt.
> For full documentation content, see https://docs.walletstech.com/llms-full.txt.

# Get crypto rate

POST https://rate
Content-Type: application/json

Get a rate for a specific crypto amount.

Reference: https://docs.walletstech.com/api/rate/get-crypto-rate

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /rate:
    post:
      operationId: get-crypto-rate
      summary: Get crypto rate
      description: Get a rate for a specific crypto amount.
      tags:
        - subpackage_rate
      parameters:
        - name: X-AUTH-TOKEN
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Rate_Get crypto rate_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: string
                source:
                  type: string
                target:
                  type: string
              required:
                - amount
                - source
                - target
servers:
  - url: https:/
components:
  schemas:
    Rate_Get crypto rate_Response_200:
      type: object
      properties:
        rate:
          type: string
        amount:
          type: string
        source:
          type: string
        target:
          type: string
        f_amount:
          type: string
      required:
        - rate
        - amount
        - source
        - target
        - f_amount
      title: Rate_Get crypto rate_Response_200
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-AUTH-TOKEN

```

## SDK Code Examples

```python Rate_Get crypto rate_example
import requests

url = "https://https/rate"

payload = {
    "amount": "0.1",
    "source": "BTC",
    "target": "USD"
}
headers = {
    "X-AUTH-TOKEN": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Rate_Get crypto rate_example
const url = 'https://https/rate';
const options = {
  method: 'POST',
  headers: {'X-AUTH-TOKEN': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"amount":"0.1","source":"BTC","target":"USD"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Rate_Get crypto rate_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://https/rate"

	payload := strings.NewReader("{\n  \"amount\": \"0.1\",\n  \"source\": \"BTC\",\n  \"target\": \"USD\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-AUTH-TOKEN", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Rate_Get crypto rate_example
require 'uri'
require 'net/http'

url = URI("https://https/rate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-AUTH-TOKEN"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"amount\": \"0.1\",\n  \"source\": \"BTC\",\n  \"target\": \"USD\"\n}"

response = http.request(request)
puts response.read_body
```

```java Rate_Get crypto rate_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://https/rate")
  .header("X-AUTH-TOKEN", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"amount\": \"0.1\",\n  \"source\": \"BTC\",\n  \"target\": \"USD\"\n}")
  .asString();
```

```php Rate_Get crypto rate_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://https/rate', [
  'body' => '{
  "amount": "0.1",
  "source": "BTC",
  "target": "USD"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-AUTH-TOKEN' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Rate_Get crypto rate_example
using RestSharp;

var client = new RestClient("https://https/rate");
var request = new RestRequest(Method.POST);
request.AddHeader("X-AUTH-TOKEN", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"amount\": \"0.1\",\n  \"source\": \"BTC\",\n  \"target\": \"USD\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Rate_Get crypto rate_example
import Foundation

let headers = [
  "X-AUTH-TOKEN": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "amount": "0.1",
  "source": "BTC",
  "target": "USD"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://https/rate")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```