> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pawapay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Predict Provider

Predicts the provider for the specified phone number.

Average misprediction rate when using this endpoint is **0.12%**.

<Warning>Benin has a relatively high level of number portability and therefore has an average misprediction rate of 6%.</Warning>


## OpenAPI

````yaml openapi_v2 post /v2/predict-provider
openapi: 3.0.0
info:
  title: PawaPay Merchant API V2
  description: Please find complete documentation from https://docs.pawapay.io/.
  version: v2
  x-logo:
    url: >-
      https://global-uploads.webflow.com/62824591015aa314fd308df1/6411b26596e3de3f52551c00_Logopawapay-p-500.png
    href: https://docs.pawapay.io/
    altText: PawaPay logo
servers:
  - url: https://api.sandbox.pawapay.io
    description: PawaPay Merchant API sandbox
  - url: https://api.pawapay.io
    description: PawaPay Merchant API production
security:
  - bearerAuth: []
tags:
  - name: deposits
    x-displayName: Deposits
  - name: split-payments
    x-displayName: Split Payments
  - name: checkouts
    x-displayName: Checkouts
  - name: payouts
    x-displayName: Payouts
  - name: refunds
    x-displayName: Refunds
  - name: remittances
    x-displayName: Remittances
  - name: payment-page
    x-displayName: Payment Page
  - name: toolkit
    x-displayName: Toolkit
  - name: finances
    x-displayName: Finances
paths:
  /v2/predict-provider:
    post:
      tags:
        - toolkit
      summary: Predict Provider
      operationId: predict-provider
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MsisdnInput'
        required: true
      responses:
        '200':
          description: Provider prediction was completed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProviderPrediction'
        '400':
          description: >-
            Request was rejected due to incompatibility with PawaPay API
            specification
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PredictionFailureResponse'
              examples:
                INVALID_INPUT:
                  value:
                    depositId: f4401bd2-1568-4140-bf2d-eb77d2b2b639
                    status: REJECTED
                    failureReason:
                      failureCode: INVALID_INPUT
                      failureMessage: >-
                        We are unable to parse the body of the request. Please
                        consult API documentation for valid request payload.
                MISSING_PARAMETER:
                  value:
                    depositId: f4401bd2-1568-4140-bf2d-eb77d2b2b639
                    status: REJECTED
                    failureReason:
                      failureCode: MISSING_PARAMETER
                      failureMessage: >-
                        Request does not include the required parameter
                        'phoneNumber'.
                INVALID_PARAMETER:
                  value:
                    depositId: f4401bd2-1568-4140-bf2d-eb77d2b2b639
                    status: REJECTED
                    failureReason:
                      failureCode: INVALID_PARAMETER
                      failureMessage: >-
                        Value for parameter 'provider' is invalid. Please
                        consult API documentation for validation rules.
                UNSUPPORTED_PARAMETER:
                  value:
                    depositId: f4401bd2-1568-4140-bf2d-eb77d2b2b639
                    status: REJECTED
                    failureReason:
                      failureCode: UNSUPPORTED_PARAMETER
                      failureMessage: >-
                        Request includes an unsupported parameter 'amount'.
                        Please remove unsupported parameters from request body.
        '401':
          description: >-
            Authentication failed. Make sure you have added the API token into
            the header. If using signatures, make sure they are valid.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/AuthenticationFailureResponse'
              examples:
                AUTHENTICATION_ERROR:
                  value:
                    failureReason:
                      failureCode: AUTHENTICATION_ERROR
                      failureMessage: The API token in the request is invalid.
        '403':
          description: Authorization failure. Please check your authentication token.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/AuthorizationFailureResponse'
              examples:
                AUTHORISATION_ERROR:
                  value:
                    failureReason:
                      failureCode: AUTHORISATION_ERROR
                      failureMessage: >-
                        The API token in the request is not authorised for this
                        endpoint.
        '500':
          description: An unknown failure has occurred.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/UnknownFailureResponse'
              examples:
                UNKNOWN_ERROR:
                  value:
                    failureReason:
                      failureCode: UNKNOWN_ERROR
                      failureMessage: Unable to process request due to an unknown problem.
