OTP

The OTP, or One-Time Password, is a crucial security measure for protecting your accounts and sensitive information. At Our Voice, we've implemented a robust system for managing OTPs, enabling you to send, validate and manage these codes securely and efficiently.

Whether you need to send an authentication code to secure a connection or to validate a sensitive transaction, our OTP system is there to guarantee optimum security for you and your users.

Properties

  • Name
    app_id
    Type
    string
    Description

    The id of app.

  • Name
    cost
    Type
    string
    Description

    The cost of verification.

  • Name
    status
    Type
    string
    Description

    The status of otp verification.

  • Name
    channel
    Type
    string
    Description

    The channel of otp.

  • Name
    send_to
    Type
    string
    Description

    The send_to of otp.

  • Name
    code
    Type
    string
    Description

    The code of otp.

  • Name
    expired_at
    Type
    timestamp
    Description

    The OTP expired_at date.

  • Name
    verified_at
    Type
    timestamp
    Description

    The OTP verified_at date.

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the otp was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    Timestamp of when the otp was updated.

POST/v1/otp/send

Send OTP code

This endpoint to send otp code.

Required attributes

  • Name
    app_id
    Type
    string
    Description

    The ID (uuid) of app. Your use app_id or app_name. Not both.

  • Name
    app_name
    Type
    string
    Description

    The name of app. Your use app_name or app_id. Not both.

  • Name
    send_to
    Type
    string
    Description

    The phone number you want to check .

Request

POST
/v1/otp/send
curl --request POST \
  --post "https://api.getourvoice.com/v1/otp/send" \
  --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
--data "{
"send_to": "22962585015",
"app_id": "088421fe-00c6-11ef-9fe5-7f2e687d3db8"
}"

Response (200)

{
    "data": {
        "id": "3ccda41f-6b0a-432e-9129-03c12d4b46a8",
        "app_id": "088421fe-00c6-11ef-9fe5-7f2e687d3db8",
        "cost": 0,
        "status": "pending",
        "channel": "sms",
        "send_to": "22962585015",
        "send_code_attempts": {
            "sms": [
                {
                    "id": "33db800d-4547-4276-a65f-9bc8b6262baa",
                    "account_id": "7bbbbcab-05b9-4e5d-8b41-c23034e0f8b7",
                    "from": "OURVOICE",
                    "to": "22962585015",
                    "provider_message_id": null,
                    "body": "Votre code pour Borg est: 729437",
                    "status": "queued",
                    "direction": "outgoing",
                    "cost": 0,
                    "currency": "XOF",
                    "sent_time": "2024-05-02 19:02:32",
                    "campaign_id": null,
                    "flow_id": null,
                    "contact_id": null,
                    "sender_id": "9b38a5f6-bb4f-46a4-9ea4-2a207ae01f1e",
                    "reason": null,
                    "deleted_at": null,
                    "created_at": "2024-05-02T18:02:32.000000Z",
                    "updated_at": "2024-05-02T18:02:32.000000Z",
                    "units": 1,
                    "unit_cost": 2,
                    "otp_id": "3ccda41f-6b0a-432e-9129-03c12d4b46a8"
                }
            ],
            "voice": []
        },
        "created_at": "2024-05-02T18:02:32.000000Z",
        "updated_at": "2024-05-02T18:02:32.000000Z"
    }
}


POST/v1/otp/verify

Verify OTP code

This endpoint allows you to list the flow by a certain filter in Our voice.

Required attributes

  • Name
    app_id
    Type
    string
    Description

    The ID (uuid) of app. Your use app_id or app_name. Not both.

  • Name
    app_name
    Type
    string
    Description

    The name of app. Your use app_name or app_id. Not both.

  • Name
    send_to
    Type
    string
    Description

    The phone number you want to check .

  • Name
    code
    Type
    int
    Description

    The otp code.

Request

POST
/v1/otp/verify
curl --request POST \
  --post "https://api.getourvoice.com/v1/otp/verify" \
  --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
--data "'{
"code": "898223",
"send_to": "22962585015",
"app_id": "088421fe-006-11ef-9fe5-7f2e687d3db8"
}"

Response (200)

{
    "success": true,
    "valid": true,
    "message": "Code valide. ",
    "data": {
        "id": "3ccda41f-6b0-432e-9129-03c12d4b46a8",
        "app_id": "088421fe-006-11ef-9fe5-7f2e687d3db8",
        "cost": 25,
        "status": "verified",
        "channel": "sms",
        "send_to": "22962585015",
        "code": "52760",
        "expired_at": "2024-05-02T18:12:32.000000Z",
        "verified_at": 2024-05-02T18:12:30.000000Z,
        "created_at": "2024-05-02T18:02:32.000000Z",
        "updated_at": "2024-05-02T18:09:04.000000Z",
        "verification_attemps": [
            {
                "id": "a761e44d-834f-4118-93c6-8033f15288a3",
                "otp_id": "3ccda41f-6b0a-432e-9129-03c12d4b46a8",
                "status": "succeeded",
                "created_at": "2024-05-02T18:09:04.000000Z",
                "updated_at": "2024-05-02T18:09:04.000000Z"
            }
        ]
    }
}