> ## Documentation Index
> Fetch the complete documentation index at: https://docs.glider.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Enroll Signable Message (Stage 1)

> Stage 1 of the two-stage enrollment flow — returns a signable session-key message for the user to sign in their wallet.

Stage 1 of the two-stage enrollment flow. Validates that the `strategyId`
belongs to your tenant, peeks the user's next available account index, and
returns the signable message the user must sign plus the round-trip values
(`flowId`, `accountIndex`, `agentAccountId`) that stage 2
(`POST /v2/enroll`) will need.

Wallet addresses are exchanged as [CAIP-10](https://chainagnostic.org/CAIPs/caip-10)
account identifiers. `ownerAccountId` and `agentAccountId` use the
chain-agnostic EVM form `eip155:0:<address>` — a single wallet works on every
EIP-155 chain. Only EVM wallets are supported today.

* Auth: `x-api-key` header (required)
* Scope: `enroll:write`

The returned `flowId` is the idempotency anchor for the matching
`POST /v2/enroll` call — it is valid for 24 hours. Re-submitting the same
`flowId` on stage 2 replays the cached response.

The `accountIndex` is **peeked, not reserved**: repeated stage-1 calls for
the same user return the same candidate index, and the index only advances
when stage 2 commits successfully. Retries, abandoned flows, and tests do
not burn account indices.

Unknown chains in `chainIds` are rejected with `400` before any enrollment
state is created — the allowed list is in the error `details`.

Common error responses:

* `400` when the request body is invalid, the `strategyId` doesn't exist or
  your API key cannot access it, or `chainIds` contains an unsupported chain
* `401` when `x-api-key` header is missing or the key is invalid
* `403` when the API key lacks the `enroll:write` scope
* `500` on unexpected server errors

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.glider.fi/v2/enroll/signature' \
    --header 'x-api-key: gldr_sk_your_api_key' \
    --header 'Content-Type: application/json' \
    --data '{
      "ownerAccountId": "eip155:0:0xabcdef0000000000000000000000000000000001",
      "strategyId": "01JWZEE2MF30KVRMRX53N88VA4",
      "chainIds": [1, 8453]
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.glider.fi/v2/enroll/signature", {
    method: "POST",
    headers: {
      "x-api-key": "gldr_sk_your_api_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      ownerAccountId: "eip155:0:0xabcdef0000000000000000000000000000000001",
      strategyId: "01JWZEE2MF30KVRMRX53N88VA4",
      chainIds: [1, 8453],
    }),
  });
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "data": {
      "message": {
        "kind": "ecdsa",
        "raw": "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"
      },
      "agentAccountId": "eip155:0:0x1111111111111111111111111111111111111111",
      "accountIndex": "7",
      "flowId": "flow_abc123"
    }
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": {
      "code": "API_400",
      "message": "Request validation failed",
      "details": [
        "chainIds: Unsupported chainId: [999]. Supported: [1, 137, 8453]"
      ]
    }
  }
  ```

  ```json 401 theme={null}
  {
    "success": false,
    "error": {
      "code": "API_101",
      "message": "Missing API key"
    }
  }
  ```

  ```json 403 theme={null}
  {
    "success": false,
    "error": {
      "code": "API_104",
      "message": "API key is missing required scope: enroll:write"
    }
  }
  ```
</ResponseExample>
