Create an API Key

Create a new API key.

Requires the api-keys-manage permission.

arguments
  • name
    string

    The name of the API key to be generated.

  • capabilities
    array of strings

    An array describing the capabilities associated with this API key.

  • ips
    array of strings | null

    An array of IP's that are approved to use this API key to make requests.

Returns

Returns a Api Key resource (the one you just created), otherwise returns an Error.

POST /v1/hubs/current/api-keys

Example Request
$ curl https://api.cycle.io/v1/hubs/current/api-keys \
-H
'Authorization: Bearer API_KEY'
\
-H
'X-Hub-Id: HUB_ID'
\
-H 'Content-Type: application/json' \
-d '{"name":"api key name","capabilities":["dns-view","environment-view","image-view"],"ips":["234.2.3.4","3.2.3.4"]}' \
-X POST
Example Response
{
"data": {
"id": "5cb964ed4fde4d0001d05cc7",
"name": "MainHubKey",
"creator": {
"type": "account",
"id": "5cb964ed4fde4d0001d05cc7"
},
"hub_id": "5cb964ed4fde4d0001d05cc7",
"secret":
" SECRET"
,
"permissions": {
"all_environments": false,
"environments": [
{
"id": "5b9c2a77b6393d0001eb45fd",
"manage": false
}
]
},
"capabilities": {
"all": false,
"specific": [
"dns-view",
"containers-volumes-view",
"environments-view",
"images-view",
"servers-view",
"stacks-view"
]
},
"ips": [
"185.32.2.3",
"24.24.1.2",
"8.2.1.4",
"3.2.12.42"
],
"state": {
"current": "live",
"changed": "2018-09-14T21:39:03.096Z"
},
"events": {
"created": "2018-09-14T21:39:03.096Z",
"updated": "2018-09-17T16:50:54.107Z",
"deleted": "0001-01-01T00:00:00Z"
}
}
}