Partner API

Overview

The Partner API allows you to programmatically manage subscribers, reports, and other platform resources. All API calls require authentication via an access token obtained from the login endpoint.

Getting Started

To authenticate with the Partner API, you will need:

  • PROJECT_ID — your project identifier, visible under the project name in the Management Console.

  • PRIVATE_KEY — your Partner API password, found in Settings > General in the Management Console (masked by default — click the eye icon to reveal it).

See General project settings for details.

  1. Call POST /partner/login with your project credentials

    curl $BASE_URL/partner/login \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -d "login=$PROJECT_ID&password=$PRIVATE_KEY"

    Example response:

    {
        "result": "OK",
        "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
        "create_time": 1700000000,
        "expire_time": 1700003600
    }
    circle-info

    Use expire_time to track when to renew the access token. As a rule of thumb, trigger renewal before expire_time - 1 minute to avoid expired-token errors.

  2. Extract the access_token from the response

  3. Include the token as a Bearer token in subsequent requests

    curl -X POST "$BASE_URL/partner/v2/getUser" \
    -H 'accept: application/json'\
    -H "authorization: Bearer $ACCESS_TOKEN"\
    -H 'content-type: application/json' \
    -d '{"username": "'"$USERNAME"'"}'

    Example response:

    {
        "result": "OK",
        "user": {
            "id": 0,
            "username": "string",
            "auth_method": "string",
            "enabled": false,
            "extra": {
                "country": "string",
                "language": "string"
            }
        }
    }
circle-info

Default values are treated as missing fields. The API considers default values (0 for numbers, empty string for strings) equivalent to omitting the field entirely. For example, these requests are all parsed identically:

  • {"user_id": 0}

  • {"username": ""}

  • {}

This means user_id=0 is not a valid user ID, it will be interpreted as if no user ID was provided.

Resources

Last updated

Was this helpful?