Skip to content

Dev API Keys

Dev API keys are project-scoped credentials used by the SkyState SDK during local development. They allow the SDK to write configuration to the development environment without requiring the user to complete an interactive GitHub OAuth login.

Key properties:

  • Scoped to a single project
  • Can only write to the development environment (enforced server-side)
  • The plaintext key is only returned once at creation time; the server stores only a SHA-256 hash
  • Keys can be revoked without deleting them (soft-revocation via revokedAt timestamp)

Object: DevApiKey (list view)

json
{
  "devApiKeyId": "550e8400-e29b-41d4-a716-446655440000",
  "projectId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "name": "laptop-dev",
  "keyPrefix": "sk_dev_abc1",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "lastUsedAt": "2025-01-20T08:00:00.000Z",
  "revokedAt": null
}
FieldTypeDescription
devApiKeyIdUUIDUnique key ID
projectIdUUIDProject this key is scoped to
namestringHuman-readable label for the key
keyPrefixstringFirst few characters of the plaintext key (for identification)
createdAtISO 8601 datetimeWhen the key was created
lastUsedAtISO 8601 datetime or nullLast time the key was used to authenticate
revokedAtISO 8601 datetime or nullWhen the key was revoked; null means still active

Create Dev API Key

Generates a new dev API key for the specified project. The full plaintext key is returned in the response body and is shown only once.

POST /api/admin/projects/{projectId}/dev-keys

Auth: Authorization: Bearer <token>

Path parameters:

ParameterTypeDescription
projectIdUUIDProject to create the key for

Request body:

json
{
  "name": "laptop-dev"
}
FieldTypeRequiredDescription
namestringYesA label to identify this key (e.g. the machine name)

Response: 200 OK

json
{
  "devApiKeyId": "550e8400-e29b-41d4-a716-446655440000",
  "projectId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "name": "laptop-dev",
  "keyPrefix": "sk_dev_abc1",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "key": "sk_dev_abc123xyz..."
}
FieldTypeDescription
devApiKeyIdUUIDUnique key ID
projectIdUUIDProject the key is scoped to
namestringKey label
keyPrefixstringFirst few characters of the key (for identification in list views)
createdAtISO 8601 datetimeCreation timestamp
keystringThe full plaintext key — store this securely, it is not retrievable again

Responses:

StatusDescription
200Key created — plaintext key in response body
404Project not found
500Unexpected error

Important: Copy and store the key value immediately. The server discards the plaintext key after responding; subsequent list calls return only the keyPrefix for identification.

Example:

bash
curl -X POST https://app.skystate.io/api/admin/projects/7c9e6679-7425-40de-944b-e07fc1f90ae7/dev-keys \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"name":"laptop-dev"}'

List Dev API Keys

Returns all dev API keys for a project, including revoked keys.

GET /api/admin/projects/{projectId}/dev-keys

Auth: Authorization: Bearer <token>

Path parameters:

ParameterTypeDescription
projectIdUUIDProject ID

Response: 200 OK — array of DevApiKeyListItem objects.

json
[
  {
    "devApiKeyId": "550e8400-e29b-41d4-a716-446655440000",
    "projectId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
    "name": "laptop-dev",
    "keyPrefix": "sk_dev_abc1",
    "createdAt": "2025-01-15T10:30:00.000Z",
    "lastUsedAt": "2025-01-20T08:00:00.000Z",
    "revokedAt": null
  }
]

Responses:

StatusDescription
200Returns array of key list items
404Project not found

Example:

bash
curl https://app.skystate.io/api/admin/projects/7c9e6679-7425-40de-944b-e07fc1f90ae7/dev-keys \
  -H "Authorization: Bearer <token>"

Revoke Dev API Key

Marks a dev API key as revoked. The key immediately stops authenticating. Revocation is permanent — revoked keys cannot be re-activated.

DELETE /api/admin/dev-keys/{devApiKeyId}

Auth: Authorization: Bearer <token>

Path parameters:

ParameterTypeDescription
devApiKeyIdUUIDThe key ID to revoke

Responses:

StatusDescription
204Revoked
404Key not found

Example:

bash
curl -X DELETE https://app.skystate.io/api/admin/dev-keys/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer <token>"

Using a Dev API Key

Pass the key in the Authorization header with the DevKey prefix:

Authorization: DevKey sk_dev_abc123...

Dev keys are only valid on the PATCH /api/dev/{accountSlug}/{projectSlug}/config/development endpoint. Attempting to use a dev key on admin endpoints, or targeting any environment other than development, returns 403 Forbidden.

See Config — Dev Config Endpoint for the full endpoint documentation.

Built with VitePress