Skip to content

pos-list-country-states ​

Method: GET
Path: /pos/common/countries/{country_iso_code}/states

Tags: Locations

Summary ​

Retrieve country wise states

Pos SDK Usage ​

SDK Method: pos.listCountryStates()

Example:

typescript
const { data, error } = await pos.listCountryStates({
  country_iso_code: "IN"
});

if (error) {
  console.error("Failed to list states:", error.message);
} else {
  data.states?.forEach(state => console.log(state.name));
}

TypeScript Definition ​

typescript
"pos-list-country-states": {
        parameters: {
            query?: never;
            header?: never;
            path: {
                /** @description ISO 3166-1 alpha-2 country code (e.g., `IN` for India). */
                country_iso_code: string;
            };
            cookie?: never;
        };
        requestBody?: never;
        responses: {
            /** @description OK */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        message: string;
                        success: boolean;
                        content: {
                            states: components["schemas"]["CountryState"][];
                        };
                    };
                };
            };
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
            403: components["responses"]["Forbidden"];
            408: components["responses"]["RequestTimeout"];
            500: components["responses"]["InternalServerError"];
            504: components["responses"]["GatewayTimeout"];
        };

    }

Component References ​

ReferenceResolves To
components["schemas"]["CountryState"]CountryState
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized
components["responses"]["Forbidden"]Forbidden
components["responses"]["RequestTimeout"]RequestTimeout
components["responses"]["InternalServerError"]InternalServerError
components["responses"]["GatewayTimeout"]GatewayTimeout

Parameters ​

  • country_iso_code (path): ISO 3166-1 alpha-2 country code (e.g., IN for India).

Responses ​

200 ​

OK

400 ​

Bad request

401 ​

Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.

403 ​

Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.

408 ​

500 ​

The request failed because of an unexpected error.

504 ​

The request timed out.

OpenAPI Definition ​

json
{
  "operationId": "pos-list-country-states",
  "summary": "Retrieve country wise states",
  "parameters": [
    {
      "name": "country_iso_code",
      "in": "path",
      "description": "ISO 3166-1 alpha-2 country code (e.g., `IN` for India).",
      "required": true,
      "schema": {
        "type": "string",
        "maxLength": 2,
        "minLength": 2,
        "pattern": "^[A-Z]{2}$"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "success": {
                "type": "boolean"
              },
              "content": {
                "properties": {
                  "states": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/CountryState"
                    }
                  }
                },
                "required": [
                  "states"
                ],
                "type": "object"
              }
            },
            "required": [
              "message",
              "success",
              "content"
            ]
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "408": {
      "$ref": "#/components/responses/RequestTimeout"
    },
    "500": {
      "$ref": "#/components/responses/InternalServerError"
    },
    "504": {
      "$ref": "#/components/responses/GatewayTimeout"
    }
  },
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/admin-pos/operations/pos-list-country-states"
  },
  "security": [
    {
      "Authorization": []
    },
    {
      "X-Api-Key": []
    }
  ],
  "tags": [
    "Locations"
  ],
  "x-speakeasy-group": "pos",
  "x-speakeasy-name-override": "listCountryStates"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: