Create an API key
Only a signed-in member can create a key: an API key gets 403 here whatever it holds (keys never create keys), so the apiKey:create below must come from the member's role. The new key holds the requested permissions that role can grant (admins and owners may also grant the API-key-only ingest:write and revenue:write; 400 when none can be granted), on the sites in siteIds (400 for an id that is not a live site of the organization), or on every site of the organization when it is absent. expiresInDays (1 to 3650) sets an expiry; none by default. This answer is the only one that carries key. 409 once the organization has its maximum of active keys (API_KEY_MAX_PER_ORG, 50 by default).
Requires apiKey:create in the organization (an API key, or a signed-in member's role; a member restricted to some sites holds a viewer's permissions here). API keys limited to some sites: 403. Share links: 401.
x-api-key<token>An organization API key (ak_…), with the permissions and the sites it was created with. For servers and scripts: no cookie and no Origin check. Also accepted as Authorization: Bearer ak_… (apiKeyBearer). A request carries one credential: a key sent with a share token or a live session cookie is 400 (details.reason: ambiguous_credentials).
Scope: apiKey:create
orgId*stringapplication/json- body
name*string1 <= length <= 64permissions*siteIds?array<string>1 <= items <= 500expiresInDays?integer1 <= value <= 3650Created
application/json- response
data*curl -X POST 'https://pilotfox.app/api/v1/orgs/string/api-keys' \ -H 'Content-Type: application/json' \ -d '{ "name": "string", "permissions": { "property1": [ "string" ], "property2": [ "string" ] }}'{ "data": { "id": "string", "key": "string", "start": "string", "permissions": { "property1": [ "string" ], "property2": [ "string" ] }, "siteIds": [ "string" ], "expiresAt": "2019-08-24T14:15:22Z" }}