> For the complete documentation index, see [llms.txt](https://docs.migo.pe/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.migo.pe/v2/tipo-de-cambio/tipo-de-cambio-sunat.md).

# Tipo de cambio SUNAT

La información se actualiza de forma diaria entre las 00:00 y 06:00 horas (GMT-5) debido a la disponibilidad variable de las fuentes oficiales.

Puede consultar información del año 2010 en adelante.

## GET /tipo-cambio/sunat

> Consulta tipo de cambio por fecha SUNAT

```json
{"openapi":"3.0.2","info":{"title":"MIGO API","version":"2.0"},"tags":[{"name":"tipo-cambio"}],"servers":[{"url":"https://api.migo.pe/api/v2"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"parameters":{"AcceptJsonParam":{"name":"Accept","in":"header","required":true,"schema":{"type":"string"}}},"schemas":{"TipoCambio":{"type":"object","properties":{"success":{"type":"boolean"},"fecha":{"type":"string"},"moneda":{"type":"string"},"precio_compra":{"type":"string"},"precio_venta":{"type":"string"}}},"Forbidden":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}},"NotFound":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}},"UnprocessableContent":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"errors":{"type":"object"}}}},"responses":{"ForbiddenResponse":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Forbidden"}}}}}},"paths":{"/tipo-cambio/sunat":{"get":{"summary":"Consulta tipo de cambio por fecha SUNAT","tags":["tipo-cambio"],"parameters":[{"$ref":"#/components/parameters/AcceptJsonParam"},{"name":"fecha","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TipoCambio"}}}},"403":{"$ref":"#/components/responses/ForbiddenResponse"},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnprocessableContent"}}}}}}}}}
```

## GET /tipo-cambio/sunat/ultimo

> Consulta último tipo de cambio SUNAT

```json
{"openapi":"3.0.2","info":{"title":"MIGO API","version":"2.0"},"tags":[{"name":"tipo-cambio"}],"servers":[{"url":"https://api.migo.pe/api/v2"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"parameters":{"AcceptJsonParam":{"name":"Accept","in":"header","required":true,"schema":{"type":"string"}}},"schemas":{"TipoCambio":{"type":"object","properties":{"success":{"type":"boolean"},"fecha":{"type":"string"},"moneda":{"type":"string"},"precio_compra":{"type":"string"},"precio_venta":{"type":"string"}}},"Forbidden":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}},"NotFound":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}},"UnprocessableContent":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"errors":{"type":"object"}}}},"responses":{"ForbiddenResponse":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Forbidden"}}}}}},"paths":{"/tipo-cambio/sunat/ultimo":{"get":{"summary":"Consulta último tipo de cambio SUNAT","tags":["tipo-cambio"],"parameters":[{"$ref":"#/components/parameters/AcceptJsonParam"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TipoCambio"}}}},"403":{"$ref":"#/components/responses/ForbiddenResponse"},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnprocessableContent"}}}}}}}}}
```

## GET /tipo-cambio/sunat/historico

> Consulta tipo de cambio por rango de fecha SUNAT

```json
{"openapi":"3.0.2","info":{"title":"MIGO API","version":"2.0"},"tags":[{"name":"tipo-cambio"}],"servers":[{"url":"https://api.migo.pe/api/v2"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"parameters":{"AcceptJsonParam":{"name":"Accept","in":"header","required":true,"schema":{"type":"string"}}},"schemas":{"TipoCambioCollection":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/TipoCambioCollectionItem"}}}},"TipoCambioCollectionItem":{"type":"object","properties":{"fecha":{"type":"string"},"moneda":{"type":"string"},"precio_compra":{"type":"string"},"precio_venta":{"type":"string"}}},"Forbidden":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}},"NotFound":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}},"UnprocessableContent":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"errors":{"type":"object"}}}},"responses":{"ForbiddenResponse":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Forbidden"}}}}}},"paths":{"/tipo-cambio/sunat/historico":{"get":{"summary":"Consulta tipo de cambio por rango de fecha SUNAT","tags":["tipo-cambio"],"parameters":[{"$ref":"#/components/parameters/AcceptJsonParam"},{"name":"fecha_inicio","in":"query","required":true,"schema":{"type":"string"}},{"name":"fecha_fin","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TipoCambioCollection"}}}},"403":{"$ref":"#/components/responses/ForbiddenResponse"},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnprocessableContent"}}}}}}}}}
```
