You are viewing documentation for the development version, it may be incomplete.
Join our translation project and help translate Zabbix documentation into your native language.

token.generate

Description

object token.generate(array tokenids)

This method allows to generate tokens.

Only Super admin user type is allowed to manage tokens for other users.

A token can be generated by this method only if it has been created.

Parameters

(array) IDs of the tokens to generate.

Return values

(array) Returns an array of objects containing the ID of the generated token under the tokenid property and generated authorization string under token property.

Property Type Description
tokenid ID ID of the token.
token string The generated authorization string for this token.

Examples

Generate multiple tokens

Generate two tokens.

Request:

{
           "jsonrpc": "2.0",
           "method": "token.generate",
           "params": [
               "1",
               "2"
           ],
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "tokenid": "1",
                   "token": "bbcfce79a2d95037502f7e9a534906d3466c9a1484beb6ea0f4e7be28e8b8ce2"
               },
               {
                   "tokenid": "2",
                   "token": "fa1258a83d518eabd87698a96bd7f07e5a6ae8aeb8463cae33d50b91dd21bd6d"
               }
           ],
           "id": 1
       }

Source

CToken::generate() in ui/include/classes/api/services/CToken.php.