Obtain Exchange Rate

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:

ValueDescription
159UDIS
160CCP
161CCP-UDIS
162CPP
163CPP-DOLARES
165TIIE 28 DIAS
166TIIE 91 DIAS
167TIIC DEPOSITOS 60 DIAS
168TIIC DEPOSITOS 90 DIAS
169TIIC DEPOSITOS 180 DIAS
170TIIC PAGARES 28 DIAS
171TIIC PAGARES 91 DIAS
172TIIC PAGARES 182 DIAS
174TIIE 182 DIAS
175TIIE DE FONDEO
176TIIE 90 DIAS
177TIIE 29 DIAS
178TIIE 27 DIAS
179TIIE 26 DIAS
180TIIE 181 DIAS
181TIIE 92 DIAS
182TIIE 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"
}
Language
Authorization
Header
Click Try It! to start a request and see the response here!