# API overview

> One base URL, one Bearer key, JSON in and out. Every create call returns a job you poll until it is done.

Source: https://developers.mnml.ai/docs/api-reference

## Base URL

**Base URL**

```
https://api.mnml.ai/v2
```

Send your key in the `Authorization` header as `Bearer mk_live_…`. See [Authentication](https://developers.mnml.ai/docs/authentication).

## Endpoints

This list is read from the API’s own OpenAPI description, so it always matches the server.

### Create

- [`POST /v2/renders`](https://developers.mnml.ai/docs/renders): Start a render.
- [`POST /v2/edits`](https://developers.mnml.ai/docs/edits): Change one thing on an image and keep the rest, on the whole image or an area; or erase what an area covers.
- [`POST /v2/enhancements`](https://developers.mnml.ai/docs/enhancements): Upscale, enhance, cut out (bg-remove) or extend (outpaint) an image.
- [`POST /v2/videos`](https://developers.mnml.ai/docs/videos): Animate an image into a short clip: a camera move through or around it.

### Jobs and files

- [`GET /v2/jobs/{id}`](https://developers.mnml.ai/docs/jobs): Read a job: its status, its outputs as signed links that expire, what it was charged and refunded, and why it failed.
- [`GET /v2/jobs/{id}/events`](https://developers.mnml.ai/docs/jobs#stream): Follow a job as Server-Sent Events, for one that outlasts ?wait: a job event with the job as it stands and each time it changes, then one last event (done with the settled job, timeout after 10 minutes, or error) and the stream closes.
- [`POST /v2/jobs/{id}/cancel`](https://developers.mnml.ai/docs/cancel): Stop a queued or running job.
- [`GET /v2/files/{id}`](https://developers.mnml.ai/docs/jobs#files): A job's output, at the signed link GET /v2/jobs/{id} gave.

### Account

- [`GET /v2/account`](https://developers.mnml.ai/docs/account): The key's account: balance, tier, this key's settings and the limits in force.
- [`GET /v2/engines`](https://developers.mnml.ai/docs/engines): The engines this key can render on, with their prices.

### OpenAPI

- [`GET /v2/openapi.json`](https://developers.mnml.ai/docs/api-reference#openapi): This API description, as OpenAPI 3.1.

## Answers

Every answer is one envelope: `{ "success": true, "data": … }`, or `{ "success": false, "error": … }` with a stable `code` (see [Errors](https://developers.mnml.ai/docs/errors)). Fields are `snake_case`. Amounts are whole [API credits](https://developers.mnml.ai/docs/account#amounts).

## Jobs

Renders, edits, enhancements and videos answer `202` with a job straight away. Poll [GET /v2/jobs/{id}](https://developers.mnml.ai/docs/jobs) or add a [webhook](https://developers.mnml.ai/docs/webhooks) to hear when it settles.

## OpenAPI

The whole API is described as OpenAPI 3.1 at `https://api.mnml.ai/v2/openapi.json`, with no key needed. Generate a client from it, or import it into your HTTP tool.
