API Token
You can create multiple tokens per account, making it easy to restrict the consumption per token and distribute your purchased conversions between multiple environments or customers.
Note
You can authenticate conversion request using API tokens. However, the
/user
information endpoint that provides information about your consumption an only be authenticated using theAPI Secret
.
Token Management
Tokens offer advanced control with features like staging and production environments. They can be managed via the Access Tokens Control Panel or REST API. Note that token management (creation and deletion) can only be performed using secret authentication.
Create an API Token
Create a token with specific attributes:
RequestCount
: Maximum requests per token (default 1, max 999999999).Lifetime
: Token lifetime in seconds (default 3600, max 315569520).Count
: Number of tokens to create (default 1).
curl -X POST "https://v2.convertapi.com/token/create" \
-H "Authorization: Bearer secret_here" \
-F "RequestCount=3" \
-F "Lifetime=10000" \
-F "Count=2"
Response:
{
"Tokens": [
{ "Id": "4X4RxBGP", "ValidUntil": "2017-08-22T16:45:24.6184076Z" },
{ "Id": "mKRuP5zW", "ValidUntil": "2017-08-22T16:45:24.6184076Z" }
]
}
Token Usage
Use the token for API requests:
curl -X POST https://v2.convertapi.com/convert/docx/to/pdf \
-H "Authorization: Bearer secret_here" \
-F "File=@/path/to/my_file.docx" \
-F "StoreFile=true"
Delete Token
Tokens can expire or be deleted immediately. Provide your secret key in the delete request for security:
curl -X DELETE "https://v2.convertapi.com/token/token_here" \
-H "Authorization: Bearer secret_here"
Updated 4 months ago