POST
/
keys
curl --request POST \
  --url https://api.datkey.dev/keys \
  --header 'Content-Type: application/json' \
  --data '{
  "api_id": "{api_id}",
  "name": "{api_name}",
  "prefix": "prefix",
  "length": 16,
  "meta": {
    "user_id": "123456"
  },
  "expires_at": 123,
  "verification_limit": 123
}'
{
  "key": {
    "id": "<key_id>",
    "name": "<key_name>",
    "key": "flox_sk_05ad2bfxxxxxxxx",
    "prefix": "flox_sk",
    "length": 16,
    "verifications": 0,
    "verification_limit": null,
    "expires_at": 1733237153,
    "meta": null,
    "created_at": "2023-12-05T11:31:23.000000Z",
    "updated_at": "2023-12-05T11:31:23.000000Z"
  }
}

The key returned would be show unencrypted the first time you generate it, ensure you show it to your user because it won’t be show to you again.

Headers

x-api-key
string

your workspace API key

Body

application/json

Response

200
application/json

OK

The response is of type object.