users

Generate an API key for a user

Generates an API key for a user. Only the calling user can generate a token for themselves. Password is required only for internal authentication. Access policy: restricted

post/users/{id}/tokens

Request

  • Base URL
    /api (relative, and the document was published on a file host, not at the API’s origin)
  • URL
    /api/users/{id}/tokens
  • Auth
    API key in header Authorization

Path parameters

idinteger required

User identifier

Request body

descriptionstring required
passwordstring required

Example request

{
  "description": "github-api-key",
  "password": "password"
}

Response

Success

rawAPIKeystring

Example response

{
  "apiKey": {
    "description": "portainer-api-key",
    "id": 1,
    "userId": 1
  }
}

Changes

No recorded changes to this operation across all 21 revisions of this API.