# Create a conversion

> Convert one uploaded file to docx, pdf, md, html, or txt.

See [conversion formats and limits](https://revise.io/developer/docs/revise-api/conversions) for integration guidance.

This call returns an admission receipt. Poll the get endpoint until work stops, then inspect the result and download its artifacts. See [job lifecycle](https://revise.io/developer/docs/revise-api/jobs).

## TypeScript

```ts
import { ReviseClient } from "@reviseio/api";

const revise = new ReviseClient({ apiKey: process.env.REVISE_API_KEY! });
const result = await revise.conversions.create(
  { input: { file_id: "file_id" }, output: { format: "pdf" } },
  { idempotencyKey: "convert-42" },
);
```

`POST https://revise.io/api/v1/convert`

Convert one uploaded file to docx, pdf, md, html, or txt. Same-format conversion is rejected. DOCX, Markdown, HTML, text, RTF, and ODT use deterministic conversion at $0.005 each. PDF and image inputs use semantic scanning: $0.02 per page with managed inference on the default OpenAI model, or $0.005 per page plus provider inference when using your own OpenAI key. Only your own key permits another catalogued OpenAI model. Deterministic conversions reject nonempty inference settings.

Uploads are limited to 18 MiB, PDFs to 100 pages, and output to 50 MiB before encryption. There is no default spending cap; an explicitly set insufficient page budget fails with conversion_limit_exceeded before inference. PDF processing errors include pdf_page_limit_exceeded, pdf_password_protected, invalid_pdf, and empty_pdf. These validation failures are unbilled. Cancellation or customer limits can incur charges for work already performed; read settled usage. Conversions have no additional CPU or Revise inference fee and do not count toward prompt base-fee tiers.

## Authorization

`Authorization: Bearer <key>` with an API key from https://revise.io/console/api-keys.

## Headers

- `Idempotency-Key` (string, required): min length 1. max length 200

## Body

- `input` (object, required)
  - `file_id` (string, required)
- `output` (object, required)
  - `format` (string, required): one of "docx", "pdf", "md", "html", "txt"
- `limits` (Limits): Optional execution and spending thresholds. Spending limits are opt-in: omitted cost limits are unlimited. The time limit defaults to 900 seconds. Prompt platform cost is base fee plus tool CPU; conversion platform cost is its flat/page fee. Prompt cost limits may each be at most $500,000; conversion cost limits may each be at most $1,000,000. These thresholds do not reserve account credit.. example {"max_platform_cost_usd":"2.000000000","max_inference_cost_usd":"3.000000000","max_seconds":900}
  - `max_platform_cost_usd` (string | number): Platform spending threshold. Must cover the applicable base/conversion fee, or one scan page. A scan checks its full page fee before inference. For prompts, no new model call starts once observed platform spend reaches this threshold; active work may exceed it. Omit for no per-request spending limit. Must be greater than zero when supplied.
  - `max_inference_cost_usd` (string | number): Soft inference threshold, including managed prompt premium and search. Active responses can exceed it. With your own provider key it meters provider list-price spend, while Revise charges no inference fee. For managed scans, scan inference is included in the page fee but remains subject to this threshold. Omit for no per-request spending limit. Must be greater than zero when supplied.
  - `max_seconds` (integer): Work budget in seconds, starting when a worker begins, excluding queue time. Prompts stop new turns at the deadline; active responses and exports can finish later.. min 120. max 3600
- `inference` (InferenceRequest)
  - `provider` (string): Public provider ID. Omit for the API default on a new conversation, or inherit from previous_prompt_id.. one of "openai", "anthropic", "xai", "gemini"
  - `model` (string): Exact model ID from /v1/models, or default. Omitting it selects the provider default, except when inherited from a predecessor.
  - `billing` (string): Which party pays for inference. Omitted or "revise" is automatic: the account's stored key for the resolved provider is used when present (billed by the provider, no Revise inference charge), otherwise managed inference applies. "provider" requires a stored key for the resolved provider and fails admission with provider_key_required instead of falling back. Provider resolution includes defaults and predecessor inheritance, so an omitted provider still uses the account key.. one of "revise", "provider"
- `metadata` (Metadata): Up to 16 string values for application attribution. Keys are 1–64 UTF-8 bytes; values at most 512 UTF-8 bytes. Metadata is deleted with request content; persist your own job mapping for long-term attribution.. example {"customer":"acme","environment":"production"}
- `output_encryption` (OutputEncryption): Encrypt exported artifact bytes using compact JWE, RSA-OAEP-256 and A256GCM. Only encrypted files are downloadable. Disables prompt continuation and artifact reuse; cannot be combined with previous_prompt_id or artifact_id input. Prompts require editing or export_document=true.
  - `format` (string, required): one of "jwe"
  - `public_key_pem` (string, required): RSA SubjectPublicKeyInfo PEM (BEGIN PUBLIC KEY), 2048–8192 bits. Private keys, certificates and key URLs are rejected.. max length 16384
- `retention` (RetentionOptions)
  - `delete_after_webhook_id` (string, required): Account-owned endpoint subscribed to prompt.completed or conversion.completed, matching the request kind. Its successful acknowledgement deletes request content and ephemeral source. Download everything before returning 2xx.

## Responses

### 202 `Conversion`

Queued conversion

- Header `Location`: Account-authenticated path to retrieve this resource.
- Header `Idempotent-Replayed`: Present with value true on an idempotent replay.
- Header `Retry-After`: Suggested delay before polling, in seconds.
- `id` (string, required)
- `object` (string, required): always "conversion"
- `status` (string, required): one of "queued", "running", "succeeded", "failed", "cancelled"
- `mode` (string, required): Empty after request content has been deleted.. one of "deterministic", "vision", ""
- `input` (object, required)
  - `file_id` (string, required)
  - `format` (string, required): Empty after request content has been deleted.. one of "pdf", "docx", "md", "html", "txt", "rtf", "odt", "image", ""
  - `filename` (string, required)
  - `bytes` (integer, required)
  - `sha256` (string, required)
- `output` (object, required)
  - `format` (string, required): Empty after request content has been deleted.. one of "docx", "pdf", "md", "html", "txt", ""
  - `artifact` (Artifact | null, required)
- `output_encrypted` (boolean, required)
- `metadata` (Metadata, required): Up to 16 string values for application attribution. Keys are 1–64 UTF-8 bytes; values at most 512 UTF-8 bytes. Metadata is deleted with request content; persist your own job mapping for long-term attribution.. example {"customer":"acme","environment":"production"}
- `usage` (Usage | null, required)
- `created_at` (string<date-time>, required)
- `completed_at` (string | null, required)
- `content_expires_at` (string | null, required)
- `content_deleted_at` (string | null, required)
- `error` (object | null, required)
- `retention` (RetentionOptions)
  - `delete_after_webhook_id` (string, required): Account-owned endpoint subscribed to prompt.completed or conversion.completed, matching the request kind. Its successful acknowledgement deletes request content and ephemeral source. Download everything before returning 2xx.

### default `Error`

Error

- `error` (object, required)
  - `code` (string, required)
  - `message` (string, required)
  - `details` (object)
