ReferenceAPI

Grant access

Grant a login access to the workspace, or create a private-key principal and issue its key.

POST https://api.nevia.cloud/v1/workspaces/{ws}/access
curl -X POST "https://api.nevia.cloud/v1/workspaces/01d4cnjjq40hnnh0nwmkg35nv2h/access" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: 8f1c2a7e-3b4d-4c5e-9f0a-1b2c3d4e5f60" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "role": "editor"
  }'
{
  "access": {
    "principal": {
      "id": "01d4cnjmn4fbb1r5btxb5mypv62",
      "auth": "email",
      "email": "string",
      "name": "string"
    },
    "role": "editor",
    "scope": "workspace",
    "description": "string",
    "key": {
      "id": "01d4cnjq8r0tvwxyb3c4d5f6g7h",
      "principal": "01d4cnjmn4fbb1r5btxb5mypv62",
      "byok": true,
      "created_by": "01d4cnjmn4fbb1r5btxb5mypv62",
      "expires_at": "2026-09-10T12:34:56Z",
      "last_used_at": "2026-09-10T12:34:56Z",
      "created_at": "2026-09-10T12:34:56Z",
      "revoked_at": "2026-09-10T12:34:56Z"
    },
    "key_state": "active",
    "created_at": "2026-09-10T12:34:56Z"
  },
  "key": {
    "id": "01d4cnjq8r0tvwxyb3c4d5f6g7h",
    "principal": "01d4cnjmn4fbb1r5btxb5mypv62",
    "byok": true,
    "created_by": "01d4cnjmn4fbb1r5btxb5mypv62",
    "expires_at": "2026-09-10T12:34:56Z",
    "last_used_at": "2026-09-10T12:34:56Z",
    "created_at": "2026-09-10T12:34:56Z",
    "revoked_at": "2026-09-10T12:34:56Z"
  },
  "key_file": {
    "principal": "01d4cnjmn4fbb1r5btxb5mypv62",
    "subject": "393890846249869905",
    "key_id": "393890846384085404",
    "audience": "https://auth.example.com",
    "token_url": "https://api.example.com/v1/auth/token",
    "private_key": "string"
  },
  "operations": [
    "01d4cnjm89yk0r3xtv80dy0x7by"
  ]
}

Authorization

bearerAuth
Authorization Bearer <token>

Send the token in the Authorization: Bearer <token> header. See Authenticate.

In: header

Path Parameters

ws* string

Workspace id: 27 lowercase letters and digits.

Match ^[A-Za-z0-9_-]{1,64}$

Header Parameters

Idempotency-Key* string

Required for this non-idempotent request. Clients generate one key per action and preserve it across transport retries. Within the retained window, repeats return the recorded result and different input with the same key is 409. Keys expire 10 minutes after admission, or 120 seconds after success or terminal failure, whichever is earlier. Reusing an expired key can execute new work. The API tracks at most 100,000 requests across replicas. New keys at capacity receive 429 with Retry-After of 600–630 seconds.

Length 1 <= length <= 255

Request Body

application/json

Login or private-key principal to grant access to

Login by email

Behavior

Access takes effect at once. The key and key file are returned once, and an idempotent replay answers key_file: null.

With projects, the principal gets a grant on each project at role and no workspace role. A known login gets the grants at once, an unknown email gets an invitation that grants them on first sign-in, and a new private-key principal holds only those grants. A second scoped invite at the same role adds its projects, and one at another role replaces the scope.

Response

application/json

The access or project grants added, with a new private-key principal's key and key file.

Created access, with its key and key file