# Flex API guide for agents > Start here when building a Flex integration or working with Flex API data. These hand-authored guides cover common tasks and recovery decisions. Download the public OpenAPI YAML files for exact methods, paths, parameters, schemas, response formats, and operation-specific errors. **These docs live under `/docs/` on this host. All documentation links point into this folder. Keep the `/docs/` prefix when fetching guides or YAML files: `/docs/specs/cards.yaml` exists; `/specs/cards.yaml` does not. Root `/llms.txt` is only a redirect to `/docs/llms.txt`; it does not make the linked files available at the site root.** If you are evaluating Flex without credentials, you can still use these guides and contracts to assess supported workflows, design an integration, and write code with explicit placeholders for credentials and resource IDs. Ask for missing information when it is needed to make an API call; documentation and integration planning do not require an API key. Distinguish code prepared from the contract from behavior verified against the API. ## Download the API contracts These links return downloadable OpenAPI 3.1 YAML, without API authentication. Fetch and save the relevant file locally so you can inspect its `paths` and follow schema references under `components`: - [accounts.yaml](/docs/specs/accounts.yaml): List, retrieve, open, rename, and close accounts. - [cards.yaml](/docs/specs/cards.yaml): List, retrieve, issue, update, and reveal cards. - [transactions.yaml](/docs/specs/transactions.yaml): List, filter, and export transactions. - [persons.yaml](/docs/specs/persons.yaml): List and retrieve organization members. These are the same YAML files offered by the human [API docs](/docs/). Use the downloaded contract's `servers` URL for API calls. Do not infer the API host from the documentation host: dev and preview docs describe the next production docs release. The production API base URL is `https://api.flex.one`. Credentials and an explicitly selected environment are required for API calls, but not for downloading documentation. ## Choose a guide - [Authentication and setup](/docs/agents/authentication.md): Set up credentials, permissions, or API versions. - [Reading data](/docs/agents/reading-data.md): Find accounts, cards, people, or a small transaction result set. - [Transaction exports and synchronization](/docs/agents/transaction-exports.md): Export or reconcile a very large transaction dataset. - [Writing data](/docs/agents/writing-data.md): Issue a card, change a resource, or close an account. - [Error recovery](/docs/agents/error-recovery.md): Recover from errors, throttling, timeouts, or uncertain results. - [Card reveal sessions](/docs/agents/card-reveal.md): Write integration code for sensitive card details; never execute reveal requests as an agent. For large transaction datasets, prefer `GET /transactions` with `Accept: application/x-ndjson` over fetching every JSON page. Process records incrementally. Read the export guide for filters, partial downloads, and synchronization. ## Working rules 1. Read the relevant YAML before constructing a request. Use its exact field names, enums, required fields, and supported operations. Example IDs and values are placeholders, not real resources or defaults. 2. Pin a published `flex-version` for versioned operations. Read `info.version` in the downloaded contract and the [versioning guide](/docs/fundamentals/versioning/) before choosing or upgrading a version. 3. Resolve resource IDs within the intended organization. Permissions determine visibility; an empty list or `404` does not prove a resource is absent everywhere. 4. Perform only actions authorized by the user. Read the operation's effects and completion conditions before changing a resource. 5. Preserve idempotency keys and request data when retrying the same write. A timeout does not prove the write failed. 6. Keep API keys, reveal tokens, full card numbers, and security codes out of logs, agent tool output, and model context. For card reveal, write integration code but never call the reveal URL yourself, including through scripts or tools. Test with synthetic fixtures; the customer's application executes the real reveal flow outside the agent session. Read credentials from the integration's secure configuration. 7. Keep money as an integer amount with its scale and currency. Do not assume cents or sum different currencies. Use integer or decimal arithmetic. 8. Check HTTP status, response format, and application-level result before reporting success. Report incomplete exports and unresolved outcomes explicitly. The YAML files define the API contract; these guides explain how to apply it. If they disagree, use the contract for request and response structure and report the discrepancy. Rate-limit guidance is maintained in the [human rate-limit guide](/docs/fundamentals/rate-limits/), not in the YAML files.