Octopus Cards

Currencies

List all supported currencies with ISO 4217 codes and decimal precision

GET /api/v1/currencies

Returns all active currencies with ISO 4217 codes and decimal precision.

Request

curl {{host}}/api/v1/currencies \
  -H "Authorization: Bearer <token>"
package main

import (
    "encoding/json"
    "fmt"
    "net/http"
)

type Currency struct {
    ID        int    `json:"id"`
    Name      string `json:"name"`
    Currency  string `json:"currency"`
    Precision int    `json:"precision"`
}

func main() {
    req, _ := http.NewRequest("GET", "{{host}}/api/v1/currencies", nil)
    req.Header.Set("Authorization", "Bearer <token>")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    var currencies []Currency
    json.NewDecoder(resp.Body).Decode(&currencies)

    for _, c := range currencies {
        fmt.Printf("%s (%s, %d decimals)\n", c.Name, c.Currency, c.Precision)
    }
}

No query parameters.

Response

[
  {
    "id": 1,
    "name": "US Dollar",
    "currency": "USD",
    "precision": 2
  },
  {
    "id": 2,
    "name": "Euro",
    "currency": "EUR",
    "precision": 2
  }
]

Response Fields

KeyTypeDescription
idintegerUnique currency identifier
namestringFull currency name (e.g. US Dollar)
currencystringISO 4217 currency code (3 characters, e.g. USD)
precisionintegerNumber of decimal places (e.g. 2 for USD, 0 for JPY)

Errors

401 Unauthorized — Missing or invalid JWT token.

{
  "error": {
    "name": "UnauthorizedError",
    "code": "UNAUTHORIZED",
    "message": "Authorization header required"
  }
}

403 Forbidden — Request IP not in whitelist.

{
  "error": {
    "name": "ForbiddenError",
    "code": "FORBIDDEN",
    "message": "IP address not authorized"
  }
}

500 Internal Server Error — Database query failed.

{
  "error": {
    "name": "InternalServerError",
    "code": "INTERNAL_SERVER_ERROR",
    "message": "Failed to retrieve currencies"
  }
}

On this page