Authentication

circle-exclamation

Postman's APIs uses API key-based and static IP whitelisting for authentication. API keys are on a per-campaign basis and can only send and retrieve messages from the same campaign.

Your API keys carry many privileges, so be sure to keep them secure. Don't share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

Authentication to the API is performed with HTTP Bearer Autharrow-up-right.

Include your API key in the Authorization header:

Authorization: Bearer <YOUR_API_KEY>

The following request sends a single message to a recipient.

curl -X POST https://postman.gov.sg/api/v2/campaigns/campaign_abc123/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer key_prod_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6" \
  -d '{
    "recipient": "6591112222",
    "language": "english"
  }'

You must make all API calls over HTTPSarrow-up-right. Calls that you make over plain HTTP will fail. API requests without authentication will also fail.

If you make a request without authentication, you will receive HTTP 401 and the following in your response body:

{
    "message": "Unauthorized",
    "statusCode": 401
}

Last updated

Was this helpful?