> For the complete documentation index, see [llms.txt](https://docs.tylt.money/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tylt.money/introduction/tylt-crossramp-fiat-crypto-solutions/philippines-php/administration/set-rate.md).

# Set Rate

This endpoint allows the authorized PSMD rate actor to set the fiat conversion rate used for PSMD pay-in and pay-out creation. The submitted rate must be provided in the following format:

```
1 USDT = x fiatCurrency
```

For example, if `1 USDT = 58 PHP`, the value of `usdtToFiatRate` should be `58`.

When a pay-in or pay-out is created, Tylt uses this rate to calculate the equivalent fiat-to-USDT conversion rate internally.

#### Endpoint

[<mark style="color:green;">**`POST`**</mark>](https://dev-api.tylt.money/v2/prime-fiat/instance/details)`https://api.tylt.money/v2/prime-fiat/php/rate`

**Request Headers**

{% tabs %}
{% tab title="Headers" %}

<table data-full-width="true"><thead><tr><th width="133">Name</th><th width="79">Type</th><th width="167">Example</th><th>Description</th></tr></thead><tbody><tr><td>X-TLP-APIKEY</td><td>string</td><td>93ee3c5e133697251b5362bcf9cc8532476785t8768075616f58d88</td><td>Your Tylt API Key, used to identify your account in API requests.</td></tr><tr><td>X-TLP-SIGNATURE</td><td>string</td><td>d0afef3853dfc8489c8b9affa5825171fdd7y7685675e4966a05f66ed2b3eaf9462b3c9c0</td><td>HMAC SHA-256 signature generated using the API Secret Key to secure the request.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

{% hint style="info" %}
When using the API, ensure to include your API Key and generate the signature for the request payload using your API Secret. The tables provided above contain example values for illustration purposes only. Please refer to the code snippets for detailed instructions on how to sign the request and generate the signature properly.
{% endhint %}

**Request Body**

{% tabs %}
{% tab title="Parameters" %}

| Field            | Type     | Required | Description                                                           |
| ---------------- | -------- | -------: | --------------------------------------------------------------------- |
| `currencySymbol` | `string` |      Yes | Fiat currency symbol for which the rate is being set. Example: `PHP`. |
| `usdtToFiatRate` | `number` |      Yes | Actor-set rate in `1 USDT = x fiatCurrency` format. Example: `58`.    |
| {% endtab %}     |          |          |                                                                       |
| {% endtabs %}    |          |          |                                                                       |

**Code Snippet**

{% tabs %}
{% tab title="JavaScript" %}

```javascript
const axios = require("axios");
const crypto = require("crypto");

const apiKey = "your-api-key";
const apiSecret = "your-api-secret";

const body = {
  currencySymbol: "PHP",
  usdtToFiatRate: 58
};

const signature = crypto
  .createHmac("sha256", apiSecret)
  .update(JSON.stringify(body))
  .digest("hex");

axios.post(
  "https://api.tylt.money/v2/prime-fiat/php/rate",
  body,
  {
    headers: {
      "X-TLP-APIKEY": apiKey,
      "X-TLP-SIGNATURE": signature
    }
  }
)
  .then((response) => console.log(response.data))
  .catch((error) => console.error(error.response?.data || error));
```

{% endtab %}
{% endtabs %}

**Response**

{% tabs %}
{% tab title="Response Example" %}

```json
{
  "msg": "Rate set successfully.",
  "data": {
    "rateId": 1,
    "currencySymbol": "PHP",
    "cryptoCurrencySymbol": "USDT",
    "usdtToFiatRate": 58,
    "fiatToUsdtRate": 0.017241379310344827,
    "action": "insert"
  }
}
```

{% endtab %}

{% tab title="Response Fields" %}

| Field                  | Type     | Description                                                                                    |
| ---------------------- | -------- | ---------------------------------------------------------------------------------------------- |
| `rateId`               | `number` | Unique ID of the active rate record.                                                           |
| `currencySymbol`       | `string` | Fiat currency symbol for which the rate was set.                                               |
| `cryptoCurrencySymbol` | `string` | Crypto currency symbol used for conversion. Currently `USDT`.                                  |
| `usdtToFiatRate`       | `number` | Submitted rate in `1 USDT = x fiatCurrency` format.                                            |
| `fiatToUsdtRate`       | `number` | Derived rate in `1 fiatCurrency = x USDT` format.                                              |
| `action`               | `string` | Indicates whether the rate was newly inserted or updated. Possible values: `insert`, `update`. |
| {% endtab %}           |          |                                                                                                |
| {% endtabs %}          |          |                                                                                                |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tylt.money/introduction/tylt-crossramp-fiat-crypto-solutions/philippines-php/administration/set-rate.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
