Guides
Getting started

Authentication

Sandbox access tokens, the app access token, the app secret and the Graph API 190 errors.

As with Meta, every Graph API call carries an access token in the Authorization: Bearer <token> header (Mimicr also accepts Authorization: OAuth <token> and ?access_token=). There is no login endpoint for your backend: the token comes ready from the sandbox, like a Meta system user token, or out of the Embedded Signup flow.

Sandbox tokens

Every sandbox starts with a Token do sistema token that never expires and sees the default WABA. Read it with GET https://api.mimicr.dev/v1/whatsapp/{slug} (access_tokens) or in the console, under Credentials and IDs.

bash
curl --url https://whatsapp.mimicr.dev/v24.0/424361664134261 \
  --header 'Authorization: Bearer <token>'

Create and revoke tokens with the control API, using the organization key:

bash
curl --request POST \
  --url https://api.mimicr.dev/v1/whatsapp/docs/tokens \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "label": "CI", "waba_id": "313255174969123" }'

curl --request DELETE \
  --url https://api.mimicr.dev/v1/whatsapp/docs/tokens/<id or token> \
  --header 'Authorization: Bearer mk_...'

A token only sees the WABA it belongs to. Numbers, templates and the WABA of another business in the same app answer as if they did not exist (100, subcode 33), as with Meta.

App access token

Some platform routes take the app access token, <app_id>|<app_secret>: Debug an access token and Start an upload session. The App ID and app secret are the sandbox's.

bash
curl --url 'https://whatsapp.mimicr.dev/v24.0/debug_token?input_token=<token>' \
  --header 'Authorization: Bearer <app_id>|<app_secret>'

The app token does not send messages: on WABA, phone number and message routes it gets 403 with error 200 ("Provide valid app ID").

App secret

The app secret signs webhooks (X-Hub-Signature-256, see Verify the signature) and authenticates the code exchange at /oauth/access_token. To rotate it:

bash
curl --request POST \
  --url https://api.mimicr.dev/v1/whatsapp/docs/app-secret/rotate \
  --header 'Authorization: Bearer mk_...'

Tokens, app secret and callback only change with the organization key (or in the console). The /_sim/v1 routes called with the sandbox token refuse those changes with 403.

Authentication errors

SituationHTTPError
No token400104 "An access token is required to request this resource."
Unknown token401190 "Invalid OAuth access token - Cannot parse access token"
Revoked token401190, error_subcode: 460
Object of another WABA or nonexistent400100, error_subcode: 33, GraphMethodException
Version before v18.04002635
json
{
  "error": {
    "message": "Invalid OAuth access token - Cannot parse access token",
    "type": "OAuthException",
    "code": 190,
    "fbtrace_id": "AsimZ3x8k2Qp"
  }
}

401 responses also carry the WWW-Authenticate header, as in the Graph API.