API7 Docs
API7 GatewayAPI7 Enterprise Admin APIsCreate a portal token

Create a portal token

POST /api/portal/tokens

POST /api/portal/tokens

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

In: header

Query Parameters

portal_id?string

The unique identifier of the portal instance.

Match^[a-zA-Z0-9-_.]+$
Length1 <= length <= 256
Default"default"

Request Body

application/json

Create a portal token.

Response Body

application/json

application/json

curl -X POST "$API_BASE_URL/api/portal/tokens" \  -H "Content-Type: application/json" \  -d '{    "name": "my-portal-token"  }'

Portal token created successfully.

{
  "value": {
    "id": "bd58fce2-b6cc-4d2d-a53c-6ce11b19c101",
    "name": "my-portal-token",
    "portal_id": "bd58fce2-b6cc-4d2d-a53c-6ce11b19c101",
    "created_at": 1742288232,
    "updated_at": 1742288235,
    "expires_at": 1752288235,
    "last_used_at": 1742288235,
    "token": "a7prt-example-portal-token"
  }
}
Complete operation details and schema variants

POST /api/portal/tokens

Create a portal token

IAM Action: portal:CreatePortalToken, Resource: arn:api7:portal:portal/%s/token/*

Parameters

  • portal_id (query, string, optional): The unique identifier of the portal instance.

Request body

Content type: application/json

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

Responses

  • 200: Portal token created successfully.
  • allOf variant 1
  • value (object, optional): The specific resource.
  • allOf variant 2
  • value (object, optional):
  • allOf variant 1
  • value.id (string, optional): The portal token ID.
  • value.name (string, optional): The portal token name.
  • value.portal_id (string, optional): The portal ID that this token belongs to.
  • value.created_at (integer, optional): The time when a portal token is created.
  • value.updated_at (integer, optional): The time when a portal token is updated.
  • value.expires_at (integer, optional): The expiration timestamp of the portal token. 0 means the token will not expire.
  • value.last_used_at (integer, optional): The last time when the portal token is used.
  • allOf variant 2
  • value.token (string, optional): The created portal token value.
  • 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/portal/tokens'