> For the complete documentation index, see [llms.txt](https://postman-v2.guides.gov.sg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://postman-v2.guides.gov.sg/technical-users-api/api-reference/authentication.md).

# Authentication

{% hint style="warning" %}

* Your API key is sensitive and should be treated as a secret.
* Only requests from whitelisted IP addresses will be accepted.
* If your API key is compromised, delete it immediately through the web UI and generate a new one.
  {% endhint %}

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 Auth](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#authentication_schemes).&#x20;

Include your API key in the `Authorization` header:

```
Authorization: Bearer <YOUR_API_KEY>
```

{% tabs %}
{% tab title="Sample Request" %}
The following request sends a single message to a recipient.

```bash
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"
  }'
```

{% endtab %}

{% tab title="Sample Response" %}
Message successfully created and queued for sending.

```json
{
  "id": "msg_abc123xyz789",
  "recipient": "6591112222",
  "language": "english",
  "latestStatus": "created",
  "campaignId": "campaign_abc123",
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}
```

{% endtab %}
{% endtabs %}

You must make all API calls over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). 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:

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

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://postman-v2.guides.gov.sg/technical-users-api/api-reference/authentication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
