Skip to content

API overview

The Legion API's base URL, conventions, and your first request.

On this page

Everything you do in the app, from renting to listing a host, you can do through the Legion API.

Base URL

Text
https://api.legion.ambient.xyz/v1

Every request is HTTPS and carries an API key. See Authentication.

Your first request

Check your key with getMe. It returns who the key acts as, your organization, your role and your permissions, and credential: the key's scope (full or agent) and whether it has provider_tools. The permissions are your role's; credential says what this key may call.

Shell
curl -s "https://api.legion.ambient.xyz/v1/me" \
  -H "Authorization: Bearer $LEGION_API_KEY"

Conventions

  • JSON. Requests and responses are JSON. Errors are application/problem+json. See Errors.

  • Times are RFC 3339, in UTC.

  • Money is an integer number of minor units (cents) with an ISO 4217 currency code, for example {"amount_minor": 210, "currency": "USD"} for $2.10. Money is never a float.

  • Lists use cursor pagination. See Pagination.

  • Retries. Operations that create rentals or move money take an Idempotency-Key. See Idempotency.

  • Request IDs. Every response carries an X-Request-Id header. Quote it when you contact support.

  • Other organizations. A resource that belongs to another organization answers 404, as if it didn't exist.

Reference

The API reference lists every operation with its parameters, responses, errors and a curl sample. Download the OpenAPI document as JSON or YAML to import into your tools.

The public market API needs no key.