Service to obtain the exchange Rate
Intro
This API allows you to directly obtain the exchange rate from the Diario Oficial de la Federación (DOF) system.
Important points
Required parameters
The field type is required to determine which fields are required. The field can have the following possible values:
- daily, to obtain the exchange rate of the day the operation is executed
- date, to obtain the exchange rate from a specific date
- indicator, to obtain the exchange rate of a specific indicator in a period of time
Daily
This query does not require any other parameters to be applied.
{
"type":"daily"
}
Date
For this type of query, it is required to add the startDate field to the request. The format must be YYYY-MM-DD.
{
"type":"date",
"startDate":"2023-04-27"
}
Indicator
For this type of query, the following parameters are required:
- startDate, the format must be YYYY-MM-DD.
- endField, the format must be YYYY-MM-DD.
- indicator, the indicator to consult.
{
"type":"indicator",
"startDate": "2023-04-27",
"endDate": "2023-04-27",
"indicator": "158"
}
The next elements are the possible indicators:
Value | Description |
---|---|
159 | UDIS |
160 | CCP |
161 | CCP-UDIS |
162 | CPP |
163 | CPP-DOLARES |
165 | TIIE 28 DIAS |
166 | TIIE 91 DIAS |
167 | TIIC DEPOSITOS 60 DIAS |
168 | TIIC DEPOSITOS 90 DIAS |
169 | TIIC DEPOSITOS 180 DIAS |
170 | TIIC PAGARES 28 DIAS |
171 | TIIC PAGARES 91 DIAS |
172 | TIIC PAGARES 182 DIAS |
174 | TIIE 182 DIAS |
175 | TIIE DE FONDEO |
176 | TIIE 90 DIAS |
177 | TIIE 29 DIAS |
178 | TIIE 27 DIAS |
179 | TIIE 26 DIAS |
180 | TIIE 181 DIAS |
181 | TIIE 92 DIAS |
182 | TIIE 89 DIAS |
Successful response
To learn about the fields of a successful response, refer to the different examples in the response section.
Test the service (test cases)
We included a query parameter in the Sandbox environment, so you can query the test cases that we created for running tests.
To obtain the response, you shall fill the query parameter with:
- daily_success: sends back a successful example of a daily request
- date_success: sends back a successful example of a daily request
- indicator_success: sends back a successful example of a daily request
- date_notFound: sends back an answer with the status "NOT FOUND" to indicate that the query was not found on the DOF system.
- date_notFound: sends back an answer with the status "NOT FOUND" to indicate that the query was not found on the DOF system.
- indicator_notFound: sends back an answer with the status "NOT FOUND" to indicate that the query was not found on the DOF system.
- unavailable: sends back an answer with the status "INTERNAL_ERROR" to indicate that the DOF service is not available.
Possible Errors
Type required
You will receive a 400 bad request if the type field is not provided to the request.
{
"type": "Invalid type, valid options are: daily, date, indicator"
}
Required fields
You will get a 400 bad request error when any of the parameters are not provided in the body request.
{
"endDate": "missing field",
"indicator": "missing field",
"startDate": "missing field"
}
Invalid format
You will get a 400 bad request error when any of the parameters do not conform the specific length or format
{
"startDate": "Invalid format, expected format is: yyyy-MM-dd"
}
Test case not found
If a test case parameter is not sent or a value other than those mentioned above is sent, the service will return the following error 400 bad request
{
"testCase": "EMPTY_ERROR; test case not found"
}