Skip to content
PharmaFlow Knowledgebase
Esc
↑↓navigate↵open⌘Jpreview

File an exchange rate

Admin only. Files a rate for one ordered pair. Rates are append only, so a correction is another POST and a frozen sale keeps its rate.

POST/api/v1/currency/rates
Authorization
AuthorizationBearer token (JWT) · headerrequired

JWT from POST /api/v1/auth/login sent as Authorization Bearer.

Request body
requiredapplication/json
base_codestringrequired
quote_codestringrequired
ratenumberrequired
effective_atstring
sourcestring
Responses
201

Rate filed

idstringrequired
base_codestringrequired
quote_codestringrequired
ratenumberrequired
sourcestringrequired
effective_atstringrequired
created_atstringrequired
400

base_code or quote_code is missing, the pair is a currency against itself, a currency is unknown or inactive, or the rate is not positive

detailstringrequired
403

Caller is not an admin

detailstringrequired
Try it
Server
Authorization
Bodyapplication/json
Request
curl -X POST 'http://localhost:8000/api/v1/currency/rates' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "base_code": "string",
  "quote_code": "string",
  "rate": 1,
  "effective_at": "string",
  "source": "string"
}'
Response
{
  "id": "string",
  "base_code": "string",
  "quote_code": "string",
  "rate": 0,
  "source": "string",
  "effective_at": "string",
  "created_at": "string"
}