> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doconda.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Crear un documento

> Crea, revisa o edita un documento, en modo directo, stream o background.



## OpenAPI

````yaml /es/openapi.json post /documents
openapi: 3.1.0
info:
  title: Doconda API
  version: 0.1.0
  license:
    name: Proprietary
    url: https://doconda.com/terms
  description: >-
    Create, review and edit Word, PowerPoint, Excel and PDF documents for AI
    agents. `POST /documents` works like an LLM API: direct (default), `stream:
    true` (SSE) or `background: true`.

    Errors follow RFC 9457 (application/problem+json). `POST /documents` accepts
    `Idempotency-Key`.
servers:
  - url: https://api.eu.doconda.com/v1
security:
  - apiKey: []
tags:
  - name: Documents
    description: Create, review and edit documents.
  - name: Files
    description: Your own files, to use as a source or to review/edit.
  - name: Webhooks
    description: Be notified when a document is ready.
  - name: Dashboard
    description: >-
      Used by the Doconda dashboard with a signed-in user. Not available with
      API keys.
paths:
  /documents:
    post:
      tags:
        - Documents
      summary: Create, review or edit a document (direct, stream or background)
      operationId: createDocument
      parameters:
        - name: dry_run
          in: query
          required: false
          description: >-
            Validate the fields, the operation and the files without creating
            anything. The style and the balance aren't checked.
          schema:
            type: boolean
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Strongly recommended (the SDKs always send one). The same key with
            the same body within 24 h, in the same project, returns the same
            document; with another body, 422 idempotency_key_reused.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                operation:
                  default: create
                  type: string
                  enum:
                    - create
                    - review
                    - edit
                name:
                  description: >-
                    A name to find it later ("Contrato piso Malasaña"). It also
                    names the downloaded files.
                  type: string
                  minLength: 1
                  maxLength: 200
                format:
                  type: string
                  enum:
                    - docx
                    - pdf
                    - pptx
                    - xlsx
                    - artifact
                  description: >-
                    The file you want. `docx` → Word (with a PDF too), `pdf` →
                    only the PDF, `pptx` → PowerPoint (with a PDF), `xlsx` →
                    Excel (with a PDF). `artifact` → a web page that keeps data
                    (in each visitor's browser, or shared by everyone), on a
                    signed link; with `retention: none`, a page to download (see
                    the artifacts guide). Without it, Doconda works it out from
                    `prompt`.
                prompt:
                  description: >-
                    What to write (create) or what to change (edit). Uses a
                    model.
                  type: string
                  minLength: 3
                  maxLength: 8000
                content:
                  description: >-
                    Your own text, in Markdown (create; for an artifact, the
                    content of its page).
                  type: object
                  properties:
                    markdown:
                      type: string
                      minLength: 1
                      maxLength: 500000
                  required:
                    - markdown
                  additionalProperties: false
                style:
                  description: >-
                    The look, in your own words: "blue centred headings, Lora
                    font, with a cover page and a table of contents". What can't
                    be done is listed in `style_unsupported`.
                  type: string
                  minLength: 1
                  maxLength: 1000
                sources:
                  description: >-
                    create: your files for the document. Documents (Word,
                    PowerPoint, Excel, PDF, also .doc/.ppt/.xls, TXT, Markdown,
                    HTML; up to 5) are material to write from, with `prompt`.
                    Pictures (PNG, JPEG, GIF, WebP; up to 10) go into the
                    document: with `prompt` the AI places them where they fit;
                    with `content`, point to them from the Markdown as
                    `![caption](img:1)` (the first picture in `sources`). If
                    `prompt` asks to copy the look of one of them ("with the
                    design of our template"), Doconda uses it as the design at
                    `standard` and `best` (a PowerPoint for a presentation is
                    its template); at `fast` it is not copied and the report
                    says so (`design.not_copied`), and with `quality: "auto"`
                    copying anything other than a PowerPoint template for a
                    presentation picks `best`. For an artifact, the page is
                    built from the data in the documents and the pictures go
                    inside it, made smaller (900 KB at most for the whole page).
                  maxItems: 15
                  type: array
                  items:
                    anyOf:
                      - type: string
                        pattern: ^file_
                        description: A file uploaded with POST /files.
                      - type: string
                        pattern: ^doc_
                        description: >-
                          A document Doconda already made, by its id: we use its
                          Word, PowerPoint or Excel (or its PDF, if that is all
                          it has).
                      - type: object
                        properties:
                          url:
                            type: string
                            maxLength: 2048
                            format: uri
                          filename:
                            type: string
                            minLength: 1
                            maxLength: 200
                        required:
                          - url
                        additionalProperties: false
                        description: We download it (public http/https, up to 20 MB).
                      - type: object
                        properties:
                          data:
                            type: string
                            maxLength: 27962031
                            format: base64
                            contentEncoding: base64
                            pattern: >-
                              ^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$
                          filename:
                            type: string
                            minLength: 1
                            maxLength: 200
                        required:
                          - data
                          - filename
                        additionalProperties: false
                        description: >-
                          The file's bytes in base64, with its name (the
                          extension says the format).
                file:
                  description: >-
                    review / edit / extract: the file to work on. review and
                    edit take Word, PowerPoint, Excel or PDF (up to 50 pages),
                    also .doc, .ppt and .xls (they come back as .docx, .pptx and
                    .xlsx).
                  anyOf:
                    - type: string
                      pattern: ^file_
                      description: A file uploaded with POST /files.
                    - type: string
                      pattern: ^doc_
                      description: >-
                        A document Doconda already made, by its id: we use its
                        Word, PowerPoint or Excel (or its PDF, if that is all it
                        has).
                    - type: object
                      properties:
                        url:
                          type: string
                          maxLength: 2048
                          format: uri
                        filename:
                          type: string
                          minLength: 1
                          maxLength: 200
                      required:
                        - url
                      additionalProperties: false
                      description: We download it (public http/https, up to 20 MB).
                    - type: object
                      properties:
                        data:
                          type: string
                          maxLength: 27962031
                          format: base64
                          contentEncoding: base64
                          pattern: >-
                            ^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$
                        filename:
                          type: string
                          minLength: 1
                          maxLength: 200
                      required:
                        - data
                        - filename
                      additionalProperties: false
                      description: >-
                        The file's bytes in base64, with its name (the extension
                        says the format).
                quality:
                  default: auto
                  description: >-
                    create / edit: `fast`, `standard` or `best` (see Quality),
                    or `auto` to let Doconda choose. Each level has its own
                    price.
                  type: string
                  enum:
                    - auto
                    - fast
                    - standard
                    - best
                max_quality:
                  description: >-
                    With `quality: "auto"`: the highest level Doconda may
                    choose, to cap the price.
                  type: string
                  enum:
                    - fast
                    - standard
                    - best
                stream:
                  default: false
                  description: Answer with text/event-stream on this connection.
                  type: boolean
                background:
                  default: false
                  description: Answer 202 at once; follow with GET, /events or webhooks.
                  type: boolean
                metadata:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: string
                    maxLength: 500
                artifact:
                  description: >-
                    Artifacts only. Without it: `shared`, or `local` with
                    `retention: none`.
                  type: object
                  properties:
                    storage:
                      type: string
                      enum:
                        - local
                        - shared
                      description: >-
                        Where an artifact's page keeps its data. `local`: in
                        each visitor's browser (each one sees only theirs;
                        nothing reaches Doconda). `shared`: in Doconda, the same
                        for everyone with the link (polls, team lists). With
                        `retention: none`, only `local`.
                  additionalProperties: false
                retention:
                  description: >-
                    Without it, the project's retention (30 days unless
                    changed).
                  type: string
                  enum:
                    - none
                    - 1d
                    - 7d
                    - 30d
                    - 90d
              additionalProperties: false
      responses:
        '200':
          description: >-
            Direct mode: the finished document with its download links. Stream
            mode: text/event-stream of DocumentEvent. Dry run: DryRunResult.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      id:
                        type: string
                        pattern: ^doc_[0-9A-HJKMNP-TV-Z]{26}$
                      object:
                        type: string
                        const: document
                      name:
                        description: The name you gave it (`name` when creating it).
                        type:
                          - string
                          - 'null'
                      operation:
                        type: string
                        enum:
                          - create
                          - review
                          - edit
                      format:
                        anyOf:
                          - type: string
                            enum:
                              - docx
                              - pdf
                              - pptx
                              - xlsx
                              - artifact
                            description: >-
                              The file you want. `docx` → Word (with a PDF too),
                              `pdf` → only the PDF, `pptx` → PowerPoint (with a
                              PDF), `xlsx` → Excel (with a PDF). `artifact` → a
                              web page that keeps data (in each visitor's
                              browser, or shared by everyone), on a signed link;
                              with `retention: none`, a page to download (see
                              the artifacts guide). Without it, Doconda works it
                              out from `prompt`.
                          - type: 'null'
                      type:
                        anyOf:
                          - type: string
                            enum:
                              - report
                              - letter
                              - contract
                              - memo
                              - minutes
                              - presentation
                              - spreadsheet
                              - artifact
                            description: >-
                              What Doconda decided the document is. It sets the
                              default look (a contract: serif, justified,
                              numbered clauses; a letter: no page numbers). You
                              don't choose it: say what you want in `prompt`,
                              and the look in `style`.
                          - type: 'null'
                      mode:
                        anyOf:
                          - type: string
                            enum:
                              - prompt
                              - content
                          - type: 'null'
                      revision:
                        type: integer
                        minimum: 1
                        maximum: 9007199254740991
                        description: >-
                          1 when it's made; +1 every time its file is saved by
                          hand (PUT /documents/{id}/file). Send it back when
                          saving so nobody's changes are overwritten.
                      status:
                        type: string
                        enum:
                          - queued
                          - running
                          - ready
                          - ready_with_warnings
                          - needs_review
                          - failed
                          - canceled
                      phase:
                        type:
                          - string
                          - 'null'
                      pages:
                        anyOf:
                          - type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          - type: 'null'
                      style_applied:
                        anyOf:
                          - type: object
                            properties:
                              font:
                                type: string
                              font_size:
                                type: number
                              line_spacing:
                                type: number
                              colors:
                                type: object
                                properties:
                                  title:
                                    type: string
                                  headings:
                                    type: string
                                  text:
                                    type: string
                                  accent:
                                    type: string
                                required:
                                  - title
                                  - headings
                                  - text
                                  - accent
                              align:
                                type: object
                                properties:
                                  title:
                                    type: string
                                    enum:
                                      - left
                                      - center
                                      - right
                                      - justify
                                  headings:
                                    type: string
                                    enum:
                                      - left
                                      - center
                                      - right
                                      - justify
                                  body:
                                    type: string
                                    enum:
                                      - left
                                      - center
                                      - right
                                      - justify
                                required:
                                  - title
                                  - headings
                                  - body
                              margins_cm:
                                type: number
                              orientation:
                                type: string
                                enum:
                                  - portrait
                                  - landscape
                              cover_page:
                                type: boolean
                              table_of_contents:
                                type: boolean
                              page_numbers:
                                type: boolean
                              header:
                                type: string
                              footer:
                                type: string
                            required:
                              - font
                              - font_size
                              - line_spacing
                              - colors
                              - align
                              - margins_cm
                              - orientation
                              - cover_page
                              - table_of_contents
                              - page_numbers
                          - type: 'null'
                      style_unsupported:
                        type: array
                        items:
                          type: string
                      validation_summary:
                        anyOf:
                          - type: object
                            properties:
                              errors:
                                type: integer
                                minimum: -9007199254740991
                                maximum: 9007199254740991
                              warnings:
                                type: integer
                                minimum: -9007199254740991
                                maximum: 9007199254740991
                              info:
                                type: integer
                                minimum: -9007199254740991
                                maximum: 9007199254740991
                            required:
                              - errors
                              - warnings
                              - info
                          - type: 'null'
                      repair_summary:
                        anyOf:
                          - type: object
                            properties:
                              iterations:
                                type: integer
                                minimum: -9007199254740991
                                maximum: 9007199254740991
                              applied:
                                type: integer
                                minimum: -9007199254740991
                                maximum: 9007199254740991
                              rejected:
                                type: integer
                                minimum: -9007199254740991
                                maximum: 9007199254740991
                            required:
                              - iterations
                              - applied
                              - rejected
                          - type: 'null'
                      error:
                        anyOf:
                          - type: object
                            properties:
                              code:
                                type: string
                              message:
                                type: string
                            required:
                              - code
                              - message
                          - type: 'null'
                      versions:
                        type: object
                        properties:
                          engine:
                            type: string
                          renderer:
                            type: string
                          model:
                            type:
                              - string
                              - 'null'
                      metadata:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties:
                          type: string
                      retention:
                        type: string
                        enum:
                          - none
                          - 1d
                          - 7d
                          - 30d
                          - 90d
                        description: >-
                          How long Doconda keeps a document's content (files,
                          request, report, events; an artifact's page and data)
                          once it finishes. `none`: 15 minutes. Then only what
                          billing needs stays (status, format, pages, cost).
                      expires_at:
                        anyOf:
                          - type: string
                            format: date-time
                            pattern: >-
                              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                          - type: 'null'
                        description: >-
                          When its content will be deleted: `retention` counted
                          from when it finished or was last saved by hand (with
                          `retention: none`, from when it finished).
                      route:
                        anyOf:
                          - type: object
                            properties:
                              path:
                                type: string
                                enum:
                                  - fast
                                  - agent
                              reason:
                                type: string
                            required:
                              - path
                              - reason
                            description: >-
                              How the file was made, and why. `fast`: in
                              seconds, with the basic style (`quality: "fast"`).
                              `agent`: in minutes, with any design, templates,
                              comments, tracked changes and charts (`standard`
                              and `best`).
                          - type: 'null'
                      quality:
                        anyOf:
                          - type: object
                            properties:
                              requested:
                                type: string
                                enum:
                                  - auto
                                  - fast
                                  - standard
                                  - best
                                description: >-
                                  `auto`: Doconda picks the level. From
                                  `prompt`, the one the request needs (when in
                                  doubt, the cheaper one); from `content` alone,
                                  `standard`; `best` to copy a file's design
                                  (except a PowerPoint template for a
                                  presentation), to use a template with
                                  documents in `sources`, or for an edit with
                                  comments or tracked changes. `max_quality`
                                  caps it.
                              level:
                                anyOf:
                                  - type: string
                                    enum:
                                      - fast
                                      - standard
                                      - best
                                    description: >-
                                      How much work goes into the file. `fast`:
                                      seconds, basic style (the `style`
                                      options), the cheapest. `standard`: a few
                                      minutes, any style, templates and charts.
                                      `best`: more review and design care, the
                                      dearest.
                                  - type: 'null'
                                description: >-
                                  The level used (null until Doconda decides
                                  it).
                              reason:
                                type:
                                  - string
                                  - 'null'
                            required:
                              - requested
                              - level
                              - reason
                          - type: 'null'
                        description: >-
                          create and edit: the quality level asked for and the
                          one used, which sets the price.
                      artifact:
                        anyOf:
                          - type: object
                            properties:
                              storage:
                                type: string
                                enum:
                                  - local
                                  - shared
                                description: >-
                                  Where an artifact's page keeps its data.
                                  `local`: in each visitor's browser (each one
                                  sees only theirs; nothing reaches Doconda).
                                  `shared`: in Doconda, the same for everyone
                                  with the link (polls, team lists). With
                                  `retention: none`, only `local`.
                            required:
                              - storage
                          - type: 'null'
                        description: 'Artifacts only: where the page keeps its data.'
                      content_deleted_at:
                        anyOf:
                          - type: string
                            format: date-time
                            pattern: >-
                              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                          - type: 'null'
                        description: >-
                          When its content was deleted: its retention ended, or
                          it was deleted.
                      outputs:
                        description: Present once finished.
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              pattern: ^out_[0-9A-HJKMNP-TV-Z]{26}$
                            kind:
                              type: string
                              enum:
                                - docx
                                - pptx
                                - xlsx
                                - pdf
                                - preview
                                - html
                                - md
                            page:
                              type: integer
                              minimum: -9007199254740991
                              maximum: 9007199254740991
                            content_type:
                              type: string
                            bytes:
                              type: integer
                              minimum: -9007199254740991
                              maximum: 9007199254740991
                            width:
                              type: integer
                              minimum: -9007199254740991
                              maximum: 9007199254740991
                            height:
                              type: integer
                              minimum: -9007199254740991
                              maximum: 9007199254740991
                            url:
                              type: string
                              description: >-
                                Signed download URL, valid 5 minutes. For `html`
                                (an artifact), the link to the page, which works
                                until its retention ends or you delete it; with
                                `retention: none`, the page to download.
                            expires_at:
                              anyOf:
                                - type: string
                                  format: date-time
                                  pattern: >-
                                    ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                                - type: 'null'
                              description: >-
                                When `url` stops working; null for an artifact's
                                page, which works until the document's
                                `expires_at`.
                          required:
                            - id
                            - kind
                            - content_type
                            - bytes
                            - url
                            - expires_at
                      created_at:
                        type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                      completed_at:
                        anyOf:
                          - type: string
                            format: date-time
                            pattern: >-
                              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                          - type: 'null'
                    required:
                      - id
                      - object
                      - name
                      - operation
                      - format
                      - type
                      - mode
                      - revision
                      - status
                      - phase
                      - pages
                      - style_applied
                      - style_unsupported
                      - validation_summary
                      - repair_summary
                      - error
                      - versions
                      - metadata
                      - retention
                      - expires_at
                      - route
                      - quality
                      - artifact
                      - content_deleted_at
                      - created_at
                      - completed_at
                  - type: object
                    properties:
                      valid:
                        type: boolean
                      errors:
                        type: array
                        items:
                          type: object
                          properties:
                            path:
                              type: string
                            message:
                              type: string
                          required:
                            - path
                            - message
                    required:
                      - valid
                      - errors
            text/event-stream:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    pattern: ^evt_[0-9A-HJKMNP-TV-Z]{26}$
                    description: Unique; dedupe webhooks by it.
                  type:
                    type: string
                    examples:
                      - content.block_completed
                      - document.ready
                  version:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  document_id:
                    type: string
                    pattern: ^doc_[0-9A-HJKMNP-TV-Z]{26}$
                  sequence:
                    type: integer
                    minimum: 1
                    maximum: 9007199254740991
                    description: 1, 2, 3… per document. It is the SSE `id:`.
                  timestamp:
                    type: string
                    format: date-time
                    pattern: >-
                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                  display:
                    description: 'Short UI text per language, e.g. { es: ''Revisando…'' }.'
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties:
                      type: string
                  data:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties: {}
                required:
                  - id
                  - type
                  - version
                  - document_id
                  - sequence
                  - timestamp
                  - data
        '202':
          description: >-
            Background mode, or direct mode past 120 s: follow with GET
            /documents/{id}.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    pattern: ^doc_[0-9A-HJKMNP-TV-Z]{26}$
                  object:
                    type: string
                    const: document
                  name:
                    description: The name you gave it (`name` when creating it).
                    type:
                      - string
                      - 'null'
                  operation:
                    type: string
                    enum:
                      - create
                      - review
                      - edit
                  format:
                    anyOf:
                      - type: string
                        enum:
                          - docx
                          - pdf
                          - pptx
                          - xlsx
                          - artifact
                        description: >-
                          The file you want. `docx` → Word (with a PDF too),
                          `pdf` → only the PDF, `pptx` → PowerPoint (with a
                          PDF), `xlsx` → Excel (with a PDF). `artifact` → a web
                          page that keeps data (in each visitor's browser, or
                          shared by everyone), on a signed link; with
                          `retention: none`, a page to download (see the
                          artifacts guide). Without it, Doconda works it out
                          from `prompt`.
                      - type: 'null'
                  type:
                    anyOf:
                      - type: string
                        enum:
                          - report
                          - letter
                          - contract
                          - memo
                          - minutes
                          - presentation
                          - spreadsheet
                          - artifact
                        description: >-
                          What Doconda decided the document is. It sets the
                          default look (a contract: serif, justified, numbered
                          clauses; a letter: no page numbers). You don't choose
                          it: say what you want in `prompt`, and the look in
                          `style`.
                      - type: 'null'
                  mode:
                    anyOf:
                      - type: string
                        enum:
                          - prompt
                          - content
                      - type: 'null'
                  revision:
                    type: integer
                    minimum: 1
                    maximum: 9007199254740991
                    description: >-
                      1 when it's made; +1 every time its file is saved by hand
                      (PUT /documents/{id}/file). Send it back when saving so
                      nobody's changes are overwritten.
                  status:
                    type: string
                    enum:
                      - queued
                      - running
                      - ready
                      - ready_with_warnings
                      - needs_review
                      - failed
                      - canceled
                  phase:
                    type:
                      - string
                      - 'null'
                  pages:
                    anyOf:
                      - type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                      - type: 'null'
                  style_applied:
                    anyOf:
                      - type: object
                        properties:
                          font:
                            type: string
                          font_size:
                            type: number
                          line_spacing:
                            type: number
                          colors:
                            type: object
                            properties:
                              title:
                                type: string
                              headings:
                                type: string
                              text:
                                type: string
                              accent:
                                type: string
                            required:
                              - title
                              - headings
                              - text
                              - accent
                          align:
                            type: object
                            properties:
                              title:
                                type: string
                                enum:
                                  - left
                                  - center
                                  - right
                                  - justify
                              headings:
                                type: string
                                enum:
                                  - left
                                  - center
                                  - right
                                  - justify
                              body:
                                type: string
                                enum:
                                  - left
                                  - center
                                  - right
                                  - justify
                            required:
                              - title
                              - headings
                              - body
                          margins_cm:
                            type: number
                          orientation:
                            type: string
                            enum:
                              - portrait
                              - landscape
                          cover_page:
                            type: boolean
                          table_of_contents:
                            type: boolean
                          page_numbers:
                            type: boolean
                          header:
                            type: string
                          footer:
                            type: string
                        required:
                          - font
                          - font_size
                          - line_spacing
                          - colors
                          - align
                          - margins_cm
                          - orientation
                          - cover_page
                          - table_of_contents
                          - page_numbers
                      - type: 'null'
                  style_unsupported:
                    type: array
                    items:
                      type: string
                  validation_summary:
                    anyOf:
                      - type: object
                        properties:
                          errors:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          warnings:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          info:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                        required:
                          - errors
                          - warnings
                          - info
                      - type: 'null'
                  repair_summary:
                    anyOf:
                      - type: object
                        properties:
                          iterations:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          applied:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          rejected:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                        required:
                          - iterations
                          - applied
                          - rejected
                      - type: 'null'
                  error:
                    anyOf:
                      - type: object
                        properties:
                          code:
                            type: string
                          message:
                            type: string
                        required:
                          - code
                          - message
                      - type: 'null'
                  versions:
                    type: object
                    properties:
                      engine:
                        type: string
                      renderer:
                        type: string
                      model:
                        type:
                          - string
                          - 'null'
                  metadata:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties:
                      type: string
                  retention:
                    type: string
                    enum:
                      - none
                      - 1d
                      - 7d
                      - 30d
                      - 90d
                    description: >-
                      How long Doconda keeps a document's content (files,
                      request, report, events; an artifact's page and data) once
                      it finishes. `none`: 15 minutes. Then only what billing
                      needs stays (status, format, pages, cost).
                  expires_at:
                    anyOf:
                      - type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                      - type: 'null'
                    description: >-
                      When its content will be deleted: `retention` counted from
                      when it finished or was last saved by hand (with
                      `retention: none`, from when it finished).
                  route:
                    anyOf:
                      - type: object
                        properties:
                          path:
                            type: string
                            enum:
                              - fast
                              - agent
                          reason:
                            type: string
                        required:
                          - path
                          - reason
                        description: >-
                          How the file was made, and why. `fast`: in seconds,
                          with the basic style (`quality: "fast"`). `agent`: in
                          minutes, with any design, templates, comments, tracked
                          changes and charts (`standard` and `best`).
                      - type: 'null'
                  quality:
                    anyOf:
                      - type: object
                        properties:
                          requested:
                            type: string
                            enum:
                              - auto
                              - fast
                              - standard
                              - best
                            description: >-
                              `auto`: Doconda picks the level. From `prompt`,
                              the one the request needs (when in doubt, the
                              cheaper one); from `content` alone, `standard`;
                              `best` to copy a file's design (except a
                              PowerPoint template for a presentation), to use a
                              template with documents in `sources`, or for an
                              edit with comments or tracked changes.
                              `max_quality` caps it.
                          level:
                            anyOf:
                              - type: string
                                enum:
                                  - fast
                                  - standard
                                  - best
                                description: >-
                                  How much work goes into the file. `fast`:
                                  seconds, basic style (the `style` options),
                                  the cheapest. `standard`: a few minutes, any
                                  style, templates and charts. `best`: more
                                  review and design care, the dearest.
                              - type: 'null'
                            description: The level used (null until Doconda decides it).
                          reason:
                            type:
                              - string
                              - 'null'
                        required:
                          - requested
                          - level
                          - reason
                      - type: 'null'
                    description: >-
                      create and edit: the quality level asked for and the one
                      used, which sets the price.
                  artifact:
                    anyOf:
                      - type: object
                        properties:
                          storage:
                            type: string
                            enum:
                              - local
                              - shared
                            description: >-
                              Where an artifact's page keeps its data. `local`:
                              in each visitor's browser (each one sees only
                              theirs; nothing reaches Doconda). `shared`: in
                              Doconda, the same for everyone with the link
                              (polls, team lists). With `retention: none`, only
                              `local`.
                        required:
                          - storage
                      - type: 'null'
                    description: 'Artifacts only: where the page keeps its data.'
                  content_deleted_at:
                    anyOf:
                      - type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                      - type: 'null'
                    description: >-
                      When its content was deleted: its retention ended, or it
                      was deleted.
                  outputs:
                    description: Present once finished.
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          pattern: ^out_[0-9A-HJKMNP-TV-Z]{26}$
                        kind:
                          type: string
                          enum:
                            - docx
                            - pptx
                            - xlsx
                            - pdf
                            - preview
                            - html
                            - md
                        page:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        content_type:
                          type: string
                        bytes:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        width:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        height:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        url:
                          type: string
                          description: >-
                            Signed download URL, valid 5 minutes. For `html` (an
                            artifact), the link to the page, which works until
                            its retention ends or you delete it; with
                            `retention: none`, the page to download.
                        expires_at:
                          anyOf:
                            - type: string
                              format: date-time
                              pattern: >-
                                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                            - type: 'null'
                          description: >-
                            When `url` stops working; null for an artifact's
                            page, which works until the document's `expires_at`.
                      required:
                        - id
                        - kind
                        - content_type
                        - bytes
                        - url
                        - expires_at
                  created_at:
                    type: string
                    format: date-time
                    pattern: >-
                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                  completed_at:
                    anyOf:
                      - type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                      - type: 'null'
                required:
                  - id
                  - object
                  - name
                  - operation
                  - format
                  - type
                  - mode
                  - revision
                  - status
                  - phase
                  - pages
                  - style_applied
                  - style_unsupported
                  - validation_summary
                  - repair_summary
                  - error
                  - versions
                  - metadata
                  - retention
                  - expires_at
                  - route
                  - quality
                  - artifact
                  - content_deleted_at
                  - created_at
                  - completed_at
        '401':
          description: unauthorized (missing, unknown or revoked key; expired session).
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  title:
                    type: string
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  code:
                    type: string
                    description: >-
                      Stable machine code, e.g. input_invalid,
                      insufficient_balance.
                  request_id:
                    type: string
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        path:
                          type: string
                        message:
                          type: string
                      required:
                        - path
                        - message
                required:
                  - type
                  - title
                  - status
                  - code
                  - request_id
        '402':
          description: >-
            Balance too low for this document (insufficient_balance). Top up in
            the dashboard.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  title:
                    type: string
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  code:
                    type: string
                    description: >-
                      Stable machine code, e.g. input_invalid,
                      insufficient_balance.
                  request_id:
                    type: string
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        path:
                          type: string
                        message:
                          type: string
                      required:
                        - path
                        - message
                required:
                  - type
                  - title
                  - status
                  - code
                  - request_id
        '422':
          description: The request is not valid (input_invalid, idempotency_key_reused).
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  title:
                    type: string
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  code:
                    type: string
                    description: >-
                      Stable machine code, e.g. input_invalid,
                      insufficient_balance.
                  request_id:
                    type: string
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        path:
                          type: string
                        message:
                          type: string
                      required:
                        - path
                        - message
                required:
                  - type
                  - title
                  - status
                  - code
                  - request_id
        '501':
          description: A feature of a later milestone (feature_unavailable).
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  title:
                    type: string
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  code:
                    type: string
                    description: >-
                      Stable machine code, e.g. input_invalid,
                      insufficient_balance.
                  request_id:
                    type: string
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        path:
                          type: string
                        message:
                          type: string
                      required:
                        - path
                        - message
                required:
                  - type
                  - title
                  - status
                  - code
                  - request_id
      security:
        - apiKey: []
        - session: []
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: '`Authorization: Bearer ak_eu_…`, a key from the dashboard (API keys).'
    session:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Dashboard only: the Cognito ID token of the signed-in user.'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.