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

# Detect Operator

> Detect the Mobile Money operator from a phone number. Use this to pre-fill the operator field without asking the player.

## Typical integration flow

<Steps>
  <Step title="Player enters their phone number">
    Your UI collects the player's MSISDN at checkout.
  </Step>

  <Step title="Detect the operator">
    Call `POST /msisdn/detect` with the raw number — winam-payments normalizes it to E.164 and identifies the operator.
  </Step>

  <Step title="Pre-fill the deposit/withdrawal request">
    Use `operator` from the response directly in your `POST /deposits` or `POST /withdrawals` call — no manual selection required.
  </Step>
</Steps>

<Note>
  Currently supported country: **CM** (Cameroon). `country_code` defaults to `CM` if omitted.
</Note>

## Cameroon prefix table

| Operator             | Prefixes                  |
| -------------------- | ------------------------- |
| **MTN Mobile Money** | `67x`, `68x`, `650`–`654` |
| **Orange Money**     | `69x`, `655`–`659`        |

<Warning>
  `POST /deposits` and `POST /withdrawals` enforce this table: a request whose
  `msisdn` prefix clearly contradicts the `operator` field (e.g. a `655…`
  Orange number with `operator=mtn`) is rejected with **422** before any USSD
  is sent. Numbers with unknown prefixes are accepted as-is.
</Warning>


## OpenAPI

````yaml POST /api/v1/msisdn/detect
openapi: 3.1.0
info:
  title: Winam Payments API
  description: >

    ## winam-payments — Mobile Money API


    Payment abstraction layer between your **sportsbook or frontend platform**
    and Mobile Money providers in Cameroon (MTN MoMo, Orange Money).


    ### Deposit flow

    1. Your platform calls `POST /api/v1/deposits` with a unique `reference`

    2. winam-payments triggers a USSD collection on the merchant SIM

    3. The player receives a notification on their phone and confirms with their
    PIN

    4. The confirmation SMS is received → transaction `succeeded`

    5. Webhook sent to your `callback_url`


    ### Withdrawal flow

    1. Your platform calls `POST /api/v1/withdrawals`

    2. A Winam operator approves manually

    3. winam-payments sends the USSD transfer

    4. Result webhook sent to your `callback_url`


    ### Authentication

    All requests to `/deposits` and `/withdrawals` must include the header:

    ```

    X-API-Key: <your_api_key>

    ```

    In development (`SPORTSBOOK_API_KEY` empty), authentication is disabled.


    ### Full documentation

    See [docs.winampay.de](https://docs.winampay.de) for the complete public
    documentation with guides, examples, and interactive playground.
  contact:
    name: Eins Innovativ
    email: support@eins-innovativ.de
  version: 0.1.0
servers: []
security: []
tags:
  - name: deposits
    description: >-
      Initiate Mobile Money deposits. The player receives a USSD notification on
      their phone to confirm payment.
  - name: withdrawals
    description: >-
      Initiate Mobile Money withdrawals. Requires manual approval from a Winam
      operator before execution.
  - name: transactions
    description: >-
      Query and manage existing transactions. Use for status polling or incident
      recovery.
  - name: providers
    description: >-
      List available providers and detect the operator from an MSISDN. Use to
      populate payment options in your player interface.
  - name: security
    description: >-
      Public key endpoint for verifying JWT signatures on outbound webhooks.
      Fetch this key once and cache it.
paths:
  /api/v1/msisdn/detect:
    post:
      tags:
        - providers
      summary: Detect operator from an MSISDN
      operationId: detect_msisdn_operator_api_v1_msisdn_detect_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MsisdnDetectRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MsisdnDetectResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    MsisdnDetectRequest:
      properties:
        msisdn:
          type: string
          title: Msisdn
          description: Phone number in local or E.164 format
          examples:
            - '+237670123456'
        country_code:
          type: string
          title: Country Code
          description: >-
            ISO 3166-1 alpha-2 country code. Currently only `CM` (Cameroon) is
            supported.
          default: CM
          examples:
            - CM
      type: object
      required:
        - msisdn
      title: MsisdnDetectRequest
    MsisdnDetectResponse:
      properties:
        msisdn_normalized:
          type: string
          title: Msisdn Normalized
          description: MSISDN normalised to E.164 format
          examples:
            - '+237670123456'
        is_valid:
          type: boolean
          title: Is Valid
          description: Whether the MSISDN is a recognised Cameroon number
        country_code:
          type: string
          title: Country Code
          examples:
            - CM
        operator:
          anyOf:
            - type: string
            - type: 'null'
          title: Operator
          description: 'Detected operator: `"mtn"` | `"orange"` | `null`'
          examples:
            - mtn
        operator_display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Operator Display Name
          examples:
            - MTN Mobile Money
        provider_suggestion:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider Suggestion
          description: Suggested `provider_id` to use in the deposit/withdrawal request
          examples:
            - sim_gateway_mtn
        provider_display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider Display Name
          examples:
            - MTN Mobile Money
        provider_logo_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider Logo Url
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message if `is_valid` is false
      type: object
      required:
        - msisdn_normalized
        - is_valid
        - country_code
        - operator
        - operator_display_name
        - provider_suggestion
        - provider_display_name
        - provider_logo_url
      title: MsisdnDetectResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````