Authentication

Authenticate API v2 requests with a private API token

All API v2 requests must include your private API token. Get it from account settings.

You can pass the token in any one of these ways:

  1. JSON body
  2. HTTP header
  3. URL query parameter

JSON body

Send private_api_token in the request JSON payload.

shell
curl -X POST "https://api.pact.im/api/p2/some_endpoint" \
  --header "Content-Type: application/json" \
  --data '{
    "private_api_token": "YOUR_API_TOKEN",
    "another_parameter": "value"
  }'

HTTP header

Send X-Private-Api-Token in the request headers.

shell
curl -X POST "https://api.pact.im/api/p2/some_endpoint" \
  --header "Content-Type: application/json" \
  --header "X-Private-Api-Token: YOUR_API_TOKEN" \
  --data '{
    "another_parameter": "value"
  }'

URL query parameter

Send private_api_token as a query string parameter.

shell
curl -X POST "https://api.pact.im/api/p2/some_endpoint?private_api_token=YOUR_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "another_parameter": "value"
  }'

Auth errors

If the token is missing or invalid, the API responds with 401:

json
{
  "errors": [
    {
      "status": 401,
      "code": "unauthorized",
      "title": "Unauthorized",
      "detail": "No token provided"
    }
  ]
}

Search…

Start typing to search