API Tokens

POST /users/me/token #

Create token for me

Creates a token for the authenticated user. Store the returned token securely: it is the credential sent in the Authorization header for subsequent API calls.

Parameters

Name In Type Description
X-Mantis-Username header string Username to impersonate for this request. Requires an authorized API token.

Request body

name string

Responses

  • 201 Resource created successfully X-Mantis-Username X-Mantis-LoginMethod X-Mantis-Version
    "string"
  • 400 Bad Request
  • 401 Authentication is required or the supplied API token is invalid. WWW-Authenticate
  • 403 The authenticated user is not authorized for this operation, impersonation, or API access level.
  • 404 Entity not found
  • 503 MantisHub is temporarily unavailable and cannot process API requests.
cURL
curl -X POST \
  -H "Authorization: Bearer $MANTIS_TOKEN" \
  -H "Content-Type: application/json" \
  https://yourmantishubname.mantishub.io/api/rest/users/me/token \
  -d '{
    "name": "string"
}'
Request body · application/json
{
    "name": "string"
}
POST /users/{user_id}/token #

Create token for user

Creates a token for another user. This requires permission to impersonate that user and cannot target a user with a higher access level than the caller.

Parameters

Name In Type Description
user_id required path integer The user ID e.g. 5
X-Mantis-Username header string Username to impersonate for this request. Requires an authorized API token.

Request body

name string

Responses

  • 201 Resource created successfully X-Mantis-Username X-Mantis-LoginMethod X-Mantis-Version
    "string"
  • 400 Bad Request
  • 401 Authentication is required or the supplied API token is invalid. WWW-Authenticate
  • 403 The authenticated user is not authorized for this operation, impersonation, or API access level.
  • 404 Entity not found
  • 503 MantisHub is temporarily unavailable and cannot process API requests.
cURL
curl -X POST \
  -H "Authorization: Bearer $MANTIS_TOKEN" \
  -H "Content-Type: application/json" \
  https://yourmantishubname.mantishub.io/api/rest/users/5/token \
  -d '{
    "name": "string"
}'
Request body · application/json
{
    "name": "string"
}
DELETE /users/me/token/{token_id} #

Delete token for me

Parameters

Name In Type Description
token_id required path integer
X-Mantis-Username header string Username to impersonate for this request. Requires an authorized API token.

Responses

  • 204 Operation completed successfully with no response body X-Mantis-Username X-Mantis-LoginMethod X-Mantis-Version
  • 400 Bad Request
  • 401 Authentication is required or the supplied API token is invalid. WWW-Authenticate
  • 403 The authenticated user is not authorized for this operation, impersonation, or API access level.
  • 404 Entity not found
  • 503 MantisHub is temporarily unavailable and cannot process API requests.
cURL
curl -X DELETE \
  -H "Authorization: Bearer $MANTIS_TOKEN" \
  https://yourmantishubname.mantishub.io/api/rest/users/me/token/1
DELETE /users/{user_id}/token/{token_id} #

Delete token for user

Parameters

Name In Type Description
user_id required path integer The user ID e.g. 5
token_id required path integer
X-Mantis-Username header string Username to impersonate for this request. Requires an authorized API token.

Responses

  • 204 Operation completed successfully with no response body X-Mantis-Username X-Mantis-LoginMethod X-Mantis-Version
  • 400 Bad Request
  • 401 Authentication is required or the supplied API token is invalid. WWW-Authenticate
  • 403 The authenticated user is not authorized for this operation, impersonation, or API access level.
  • 404 Entity not found
  • 503 MantisHub is temporarily unavailable and cannot process API requests.
cURL
curl -X DELETE \
  -H "Authorization: Bearer $MANTIS_TOKEN" \
  https://yourmantishubname.mantishub.io/api/rest/users/5/token/1