Create Api-Key

post/v1/api-key

Mints a new API key for a workspace. The plaintext key value is returned exactly once in this response and is never retrievable again, so capture it immediately. Side effects: a new active key row is persisted; subsequent list calls only show a masked form of the value.

Requires a bearer token: Authorization: Bearer <token>.

Request

cURL
curl -X POST https://api.wellapp.ai/v1/api-key \
  -H "Authorization: Bearer $WELL_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "type": "api-key",
    "attributes": {
      "name": "Foldspace production sync",
      "workspace": {
        "id": "a1b2c3d4-e5f6-4708-89ab-0cdef1234567"
      },
      "expiration_at": "2027-06-07T00:00:00.000Z"
    }
  }
}'
Request body
{
  "data": {
    "type": "api-key",
    "attributes": {
      "name": "Foldspace production sync",
      "workspace": {
        "id": "a1b2c3d4-e5f6-4708-89ab-0cdef1234567"
      },
      "expiration_at": "2027-06-07T00:00:00.000Z"
    }
  }
}

Responses

201API key created. The full value is present here and only here.

{
  "data": {
    "type": "api_key",
    "id": "d5e6f708-1a2b-4c3d-9e0f-1a2b3c4d5e6f",
    "attributes": {
      "name": "Foldspace production sync",
      "is_active": true,
      "value": "well_sk_live_8Kq2Rm4Tn7Wp9Xz1Yb3Vc5Df6Gh0Jk",
      "created_at": "2026-06-07T14:25:30.000Z",
      "last_used_at": null,
      "expiration_at": "2027-06-07T00:00:00.000Z"
    },
    "relationships": {
      "people": {
        "data": {
          "type": "ManyToOne",
          "id": "00000000-0000-4000-8000-000000000001"
        }
      }
    }
  }
}

400Missing name, invalid workspace id, or malformed expiry.

{
  "code": "BAD_REQUEST",
  "status": 400,
  "title": "Bad Request",
  "message": "See title.",
  "meta": {
    "trace_id": "a1b2c3",
    "log_id": "a1b2c3"
  }
}

401Missing or invalid bearer token.

{
  "code": "UNAUTHORIZED",
  "status": 401,
  "title": "Unauthorized",
  "message": "See title.",
  "meta": {
    "trace_id": "a1b2c3",
    "log_id": "a1b2c3"
  }
}