# SciFig API

Create scientific illustrations, data charts and flowcharts over HTTP, with the same engines, prices and credits as the SciFig website.

Source: https://scifig.ai/docs/api

## Quick start

- Create an API key under [Settings → Developer](/app/settings?tab=developer). Keys that generate need an active subscription or a credit-pack balance above zero; read-only keys work on any account.
- Send a create request with an `Idempotency-Key`. With `Prefer: wait=25` the response waits up to 25 seconds and returns the finished job when it is done in time.
- If the job is still `queued` or `processing`, read `GET /jobs/{id}` every few seconds (follow `Retry-After`) until it is `succeeded` or `failed`.
- Download each output from its `download_url` (valid for one hour), or pass its `file_id` to another endpoint.

```bash
curl -X POST https://scifig.ai/api/v1/images/generations \
  -H "Authorization: Bearer $SCIFIG_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Prefer: wait=25" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Mitochondrial electron transport chain, labelled", "aspect_ratio": "4:3"}'
```

Base URL: `https://scifig.ai/api/v1`. Machine-readable contract: [OpenAPI JSON](https://scifig.ai/api/v1/openapi.json) and [OpenAPI YAML](https://scifig.ai/api/v1/openapi.yaml). AI assistants can use the same features through the [MCP server](/mcp).

## Endpoints

| Endpoint | What it does | Credits |
| --- | --- | --- |
| POST /images/generations | Generate a scientific illustration from a prompt | 50 / 75 / 100 |
| POST /images/edits | Edit by instruction or region, white background, aspect ratio, recolor, replace text | 50 / 75 / 100; region or text 100 |
| POST /images/text-detections | Find the text in an image before replacing it | 0 |
| POST /images/upscales | Upscale to 2K, 4K or 8K | 50 / 100 / 150 |
| POST /images/conversions | SVG vectorization; PNG, PDF, TIFF and PPTX export | SVG 150; others 0 |
| POST /charts/generations | Plot a chart from CSV, TSV or Excel data | 100 |
| POST /charts/edits | Change the latest version of a chart | 100 |
| POST /flowcharts/generations | Draw a flowchart as SVG | 100 |
| POST /flowcharts/edits | Change the latest version of a flowchart | 100 |
| POST /files | Upload an image, a mask or an attachment | 0 |
| GET /files/{file_id} | Download a file | 0 |
| GET /jobs/{id} | Read one job | 0 |
| GET /jobs | List recent jobs | 0 |
| GET /credits | Balance, plan and task limits | 0 |
| GET /pricing | Every price (no authentication) | 0 |
| GET /openapi.json | OpenAPI 3.1 description (no authentication) | 0 |
| GET /openapi.yaml | The same description as YAML (no authentication) | 0 |

There are no webhooks, SDKs or command-line tools: call the endpoints directly from a server or a script (the API does not allow browser CORS requests).
