MessageBird HLR API

The MessageBird HLR API provides a way to send Home Location Register network queries to any mobile number globally. It allows developers to determine which operator a mobile number belongs to in real-time and check whether the number is currently active on the network. This API is commonly used for number portability checks, fraud prevention, and optimizing message routing.

OpenAPI Specification

messagebird-hlr-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: MessageBird HLR API
  description: >-
    The MessageBird HLR API provides a way to send Home Location Register
    network queries to any mobile number globally. It allows developers to
    determine which operator a mobile number belongs to in real-time and
    check whether the number is currently active on the network. This API
    is commonly used for number portability checks, fraud prevention, and
    optimizing message routing.
  version: '1.0'
  contact:
    name: MessageBird Support
    url: https://support.messagebird.com
  termsOfService: https://www.messagebird.com/en/terms
externalDocs:
  description: HLR API Documentation
  url: https://developers.messagebird.com/api/hlr/
servers:
  - url: https://rest.messagebird.com
    description: Production Server
tags:
  - name: HLR
    description: >-
      Operations for creating and viewing HLR network queries.
security:
  - accessKey: []
paths:
  /hlr:
    post:
      operationId: createHlr
      summary: Create an HLR
      description: >-
        Creates a new HLR object and sends a network query for the
        specified phone number. MessageBird returns the created HLR object
        with each request.
      tags:
        - HLR
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HlrCreate'
      responses:
        '201':
          description: HLR created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Hlr'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '422':
          description: Unprocessable entity
  /hlr/{id}:
    get:
      operationId: viewHlr
      summary: View an HLR
      description: >-
        Retrieves the details of an existing HLR by its unique identifier.
        Use this to check the result of a previously submitted HLR query.
      tags:
        - HLR
      parameters:
        - $ref: '#/components/parameters/hlrIdParam'
      responses:
        '200':
          description: HLR details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Hlr'
        '401':
          description: Unauthorized
        '404':
          description: HLR not found
components:
  securitySchemes:
    accessKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Access key authentication in the form of 'AccessKey {accessKey}'.
  parameters:
    hlrIdParam:
      name: id
      in: path
      required: true
      description: >-
        The unique identifier of the HLR.
      schema:
        type: string
  schemas:
    HlrCreate:
      type: object
      required:
        - msisdn
      properties:
        msisdn:
          type: integer
          format: int64
          description: >-
            The phone number to perform the HLR query on in international
            format.
        reference:
          type: string
          description: >-
            A client reference for tracking purposes.
    Hlr:
      type: object
      properties:
        id:
          type: string
          description: >-
            The unique identifier of the HLR.
        href:
          type: string
          format: uri
          description: >-
            The URL of the HLR resource.
        msisdn:
          type: integer
          format: int64
          description: >-
            The phone number queried.
        network:
          type: integer
          description: >-
            The MCC-MNC code of the mobile network operator.
        reference:
          type: string
          description: >-
            The client reference.
        status:
          type: string
          description: >-
            The status of the HLR query.
          enum:
            - sent
            - absent
            - active
            - unknown
            - failed
        createdDatetime:
          type: string
          format: date-time
          description: >-
            The date and time when the HLR was created.
        statusDatetime:
          type: string
          format: date-time
          description: >-
            The date and time of the last status update.