Swagger

Authentication

Session JWTs administer projects and keys; project API keys authenticate application traffic.

The two credentials

02

X-API-Key

Send the project key on data-plane calls and rotate it without changing your integration flow.

Manage project keys →

Worked example

Both credentials, end to end

Sign in once to get a session JWT, mint a project key with it, then use that key for every data-plane call.

  1. 01

    Sign in for a session JWT

    POST /auth/login

    The token this returns authenticates the control plane — projects, members and keys. It belongs on a server, never in browser code.

    Input — the request

    curl -X POST "https://api.ugtp.io/v1/auth/login" \
      -H "Content-Type: application/json" \
      -d '{
      "email": "user@example.com",
      "password": "********"
    }'

    Output — 200 response

    {
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "email": "user@example.com",
      "systemRole": "client_admin"
    }

    Every status this call can answer with
    StatusWhen
    200Session token
    400Invalid request body or query parameters
    401Missing or invalid credentials
    429Rate limit exceeded — retry after the number of seconds in the `Retry-After` response header
    500Internal server error
  2. 02

    Mint a project API key

    POST /api-key/create

    Send the JWT as a Bearer token. The raw key comes back once here and stays retrievable by an owner or admin afterwards; a project holds at most one active key.

    Input — the request

    curl -X POST "https://api.ugtp.io/v1/api-key/create" \
      -H "Authorization: Bearer $UGTP_SESSION_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "projectId": "ugtp_project_a1b2c3d4e5f6",
      "name": "Server key",
      "scopes": [
        "full_access"
      ]
    }'

    Output — 201 response

    {
      "id": "ugtp_project_api_key_a1b2c3d4e5f6",
      "apiKey": "ugtp2_0123456789abcdef0123456789abcdef",
      "keyPrefix": "ugtp2_0123"
    }

    Every status this call can answer with
    StatusWhen
    201Created key
    400Invalid request body or query parameters
    401Missing or invalid credentials
    403Authenticated but not permitted
    404Resource not found
    409Request conflicts with the current state of the resource
    500Internal server error
  3. 03

    Call the data plane with the key

    GET /network/list

    Every operation endpoint takes the project key in the X-API-Key header instead of the JWT. This read is the cheapest way to prove a key works.

    Input — the request

    curl -X GET "https://api.ugtp.io/v1/network/list" \
      -H "X-API-Key: $UGTP_API_KEY"

    Output — 200 response

    {
      "networks": [
        {
          "name": "Avalanche C-Chain",
          "networkId": "43114",
          "explorerUrl": "https://snowtrace.io",
          "nativeCoin": "AVAX",
          "wrappedNative": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"
        }
      ]
    }

    Every status this call can answer with
    StatusWhen
    200Networks
    401Missing or invalid credentials
    429Rate limit exceeded — retry after the number of seconds in the `Retry-After` response header
    500Internal server error