# 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](/paas/console-details/project-settings/general.md) for details.

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

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

   Example response:

   ```json
   {
       "result": "OK",
       "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
       "create_time": 1700000000,
       "expire_time": 1700003600
   }
   ```

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>Use <code>expire_time</code> to track when to renew the access token. As a rule of thumb, trigger renewal before <code>expire_time - 1 minute</code> to avoid expired-token errors.</p></div>
2. Extract the `access_token` from the response
3. Include the token as a Bearer token in subsequent requests

   ```bash
   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:

   ```json
   {
       "result": "OK",
       "user": {
           "id": 0,
           "username": "string",
           "auth_method": "string",
           "enabled": false,
           "extra": {
               "country": "string",
               "language": "string"
           }
       }
   }
   ```

{% hint style="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.
{% endhint %}

## Resources

* [Partner API documentation](https://apidocs.pango-cloud.com/partner2.html)


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pango.gitbook.io/paas/api/partner-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
