Skip to content
Hexel StudioDocs

Quickstart

Create an organization, give a program its own identity, get an access token and make your first API call.

On this page

In this quickstart you create an organization in the console, create a service user with an API key, exchange the key for an access token, and list your organization's workspaces through the API.

You sign in to the console with your Hexel account. Hexel Studio doesn't issue personal access tokens for use outside the console, so scripts, servers and tools call the API as a service user: a non-human identity that belongs to your organization and has only the permissions you give it.

  1. Sign in and create an organization

    Open console.hexelstudio.com and sign in, or sign up for a Hexel account. See Your Hexel account for the sign-in methods.

    If you don't belong to an organization yet, the console asks you to create one. Hexel Studio creates the organization with a Default workspace that has a Production and a Development environment, and makes you its owner.

  2. Create a service user

    In the console, open IAM > Service Users and choose Create service user.

    1. Give it a name that says what it's for, for example quickstart.
    2. On the Policies step, select Workspace Read-Only Access (WorkspaceReadOnlyAccess). It allows one action, workspace:workspace:read, which is all this quickstart needs.
    3. Create the service user.

    A new service user can do nothing until a policy allows it. Attach only what it needs.

  3. Create an API key

    On the service user's page, open Security Credentials and choose Create API Key. Name the key and pick an expiry: every key expires, after 90 days unless you choose another date, and at most one year from today.

    Copy the key when it's shown. Hexel Studio shows it once and stores only a hash. Keep it in an environment variable:

    Bash
    export API_KEY="studio_live_..."
  4. Get an access token

    Exchange the key for an access token at the token service:

    Bash
    curl -X POST https://sts.hexelstudio.com/token \
      -H "X-API-Key: $API_KEY" \
      -d grant_type=api_key
    Response
    {
      "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6...",
      "refresh_token": "",
      "token_type": "Bearer",
      "expires_in": 900
    }

    The token is valid for 15 minutes (expires_in is in seconds) and belongs to the service user in your organization. There is no refresh token for a service user: when the token expires, exchange the key again.

    Bash
    export ACCESS_TOKEN="eyJhbGciOiJSUzI1NiIsImtpZCI6..."
  5. Make your first API call

    List the workspaces in your organization:

    curl https://api.hexelstudio.com/v1/workspaces \
      -H "Authorization: Bearer $ACCESS_TOKEN"

    The response is a JSON array of workspaces. A new organization has one:

    Response
    [
      {
        "id": "ws_3f9c1d2e8a7b4c6d9e0f1a2b3c4d5e6f",
        "organization_id": "org_7b2e4c1a9d8f4e3b8c6a5d4e3f2a1b0c",
        "name": "Default",
        "slug": "default",
        "is_default": true,
        "is_active": true,
        "created_by_user_id": "5d1e9a3c-7b2f-4e8d-9c6a-1f0e2d3c4b5a",
        "created_at": "2026-10-20T09:12:44.512Z",
        "updated_at": "2026-10-20T09:12:44.512Z"
      }
    ]

    You don't send an organization ID: it comes from the token. The organization_id field is your organization's ID, which some other calls need.

Call with the API key directly

You can also skip the token exchange and send the key on each request in the X-API-Key header:

Bash
curl https://api.hexelstudio.com/v1/workspaces \
  -H "X-API-Key: $API_KEY"

Hexel Studio exchanges the key for an access token on its side, so the request is decided exactly as if you had sent the token. This is convenient for scripts and occasional calls. For a workload that makes many calls, exchange the key once and reuse the token until it expires.

If something goes wrong

ResponseCause
401 with {"error":{"code":"401","message":"Invalid API key."}}The key is wrong, revoked or expired, or its service user is inactive.
401 from the token service with {"error":"invalid api key"}The same, when you exchange the key at /token.
403 with {"error":"forbidden"}The caller is authenticated but no policy allows the action. Check the service user's policies.
429You hit a rate limit. Wait the number of seconds in the Retry-After header. See Limits.

Next steps