Revise API menu

Create a prompt

POSThttps://revise.io/api/v1/prompt

Submit a text request or read, comment on, or edit one document. Prompt targets support DOCX, Markdown, HTML, and plain text. Convert other upload formats first. Edit access exports clean and tracked-changes DOCX artifacts; read/comment access requires export_document=true to export. A 202 response confirms admission; poll the receipt for completion and inspect incomplete and stop_reason even on success. Use /v1/models for supported providers and models.

See prompt workflows 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.

TypeScript#

TypeScript
import { ReviseClient } from "@reviseio/api";

const revise = new ReviseClient({ apiKey: process.env.REVISE_API_KEY! });
const result = await revise.prompts.create(
  { prompt: "Write a short welcome message." },
  { idempotencyKey: "welcome-42" },
);

Authorization#

Authorizationstringrequired

Bearer <key>, with an API key from the console.

Headers#

Idempotency-Keystringrequired

min length 1 · max length 200

Body#

application/json · required

promptstringrequired

Nonempty instruction, at most 1 MiB of UTF-8 bytes. The entire JSON body is limited to 2 MiB.

min length 1 · max length 1048576

document_accessstringdefault: "read"

one of "read", "comment", "edit"

previous_prompt_idstring

Latest successful head of the same conversation, with retained content and no active successor. Cannot be combined with inputs. Inherits provider/model and omitted response options; document_access still defaults to read. Encrypted-output requests cannot be continued.

inputsarray<Target>

At most one target, with exactly one file_id or artifact_id. Uploaded targets support DOCX, Markdown, HTML, and text. Direct artifact inputs require input_eligible=true and an unencrypted new request.

max items 1

Properties
rolestringrequired

always "target"

file_idstring
artifact_idstring
export_documentbooleandefault: false

Export clean and tracked-changes DOCX artifacts for read/comment requests. edit always exports. Requires a target.

limitsLimits

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}

Properties
max_platform_cost_usdstring | 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_usdstring | 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_secondsintegerdefault: 900

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

inferenceInferenceRequest
Properties
providerstring

Public provider ID. Omit for the API default on a new conversation, or inherit from previous_prompt_id.

one of "openai", "anthropic", "xai", "gemini"

modelstring

Exact model ID from /v1/models, or default. Omitting it selects the provider default, except when inherited from a predecessor.

billingstring

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"

metadataMetadata

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_encryptionOutputEncryption

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.

Properties
formatstringrequired

one of "jwe"

public_key_pemstringrequired

RSA SubjectPublicKeyInfo PEM (BEGIN PUBLIC KEY), 2048–8192 bits. Private keys, certificates and key URLs are rejected.

max length 16384

response_optionsResponseOptions

Persisted response policy. False omits the corresponding top-level JSON field from submission, polling, history and replay responses; it does not change the document or native state. Omitted options inherit from an unencrypted predecessor or reused artifact, otherwise default to true.

Properties
include_commentsbooleandefault: true
include_changesbooleandefault: true
retentionRetentionOptions
Properties
delete_after_webhook_idstringrequired

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#

202PromptAdmission receipt, including on idempotent replay. May already be running or terminal. Save the ID and poll for the result.

Headers

Locationstring

Account-authenticated path to retrieve this resource.

Idempotent-Replayedstring

Present with value true on an idempotent replay.

Retry-Afterstring

Suggested delay before polling, in seconds.

Body

idstringrequired
conversation_idstringrequired
previous_prompt_idstring | nullrequired
statusstringrequired

one of "queued", "running", "paused", "succeeded", "failed", "cancelled"

created_atstring<date-time>required
completed_atstring<date-time> | nullrequired
conversation_expires_atstring<date-time> | nullrequired
messageMessage | nullrequired
continuationContinuationrequired
Properties
reasoning_statestringrequired

one of "new", "reused", "reset", "compacted", "unavailable"

history_compactedboolean | nullrequired
reasonstring
commentsarray<NativeComment>

Flat native comment records; replies use parentId. Omitted when disabled by response_options or when content is unavailable.

