api-ninjas-com Postal Code API

The Postal Code API enables you to look up detailed information for postal codes in Canada. You can input postal codes directly, or search for postal codes using city and province parameters.

Operations 1

GET /v1/postalcode Get postal code information #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/api-ninjas-com:api-ninjas-com-postal-code-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

api-ninjas-com-postal-code-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Ninjas Postal Code API
  description: 'Combined OpenAPI specification for every API Ninjas endpoint. Requests go to https://api.api-ninjas.com with an `X-Api-Key` header; get a free key at https://api-ninjas.com/register. Human-readable docs: https://api-ninjas.com/api. Index for LLMs: https://api-ninjas.com/llms.txt.'
  version: 1.0.0
  contact:
    name: API Ninjas
    url: https://api-ninjas.com
  license:
    name: Proprietary
servers:
- url: https://api.api-ninjas.com
  description: API Ninjas Production
security:
- ApiKeyAuth: []
tags:
- name: Postal Code
  description: The Postal Code API enables you to look up detailed information for postal codes in Canada. You can input postal codes directly, or search for postal codes using city and province parameters.
paths:
  /v1/postalcode:
    get:
      summary: Get postal code information
      description: Returns details for a Canadian postal code, given as A1A1A1 or A1A 1A1. Searching by `city` and `province` instead of a postal code requires premium.
      operationId: getPostalCode
      tags:
      - Postal Code
      parameters:
      - name: postal_code
        in: query
        description: The postal code to look up. Accepts Canadian postal codes in 6 characters (A1A1A1) or 7 characters with a space (A1A 1A1). The space will be automatically normalized if not provided.
        required: false
        schema:
          type: string
      - name: city
        in: query
        description: Full name of the city to search (case-sensitive). Premium only.
        required: false
        schema:
          type: string
      - name: province
        in: query
        description: 2-letter abbreviation of the province (e.g., ON, BC, QC). Premium only.
        required: false
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PostalCodeInfo'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostalCodeOpenapi_Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostalCodeOpenapi_Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostalCodeOpenapi_Error'
      security:
      - ApiKeyAuth: []
components:
  schemas:
    PostalCodeOpenapi_Error:
      type: object
      properties:
        message:
          type: string
    PostalCodeInfo:
      type: object
      properties:
        country:
          type: string
          description: Two-letter ISO country code for the result.
          example: CA
        city:
          type: string
          example: Ottawa
        region:
          type: string
          description: 'First-level region: state, province or county (e.g., England, Bayern).'
          example: Ontario
        region_code:
          type: string
          description: Code for the first-level region. Premium only.
          example: 'ON'
        county:
          type: string
          description: 'Second-level region: county, district or municipality. Premium only.'
          example: Ottawa
        county_code:
          type: string
          description: Code for the second-level region. Premium only.
          example: '3506'
        province:
          type: string
          example: 'ON'
        postal_code:
          type: string
          example: K1A 0B1
        area_code:
          type: string
          example: '613'
        timezone:
          type: string
          example: America/Toronto
        lat:
          type: string
          example: '45.4168'
        lon:
          type: string
          example: '-75.7002'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
externalDocs:
  description: API Ninjas documentation
  url: https://api-ninjas.com/api