Skip to Content
kosemdocs
ReferenceAPIService accounts

Create service account key in project

Creates a key. Its secret is in the response and cannot be read again.

POST
/v1/projects/{project}/serviceAccounts/{serviceAccount}/keys

Creates a key. Its secret is in the response and cannot be read again.

Authorization

bearer
headerAuthorizationBearer <token>

An access token, or an API key.

Path Parameters

project*string

The project's ID.

Match^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$
serviceAccount*string

The service account's ID.

Match^sa_[0-7][0-9a-hjkmnp-tv-z]{25}$

Request Body

application/json
  1. body
expireTime?string

When the key stops working. Not with ttlSeconds.

Formatdate-time
ttlSeconds?integer

How many seconds after it is created the key stops working. Not with expireTime.

Formatint64
Range0 <= value

Response Body

Created

application/json
  1. response
createTime*string

When the key was created.

Formatdate-time
expireTime*string

When the key stops working.

Formatdate-time
lastUseTime?string

When the key was last used, if it was.

Formatdate-time
name*string

Resource name, the service account's name followed by /keys/{key_id}.

secret?string

The secret, which is the API key, sent as a bearer token. Only in the response that creates the key: it cannot be read again. Audit log entries never keep it.

Example Request
curl -X POST 'https://api.kosem.ai/v1/projects/string/serviceAccounts/string/keys' \
  -H 'Content-Type: application/json' \
  -d '{}'
Example Response
{
  "createTime": "2019-08-24T14:15:22Z",
  "expireTime": "2019-08-24T14:15:22Z",
  "lastUseTime": "2019-08-24T14:15:22Z",
  "name": "string",
  "secret": "string"
}