# API overview

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

Source: https://legion.ambient.xyz/docs/api/overview

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](https://legion.ambient.xyz/docs/api/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.

```sh
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](https://legion.ambient.xyz/docs/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](https://legion.ambient.xyz/docs/api/pagination).
- **Retries.** Operations that create rentals or move money take an `Idempotency-Key`. See [Idempotency](https://legion.ambient.xyz/docs/api/idempotency).
- **Request IDs.** Every response carries an `X-Request-Id` header. Quote it when you contact [support](https://legion.ambient.xyz/docs/account/support).
- **Other organizations.** A resource that belongs to another organization answers `404`, as if it didn't exist.

## Reference

The [API reference](https://legion.ambient.xyz/docs/api) lists every operation with its parameters, responses, errors and a curl sample. Download the OpenAPI document as [JSON](https://legion.ambient.xyz/docs/openapi.json) or [YAML](https://legion.ambient.xyz/docs/openapi.yaml) to import into your tools.

The [public market API](https://legion.ambient.xyz/docs/api/public-market) needs no key.
