Create a Tugboat API Key

Arguments

  • name - Optional
    A human-readable name to associate with the key.
  • admin (boolean) - Optional
    Whether the key should be a Tugboat Super Admin. Only a Tugboat Admin can set this property. Default: false.

  • parent - Optional
    If specified, the key created will be a child of this parent key. Only Tugboat Admins can specify a key other than itself. When a non-admin creates a new key this argument is automatically populated with the authorizing key's ID.

Example

socket.emit('tugboat', 'keys', 'create', args, callback);

Output

When an API key is successfully created, an object containing that key's details is returned. This is the only time that the string value of the API Key can be obtained. Tugboat discards this data, and only stores a hash.

single

{
    "updatedAt": "2017-02-07T22:05:48.284Z",
    "createdAt": "2017-02-07T22:05:48.284Z",
    "name": "NewKey2",
    "_id": "589a44bc236154000137a369",
    "admin": false,
    "id": "589a44bc236154000137a369",
    "key": "8skcecdfnld929cyd06ndss9tn8r4ye9"
}

array

[
    {
        "updatedAt": "2017-02-07T22:05:48.284Z",
        "createdAt": "2017-02-07T22:05:48.284Z",
        "name": "NewKey2",
        "_id": "589a44bc236154000137a369",
        "admin": false,
        "id": "589a44bc236154000137a369",
        "key": "8skcecdfnld929cyd06ndss9tn8r4ye9"
    }
]

Errors

  • 1001: No Keys Found
    Returned if the requested keys could not be created.

results matching ""

    No results matching ""