Countries

Use these methods to obtain and manage information about the countries available in the Back Office.

GET[host]/api/v2/countries

Get a list of countries

GET[host]/api/v2/countries/{countryId}

Get country details

PUT[host]/api/v2/countries/{countryId}

PATCH[host]/api/v2/countries/{countryId}

Update a country

Get a list of countries

Use this method to obtain a list of available countries.

To obtain detailed information about a specific country, use a separate method to get country details.

Request

Header parameters:

  • Authorization: Bearer <access_token>

Query parameters:

The following filter parameters are available for this method:

alpha2Code

A two-letter country code (as per ISO 3166-2).

alpha3Code

A three-letter country code (as per ISO 3166-3).

numericCode

A numeric country code (as per ISO 3166).

countryName

The localized country name.

enabled

If true, a country is available for selection when clients sign up to the B2Core UI; otherwise, false.

The following sorting parameter is available for this method:

enabled

If true, a country is available for selection when clients sign up to the B2Core UI; otherwise false.

Refer to the Query parameters section of the API Overview for details on applying filter and sorting parameters.

GET[host]/api/v2/countries

curl --location -g --request GET 'https://host.name/api/v2/countries?limit=10&offset=0&sort_order=desc&sort_by=enabled&filter[alpha2Code]=US&filter[alpha3Code]=USA&filter[numericCode]=840&filter[countryName]=United States&filter[enabled]=true' \
--header 'Authorization: Bearer <token>'

Response

A response includes an array of Country objects providing information about the countries matching the request parameters.

Get country details

Use this method to obtain detailed information about a specified country.

To obtain a list of available countries, use a separate method to get a list of countries.

Request

Header parameters:

  • Authorization: Bearer <access_token>

Path parameters:

countryId required

The country identifier.

GET[host]/api/v2/countries/{countryId}

curl --location --request GET 'https://host.name.org/api/v2/countries/840' \
--header 'Authorization: Bearer <token>'

Response

A response includes a Country object providing information about the specified country.

Update a country

Use this method to enable or disable a specified country for client registration.

Note

Instead of the method described below, you can use a similar method that uses the HTTP verb PATCH.

Request

Header parameters:

  • Authorization: Bearer <access_token>

Path parameters:

countryId required

The identifier of a country.

Body:

The following field value can be updated for a country:

enabled boolean

If true, a country is available for selection when clients sign up to the B2Core UI.

PUT[host]/api/v2/countries/{countryId}

curl --location --request PUT 'https://host.name/api/v2/countries/840' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "enabled": true
}'

Response

A response includes a Country object providing information about the country that was updated.