components:
  schemas:
    MsisdnInput:
      required:
        - phoneNumber
      type: object
      properties:
        phoneNumber:
          $ref: '#/components/schemas/FlexibleMsisdnValue'
    ProviderPrediction:
      required:
        - country
        - provider
        - phoneNumber
      type: object
      properties:
        country:
          $ref: '#/components/schemas/Country'
        provider:
          $ref: '#/components/schemas/Provider'
        phoneNumber:
          $ref: '#/components/schemas/PredictedMsisdnValue'
    PredictionFailureResponse:
      required:
        - failureCode
        - failureMessage
      type: object
      properties:
        failureReason:
          type: object
          properties:
            failureCode:
              type: string
              description: |
                Reasoncode for the failure.
              example: MISSING_PARAMETER
            failureMessage:
              type: string
              description: A description of the failure
              example: Request does not include the required parameter 'phoneNumber'.
    AuthenticationFailureResponse:
      required:
        - failureCode
        - failureMessage
      type: object
      properties:
        status:
          type: string
          enum:
            - REJECTED
          description: The status of the response will always be `REJECTED`
          example: REJECTED
        failureReason:
          $ref: '#/components/schemas/AuthenticationFailureReason'
    AuthorizationFailureResponse:
      required:
        - failureCode
        - failureMessage
      type: object
      properties:
        status:
          type: string
          enum:
            - REJECTED
          description: The status of the response will always be `REJECTED`
          example: REJECTED
        failureReason:
          $ref: '#/components/schemas/AuthorizationFailureReason'
    UnknownFailureResponse:
      required:
        - failureCode
        - failureMessage
      type: object
      properties:
        failureReason:
          type: object
          properties:
            failureCode:
              type: string
              description: >
                Reason for the failure:

                * `UNKNOWN_ERROR` - Unable to process request due to an unknown
                problem.
              example: UNKNOWN_ERROR
            failureMessage:
              type: string
              description: A description of the failure
              example: Unable to process request due to an unknown problem.
    FlexibleMsisdnValue:
      type: string
      description: |
        The phone number (MSISDN) to predict the provider of.
        Must contain the country code.

        The input will be sanitized by:
        * removing the leading + sign
        * removing all whitespace
        * removing non-numeric characters
      example: +260 763-456789
    Country:
      type: string
      minLength: 3
      maxLength: 3
      description: >
        The country in which the payment was initiated.


        Format is ISO 3166-1 alpha-3, three character country code in upper
        case. Read more from
        [Wikipedia](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements).
      example: ZMB
    Provider:
      type: string
      description: >
        The provider represents the mobile money operator or processor that can
        process payments.


        Find here a list of all the supported [providers](/v2/docs/providers). 


        The [active
        configuration](/v2/api-reference/toolkit/active-configuration) endpoint
        provides the list of provider configured for your account.


        You can use the [predict
        provider](/v2/api-reference/toolkit/predict-provider) enpoint to predict
        the provider to use based on the phone number (MSISDN).
      example: MTN_MOMO_ZMB
    PredictedMsisdnValue:
      type: string
      description: >
        The correctly formatted phone number (MSISDN) from your original request
        that is in a valid format for the rest of the PawaPay Merchant API.
      example: '260763456789'
    AuthenticationFailureReason:
      required:
        - failureReason
      type: object
      properties:
        failureCode:
          type: string
          description: >
            Reason for the failure:

            * `NO_AUTHENTICATION` - The API token was not found in the request
            headers.

            * `AUTHENTICATION_ERROR` - The API token in the request headers is
            not valid.

            * `HTTP_SIGNATURE_ERROR` - The signature you have passed with the
            request did not pass verification.
          enum:
            - NO_AUTHENTICATION
            - AUTHENTICATION_ERROR
            - HTTP_SIGNATURE_ERROR
        failureMessage:
          type: string
          description: A description of the failure
    AuthorizationFailureReason:
      required:
        - failureReason
      type: object
      properties:
        failureCode:
          type: string
          description: >
            Reason for the failure:

            * `AUTHORISATION_ERROR` - The API Token in the request header is not
            authorised to make this request.

            * `DEPOSITS_NOT_ALLOWED` - Deposits are not enabled with the
            provider on your PawaPay account.

            * `PAYOUTS_NOT_ALLOWED` - Payouts are not enabled with the provider
            on your PawaPay account.

            * `REMITTANCES_NOT_ALLOWED` - Remittances are not enabled with the
            provider on your PawaPay account.

            * `REFUNDS_NOT_ALLOWED` - Refunds are not enabled with the provider
            on your PawaPay account.
          enum:
            - AUTHORISATION_ERROR
            - DEPOSITS_NOT_ALLOWED
            - PAYOUTS_NOT_ALLOWED
            - REMITTANCES_NOT_ALLOWED
            - REFUNDS_NOT_ALLOWED
        failureMessage:
          type: string
          description: A description of the failure
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        See
        [Authentication](/v2/docs/how_to_start#how-to-authenticate-calls-to-the-merchant-api).
      scheme: bearer
      bearerFormat: JWT

````