CorebanqCorebanq Developer Docs
Countriesv1

Update a country

Updates a country. The ISO codes are not writable. The body is MERGED onto the stored row and which fields survive omission depends on their type — strings and pointers are retained, while tags, metadata, order and active are overwritten with their zero values. See UpdateCountryInput.

PUT
/v1/countries/{id}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Country id.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Body of PUT /v1/countries/{id}. The ISO codes are NOT in this struct — they cannot be changed, and sending them is silently discarded by the decoder.

This is a MERGE, not a plain replacement, and which fields survive omission depends on their Go kind. commonutil.Populate copies the input onto the row loaded by First, but shouldSkipField skips empty strings and nil-or-empty pointers:

  • RETAINED when omitted, and impossible to clear through this endpoint at all: name, icon, emoji, phone_prefix (plain strings — an explicit "" is skipped too) and description (*string — nil and a pointer to "" are both skipped).
  • OVERWRITTEN with the zero value when omitted: tags (nil slice), metadata (nil map), order (0), iban_length (0) and active (false). Slices, maps, ints and bools are not skipped.

So a body of {"name": "Switzerland"} keeps icon, emoji, phone_prefix and description, but clears tags and metadata, sets order to 0 (which reorders the country to the front of the v1 list) and iban_length to 0, and deactivates it. No property is required, and the handler runs no validation — see the note on input validation in info.description. Send the full record when you mean to keep the overwritten fields; that is not a reason for a client-side validator to reject a partial body, since the server accepts {"name": "Switzerland"} and applies exactly the merge described above.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PUT "https://example.com/v1/countries/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "Content-Type: application/json" \  -d '{}'
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "iso_alpha_2": "CH",
  "iso_alpha_3": "CHE",
  "iso_numeric": "756",
  "icon": "string",
  "icon_url": "string",
  "emoji": "🇨🇭",
  "phone_prefix": "+41",
  "order": 999,
  "tags": [
    "string"
  ],
  "iban_length": 0,
  "name": "Switzerland",
  "description": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",
  "modified_at": "2019-08-24T14:15:22Z",
  "modified_by": "e8d4374d-93a1-4e98-a6c6-fdcf00c5059f",
  "active": true,
  "metadata": {}
}
{
  "status": 404,
  "message": "Country not found",
  "code": "countries_m.country_not_found",
  "class": "business",
  "retryable": true,
  "details": [
    {
      "field": "string",
      "rule": "string",
      "param": "string",
      "message": "string"
    }
  ]
}
{
  "status": 404,
  "message": "Country not found",
  "code": "countries_m.country_not_found",
  "class": "business",
  "retryable": true,
  "details": [
    {
      "field": "string",
      "rule": "string",
      "param": "string",
      "message": "string"
    }
  ]
}
{
  "status": 404,
  "message": "Country not found",
  "code": "countries_m.country_not_found",
  "class": "business",
  "retryable": true,
  "details": [
    {
      "field": "string",
      "rule": "string",
      "param": "string",
      "message": "string"
    }
  ]
}
{
  "status": 404,
  "message": "Country not found",
  "code": "countries_m.country_not_found",
  "class": "business",
  "retryable": true,
  "details": [
    {
      "field": "string",
      "rule": "string",
      "param": "string",
      "message": "string"
    }
  ]
}
{
  "status": 429,
  "message": "rate limit exceeded",
  "code": "rate_limits_m.exceeded",
  "class": "temporary",
  "retryable": true
}
{
  "status": 404,
  "message": "Country not found",
  "code": "countries_m.country_not_found",
  "class": "business",
  "retryable": true,
  "details": [
    {
      "field": "string",
      "rule": "string",
      "param": "string",
      "message": "string"
    }
  ]
}

{
  "overall_status": "unhealthy",
  "message": "Service is shutting down",
  "timestamp": "2026-08-27T15:04:05.123456789+02:00"
}