# Factory API

Reference for the Factory Public API at api.factory.ai. See each operation for its authentication requirements.

## Authentication

Most operations authenticate with a bearer credential in the `Authorization` header. Check the operation for which credentials it accepts. The health check does not require authentication. In examples, operations that accept only an API key use `FACTORY_API_KEY`. Other operations use `FACTORY_BEARER_TOKEN`, set to a credential the operation accepts.

A Factory API key or user access token, sent as `Authorization: Bearer <credential>`.

```bash
Authorization: Bearer $FACTORY_BEARER_TOKEN
```

## Create an API key

Create API keys in the Factory App before you call the API. Keys are shown once, so copy the value immediately and store it in your secret manager or shell environment.

1. Open [Factory API keys settings](https://app.factory.ai/settings/api-keys).
2. Create a new API key and give it a name that matches the integration.
3. Copy the key, store it securely, and load it as an environment variable.

```bash
export FACTORY_API_KEY="fk-your-api-key"
export FACTORY_BEARER_TOKEN="$FACTORY_API_KEY"
```

## Base URL

All endpoints are relative to the production base URL. Prepend it to each operation path shown on the group pages.

```text
https://api.factory.ai
```

API version 0.1.0.

## Resource groups

The API is organized into 14 resource groups. Each group page lists its operations with parameters, request and response schemas, and a curl example.

- [Authentication API](https://docs.factory.com/api-reference/authentication.md): Inspect the authenticated principal and look up organization IDs. (2 endpoints)
- [Automations API](https://docs.factory.com/api-reference/automations-ci.md): Manage automations and runs, and configure CI automation workflows. (29 endpoints)
- [Droid Computers API](https://docs.factory.com/api-reference/computers.md): Provision and manage Factory computers: create, inspect, refresh, restart, and delete. (17 endpoints)
- [Datasets API](https://docs.factory.com/api-reference/datasets.md): List, upload, and import datasets, and browse their tasks and files. (8 endpoints)
- [Droid Execute API](https://docs.factory.com/api-reference/droid.md): Start a headless Droid turn in one call: on a fresh computer, an existing computer, or an existing session. (1 endpoint)
- [Environments API](https://docs.factory.com/api-reference/environments.md): Manage Environments, provider sources, default selection, and build status and diagnostics. (13 endpoints)
- [Health API](https://docs.factory.com/api-reference/health.md): Check whether the Factory API deployment is serving requests. (1 endpoint)
- [Integrations API](https://docs.factory.com/api-reference/integrations.md): Report lifecycle events for remote delegation sessions. (1 endpoint)
- [Machine Templates API](https://docs.factory.com/api-reference/machine-templates.md): Create, list, inspect, update, and delete machine templates. (5 endpoints)
- [Organization Management API](https://docs.factory.com/api-reference/organization.md): Administer organization members and usage limits, and review enterprise control history. (18 endpoints)
- [Readiness Reports API](https://docs.factory.com/api-reference/readiness-reports.md): List and retrieve agent readiness reports you can access. (2 endpoints)
- [Service Accounts API](https://docs.factory.com/api-reference/service-accounts.md): Manage service accounts and their API keys: create, list, update, rotate, and revoke. (17 endpoints)
- [Droid Sessions API](https://docs.factory.com/api-reference/sessions.md): Create and drive Droid sessions and workstreams, and manage settings and messages. (14 endpoints)
- [AutoWiki API](https://docs.factory.com/api-reference/wiki.md): Generate and manage AutoWiki runs: create runs, browse pages, search, and export. (11 endpoints)
