Skip to main content
The B2B API is the primary REST API for external integrators. You can define strategies, enroll users, monitor portfolios, and withdraw assets. Give the LLMs.txt file to your preferred AI model. You can then ask questions about the API.

Mental model

A strategy is a reusable template. It contains an allocation, a schedule, and swap preferences. A portfolio connects one user to a strategy. It has one smart account for each chain. All enrolled portfolios use the allocation and schedule of the strategy. A new strategy version changes their target for the next rebalance. There are two rebalance triggers:
  • Scheduled: Uses the strategy frequency. Read nextDueAt and lastRebalanceAt from the portfolio schedule.
  • Manual: POST /v2/portfolios/{id}/rebalance starts one rebalance outside the schedule. A short cooldown applies to each portfolio.

Asset coverage

Strategy allocations and portfolio positions accept each supported CAIP-19 asset. Supported assets include ERC-20 tokens, SPL tokens, and tokenized real-world assets. GET /v2/portfolios/{id}/positions uses one row format for all asset types.

Chain abstraction

The Glider wallet infrastructure routes cross-chain deposits. It also moves assets between supported chains when required. Your client does not need to plan these migrations.

Machine-readable specifications

Use these files for coding agents and SDK generators. These files are the source of truth for the API.

Base URL

Use https://staging-api.glider.fi/v2 for integration tests. Contact [email protected] for a staging API key.

Authentication

Each business route except GET /v2/scopes requires an API key. Send the key in the x-api-key header. The OpenAPI file, interactive reference, and LLM-friendly reference are public. HTTP header names are not case-sensitive. The B2B API documentation uses lowercase for x-api-key.
GET /v2/whoami returns the tenant identity and the assigned scopes. Call this route first to test the key.

Response envelope

The B2B API uses one response envelope. Tracing identifiers are in the response headers, not in the JSON body.

Success

Paginated success

nextCursor is next to data. It is not inside data. Each collection in data has a named key, such as data.portfolios.

Error

The details field is optional. The API omits it when message contains all applicable information.

Tracing headers

Each response includes these headers: The B2B API does not put correlationId, requestId, or timestamp in the body. Read these values from the headers.

Scopes

Each authenticated route requires one scope. If the key does not have this scope, the API returns 403 API_104. Tiers:
  • default: Assigned to each new key.
  • standard: Assigned to an integrator on request. Contact [email protected] to upgrade.
  • restricted: Requires a commercial agreement.
Call GET /v2/scopes to read the current scope list. This route does not require authentication. Call GET /v2/whoami to read the scopes for your key.

Identifiers (CAIP)

All onchain identifiers use CAIP. Thus, the same request format works for each supported chain. Do not send bare hex addresses. Withdrawal recipients must be chain-bound. The recipient chain must match each asset chain. One withdrawal can use only one chain. The recipient can be any address that the owner authorizes. This rule applies to EVM and Solana. The API rejects a transfer to the source smart account. See CAIP identifiers for a worked walk-through.

Supported Chains

Each deployment has a configured set of enrollment chains. An EVM chain requires a nonempty JSON_RPC_URL_<chainId> value. Solana (1399811149) requires SOLANA_RPC_URL and the applicable tenant entitlement. Do not use a fixed global chain list. Ask Glider which chains are enabled in the applicable environment. An unsupported chain returns 400 API_400. The error.details field identifies the rejected chainIds. You select portfolio chains during enrollment. An EVM portfolio can add chains later with the two-stage chain-activation flow (POST /v2/portfolios/{portfolioId}/chains/signature + POST /v2/portfolios/{portfolioId}/chains).

Solana (SVM) enrollment

The svm_b2b_api entitlement controls Solana enrollment for each tenant. Contact [email protected] to enable it. Without it, a Solana enrollment request returns 403 API_104. Each enrollment request uses one namespace. Send Solana (1399811149) chain IDs or EVM chain IDs. Do not send both. Both owner models create a Swig smart wallet. Its sub-account is the deposit address.
  • Solana-rooted (Model B): ownerAccountId is a solana: CAIP-10, and the user signs a Solana transaction returned by stage 1.
  • EVM-rooted (Model A): ownerAccountId stays eip155:0:<addr> with chainIds: [1399811149]. The secp256k1 key of the user becomes the Swig root and authorizes the sub-account with a slot-bound signature.
See Two-stage enrollment for the request and response formats. Solana withdrawals use the same owner models. Stage 1 returns data.authorization instead of data.typedData. Stage 2 accepts a hex or base58 signature. See Prepare Withdrawal Authorization → Solana withdrawals.

Monetary Values

The API sends monetary values as decimal strings. This format prevents IEEE 754 precision loss. For a full withdrawal, read balanceRaw from GET /v2/portfolios/{portfolioId}/positions. Send this value as amountRaw. Do not calculate it from balance.

Pagination

Pagination uses a cursor based on (createdAt, id).
  • limit: Minimum 1, maximum 200, and default 50.
  • cursor: An opaque base64url string.
  • nextCursor: null when there are no more pages.
Do not decode or create cursors. Glider owns the cursor format and can change it. Send the previous nextCursor unchanged.

Idempotency

Write routes with permanent effects use an idempotency anchor. An identical replay returns the original response. A replay with a different body returns 409 API_008. See Idempotency for retry rules and the three 409 sub-codes you may see.

Asynchronous operations

Write routes that start onchain work return 202 and an operationId. Poll the operation every 2–5 seconds. Stop when the state is completed, failed, or cancelled.

Error codes

All B2B API error codes use the API_XXX format. The number range identifies the category. The following table contains common codes. For the full list, see Error codes.

Tracing and support

Include the X-Correlation-Id header when you report an issue. Glider uses this value to find related logs.

Next steps