---
updatedAt: 2026-10-06T05:54:58.000Z
agentTools:
  projectIndex: https://partner-docs.gupshup.io/llms.txt
---

# Mint Universal Token

Issues a new Universal Token for a partner admin

# Description

1. When expiry is omitted, the token expires 60 days from mint time.
2. When expiry is supplied it is an absolute epoch-millisecond timestamp, and the lifetime must be at least 60 seconds and at most 60 days from now.
3. The raw JWT is returned only once, in this response.
4. admin email + admin clientSecret are the credential; no prior Bearer login is required.
5. The caller must be a partner admin, and the partner must have UT minting enabled by Gupshup.
6. Max 3 active (non-revoked, non-expired) UTs per admin user by default.
7. Name uniqueness is among active tokens only - after revoke or natural expiry the name can be reused.
8. A security email is sent on successful mint.
9. Existing UT will keep on working even if your client secret gets expired and UT has not expired.

<br />

# Rate limit

3 requests / 60 seconds.

<br />

# API Request&#x20;

## Mint Universal Token — Default Expiry

```curl
curl --location --request POST 'https://partner.gupshup.io/partner/{{PARTNER_ID}}/auth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'email={{PARTNER_ADMIN_EMAIL}}' \
--data-urlencode 'clientSecret={{CLIENT_SECRET}}' \
--data-urlencode 'name=prod-automation'
```

<br />

## Mint Universal Token — Custom Expiry

```curl
curl --location --request POST 'https://partner.gupshup.io/partner/{{PARTNER_ID}}/auth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'email={{PARTNER_ADMIN_EMAIL}}' \
--data-urlencode 'clientSecret={{CLIENT_SECRET}}' \
--data-urlencode 'name=prod-automation-7d' \
--data-urlencode 'expiry=1783939200000'
```

# Response

| Status Code | Response                                                                                                                                        | Comments                                                                                               |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| 200         | `{ "status": "success", "token": "eyJhbGciOiJSUzI1NiJ9...", "id": "row-id-789" }`                                                               | Success. Raw JWT returned once. Default lifetime = 60 days when `expiry` is omitted.                   |
| 400         | `{ "status": "error", "message": "name is required and must be 1..128 characters" }`                                                            | `name` missing, blank, or longer than 128 characters.                                                  |
| 400         | `{ "status": "error", "message": "expiry must be in the future (at least 60 seconds from now)" }`                                               | Custom expiry is in the past or less than 60 seconds ahead (custom-expiry calls only).                 |
| 400         | `{ "status": "error", "message": "expiry cannot exceed 60 days from now" }`                                                                     | Custom expiry is beyond the 60-day maximum (custom-expiry calls only).                                 |
| 401         | `{ "status": "error" }`                                                                                                                         | Wrong or expired client secret (same message when no client-access row exists — no email enumeration). |
| 403         | `{ "status": "error", "message": "User-token minting is not enabled for this partner; contact admin" }`                                         | Partner has `ut_enabled=false`.                                                                        |
| 409         | `{ "status": "error", "message": "Maximum of 3 active tokens reached for this user; revoke one and retry" }`                                    | Active UT cap reached (default 3 per admin; from `cas.user-token.max-active-per-user`).                |
| 409         | `{ "status": "error", "message": "A token with this name already exists; revoke or rename it first" }`                                          | Duplicate active name for this admin.                                                                  |
| 429         | `{ "status": "error", "message": "Too Many Requests" }`                                                                                         | More than 3 requests / 60 seconds.                                                                     |
| 500         | `{ "status": "error", "message": "Internal server error. Please try again later and If Issue still persist then contact Gupshup Dev Support" }` | Unexpected server failure.                                                                             |

<br />

# Request Parameters

| Key           | Description                | Values                    | Data Type | Required / Optional                       | Constraints                                                  |
| ------------- | -------------------------- | ------------------------- | --------- | ----------------------------------------- | ------------------------------------------------------------ |
| **Path**      |                            |                           |           |                                           |                                                              |
| partnerId     | Partner ID                 | e.g. 8814                 | Integer   | Required                                  | Must match the partner resolved from `email`.                |
| **Form body** |                            |                           |           |                                           |                                                              |
| email         | Partner admin email        | <admin@example.com>       | String    | Required                                  | Must resolve to a partner admin. Non-admins receive 401.     |
| clientSecret  | Client secret              | Get it from Security Page | String    | Required                                  | Must be current and not expired.                             |
| name          | Token label                | prod-automation           | String    | Required                                  | 1–128 chars. Unique among this admin's currently active UTs. |
| expiry        | Absolute expiry (epoch ms) | e.g. 1783939200000        | Long      | Omit for default. **Required for custom** | When omitted → now + 60 days.                                |

<br />

<br />

# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "Universal Token (UT) APIs",
    "description": "These APIs provide interfaces for partners to create and manage Universal Tokens (UT) that can be used for secure partner authentication and integration.\nA UT is a CAS-signed partner-scoped JWT (tt=UT). It authenticates as the partner across Partner Portal APIs, can live for up to 60 days,\nand is required as the Bearer token when minting Universal App Tokens (UAT).\nPrerequisite: Generate a client secret via POST /partner/auth/clients/generate (shown once). The secret is checked only at UT mint time.\n",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://partner.gupshup.io"
    }
  ],
  "tags": [
    {
      "name": "Universal Token",
      "description": "Mint, list, and revoke Universal Tokens"
    }
  ],
  "paths": {
    "/partner/{partnerId}/auth/token": {
      "post": {
        "tags": [
          "Universal Token"
        ],
        "summary": "Mint Universal Token",
        "description": "Issues a new Universal Token for a partner admin",
        "operationId": "mintUniversalToken",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerIdPath"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/MintTokenRequest"
              },
              "examples": {
                "defaultExpiry": {
                  "summary": "Default expiry (60 days)",
                  "value": {
                    "email": "admin@example.com",
                    "clientSecret": "cs_live_xxxxxxxxxxxxxxxx",
                    "name": "prod-automation"
                  }
                },
                "customExpiry": {
                  "summary": "Custom absolute expiry (epoch ms)",
                  "value": {
                    "email": "admin@example.com",
                    "clientSecret": "cs_live_xxxxxxxxxxxxxxxx",
                    "name": "prod-automation-7d",
                    "expiry": 1783939200000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response. Raw JWT returned once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MintTokenSuccessResponse"
                },
                "example": {
                  "status": "success",
                  "token": "eyJhbGciOiJSUzI1NiJ9...",
                  "id": "row-id-789"
                }
              }
            }
          },
          "400": {
            "description": "Validation or business error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "invalidName": {
                    "summary": "name missing, blank, or longer than 128 characters",
                    "value": {
                      "status": "error",
                      "message": "name is required and must be 1..128 characters"
                    }
                  },
                  "expiryTooSoon": {
                    "summary": "Custom expiry is in the past or less than 60 seconds ahead",
                    "value": {
                      "status": "error",
                      "message": "expiry must be in the future (at least 60 seconds from now)"
                    }
                  },
                  "expiryTooFar": {
                    "summary": "Custom expiry is beyond the 60-day maximum",
                    "value": {
                      "status": "error",
                      "message": "expiry cannot exceed 60 days from now"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Wrong or expired client secret.\nThe same body is returned when no client-access row exists, to avoid email enumeration.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "status": "error"
                }
              }
            }
          },
          "403": {
            "description": "Partner has ut_enabled=false",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "status": "error",
                  "message": "User-token minting is not enabled for this partner; contact admin"
                }
              }
            }
          },
          "409": {
            "description": "Active token cap reached or duplicate active token name",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "maxActiveTokens": {
                    "summary": "Active UT cap reached (default 3 per admin)",
                    "value": {
                      "status": "error",
                      "message": "Maximum of 3 active tokens reached for this user; revoke one and retry"
                    }
                  },
                  "duplicateName": {
                    "summary": "Duplicate active name for this admin",
                    "value": {
                      "status": "error",
                      "message": "A token with this name already exists; revoke or rename it first"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded - more than 3 requests / 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Too Many Requests"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Internal server error. Please try again later and If Issue still persist then contact Gupshup Dev Support"
                }
              }
            }
          }
        },
        "security": []
      }
    }
  },
  "components": {
    "parameters": {
      "PartnerIdPath": {
        "name": "partnerId",
        "in": "path",
        "description": "Partner ID. Must match the partner resolved from email (mint),\nor the authenticated partner context (list and revoke).\n",
        "required": true,
        "schema": {
          "type": "integer",
          "format": "int64",
          "example": 8814
        }
      }
    },
    "schemas": {
      "MintTokenRequest": {
        "type": "object",
        "required": [
          "email",
          "clientSecret",
          "name"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "description": "Partner admin email. Must resolve to a partner admin; non-admins receive 401.",
            "example": "admin@example.com"
          },
          "clientSecret": {
            "type": "string",
            "description": "Client secret from POST /partner/auth/clients/generate. Must be current and not expired.",
            "example": "cs_live_xxxxxxxxxxxxxxxx"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Token label. 1 to 128 chars. Unique among this admin's currently active UTs.",
            "example": "prod-automation"
          },
          "expiry": {
            "type": "integer",
            "format": "int64",
            "description": "Absolute expiry in epoch milliseconds (not a day count).\nWhen omitted, defaults to now + 60 days.\nWhen supplied, must satisfy now + 60s <= expiry <= now + 60 days.\n",
            "example": 1783939200000
          }
        }
      },
      "MintTokenSuccessResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "success"
          },
          "token": {
            "type": "string",
            "description": "The raw UT JWT. Returned only once, at mint time.",
            "example": "eyJhbGciOiJSUzI1NiJ9..."
          },
          "id": {
            "type": "string",
            "description": "Token row id, usable with the list and revoke APIs.",
            "example": "row-id-789"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "error"
          },
          "message": {
            "type": "string",
            "description": "Human-readable error detail. Omitted on the 401 returned by the mint API (no email enumeration).",
            "example": "Error description"
          }
        }
      }
    }
  }
}
```