Properties
idstringrequired
authorstringrequired
initialsstring
authorIdstring
authorImageUrlstring
createdAtstring<date-time>required
bodyMdstringrequired

Comment text in Markdown.

parentIdstring

Parent comment ID for a reply; absent for a root comment.

agentRequestIdstring
agentConversationIdstring
agentNamestring
agentModelstring
suggestionIdstring
anchorBlockIdstring
agentTriggerIdsarray<string>
relatedSuggestionIdsarray<string>
resolvedboolean
authorTypestring

one of "human", "ai"

importedIdinteger
citationsarray<Citation>
Properties
idstringrequired
urlstringrequired
titlestringrequired
startIndexinteger
endIndexinteger
mentionsarray<object>
Properties
idstringrequired
typestringrequired

one of "user", "agent"

labelstringrequired
startintegerrequired
endintegerrequired
emailstring
changesarray<NativeTrackedChange>

Pending native tracked changes. Replacements can appear as linked insertion/deletion entries. Omitted when disabled by response_options or when content is unavailable.

Properties
idstringrequired
kindstringrequired

one of "insert", "delete", "format", "move"

blockIdsarray<string>required
commentThreadIdstring
authorstringrequired
agentModelstring
descriptionstring
insertedTextstring
deletedTextstring
authorTypestringrequired

one of "human", "ai"

createdAtnumber

Unix time in milliseconds, when recorded.

moveSourceBlockIdsarray<string>
moveDestinationBlockIdsarray<string>
artifactsarray<Artifact>required
Properties
idstringrequired
prompt_idstring
conversion_idstring
formatstringrequired

one of "docx", "pdf", "md", "html", "txt"

filenamestringrequired

Original plaintext filename, even when encrypted. Encrypted downloads append .jwe.

content_typestringrequired

Original plaintext MIME type. Encrypted downloads use application/jose.

variantstringrequired

one of "tracked_changes", "clean", "converted"

sha256stringrequired

SHA-256 of the exact downloadable bytes (ciphertext for encrypted artifacts).

bytesintegerrequired

Size of the downloadable bytes, including JWE encoding overhead when encrypted.

download_urlstringrequired

Account-authenticated API path. The endpoint may redirect to signed storage; never forward bearer credentials to storage.

input_eligiblebooleanrequired

True only for an unexpired, undeleted, unencrypted prompt artifact. Conversion artifacts are not directly reusable; download and upload them first.

expires_atstring | nullrequired
encryptionArtifactEncryption
Properties
formatstringrequired

one of "jwe"

algstringrequired

one of "RSA-OAEP-256"

encstringrequired

one of "A256GCM"

key_idstringrequired

Base64url SHA-256 JWK thumbprint of the recipient public key (RFC7638).

deleted_atstring | nullrequired
usageUsage | nullrequired
metadataMetadatarequired

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"}

inferenceobjectrequired
Properties
providerstringrequired

one of "openai", "anthropic", "xai", "gemini"

modelstringrequired
billingstringrequired

The billing that applied at admission; fixed for the life of the request even if account keys change later.

one of "revise", "provider"

limitsobjectrequired
Properties
max_platform_cost_usdstring

example "0.050000000"

max_inference_cost_usdstring

example "0.050000000"

max_secondsintegerrequired
errorobject | nullrequired
api_key_idstring | nullrequired

Non-secret ID of the key that originally submitted this prompt; null when not recorded. Idempotent retries preserve the original key.

output_encryptedbooleanrequired

True disables continuation and reuse. Artifacts are encrypted for the supplied public key.

content_expires_atstring | nullrequired

24 hours after terminal completion. Result content and new continuation become unavailable at this deadline.

content_deleted_atstring | nullrequired
retentionRetentionOptions
Properties
delete_after_webhook_idstringrequired

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.

incompletebooleanrequired

True when the request returned a partial result.

stop_reasonstring

Limit that ended further agent work. The current result is returned; successful partial results incur the base fee even without inference, plus actual billable usage.

one of "spending_limit", "time_limit"

defaultErrorError
errorobjectrequired
Properties
codestringrequired
messagestringrequired
detailsobject