API7 Docs
API7 GatewayAPI7 Enterprise Admin APIsCreate a token

Create a token

POST /api/tokens

POST /api/tokens

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

In: header

Request Body

application/json

Create a token.

Response Body

application/json

application/json

curl -X POST "$API_BASE_URL/api/tokens" \  -H "Content-Type: application/json" \  -d '{    "name": "test-token",    "expires_at": 1752288235  }'

Access token created successfully. The token value is only returned once at creation time.

{
  "value": {
    "id": "bd58fce2-b6cc-4d2d-a53c-6ce11b19c101",
    "name": "test-token",
    "created_at": 1742288232,
    "updated_at": 1742288235,
    "expires_at": 1752288235,
    "user_id": "b32e678e-7f6b-4a50-b113-550621ed4c01",
    "org_id": "bc1b95c9-b348-4832-acc3-e257d2342df1",
    "token": "a7ee-example-token"
  }
}
Complete operation details and schema variants

POST /api/tokens

Create a token

Create a new API access token for programmatic, non-interactive access to dashboard APIs. You can configure token metadata and optional expiration at creation time.

Parameters

Request body

Content type: application/json

  • name (string, required): The token name.
  • expires_at (integer, required): The expiration timestamp of the token. 0 means the token will not expire.

Responses

  • 200: Access token created successfully. The token value is only returned once at creation time.
  • allOf variant 1
  • value (object, optional): The specific resource.
  • allOf variant 2
  • value (object, optional):
  • allOf variant 1
  • value.id (string, optional): The token ID.
  • value.name (string, optional): The token name.
  • value.created_at (integer, optional): The time when a token is created.
  • value.updated_at (integer, optional): The time when a token is updated.
  • value.expires_at (integer, optional): The expiration timestamp of the token. 0 means the token will not expire.
  • value.user_id (string, optional): The user ID.
  • value.org_id (string, optional): The organization ID.
  • allOf variant 2
  • value.token (string, optional): The created token.
  • 400: Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.
  • value (object, optional): The specific resource.
  • error_msg (string, optional): The error message.

cURL

curl -X POST '$API_BASE_URL/api/tokens'