Imports

Answer an import's questions

Each answer is one of the question's own option values, and a path only with field or field_with_default. Nothing else is accepted. A question left out takes its recommended option, recorded as answered_by: "auto". Answers can be given once: a second call is 409 conflict with details.code: "import_already_answered".

post/v1/imports/{id}/answers

Request

  • Base URL: https://api.galleyrender.com
  • URL: https://api.galleyrender.com/v1/imports/{id}/answers
  • Auth: HTTP bearer

Path parameters

idstring required
Example:imp_4tq8m2x7k1bv

The import id returned by POST /v1/imports.

Request body

answered_by'agent' | 'user'

Recorded per answer, unless the answer names its own. Say agent when a program chose the answer itself.

Response

Accepted; the import moves on to synthesis.

object'import' required
idstring required
status'awaiting_upload' | 'uploaded' | 'reading' | 'analysing' | 'awaiting_answers' | 'answered' | 'synthesising' | 'checking' | 'ready' | 'saved' | 'failed' | 'refused' required

awaiting_upload waits for a file at the upload link. awaiting_answers waits for you. ready is the moment to look at the preview; nothing is a template until saved. failed and refused are final and are not counted against the plan.

kind'pdf' | 'null' nullable

The file type. PDF only for now.

pagesinteger nullable
bytesinteger nullable
document_kindstring nullable

What the analysis took the document to be: invoice, letter, other, and so on.

closest_starterstring nullable

The starter template whose data contract the draft borrows, when one fits. See the docs for what that promises.

languagestring nullable

The document's language, a BCP 47 tag.

delayed_untilstring date-time nullable

When an import waiting to start will be picked up, if the service's daily capacity is used. null when nothing holds it.

notesstring[] required

Things worth knowing, in plain sentences: a font that was substituted, a question that took its recommendation.

preview_urlstring uri nullable

A PDF of the draft rendered from its example, signed for 15 minutes. null until ready.

preview_png_urlstring uri nullable

Page 1 of the preview as a PNG at 1x, signed for 15 minutes, for a client that shows an image rather than a PDF. null until ready, and when none was stored.

preview_expires_atstring date-time nullable
existingtrue

Present, and true, only when this is an earlier import returned for the same bytes.

created_atstring date-time required
completed_atstring date-time nullable
expires_atstring date-time nullable

When the source and its page images are deleted: 7 days after the import finished.

Example response

{
  "id": "imp_4tq8m2x7k1bv",
  "document_kind": "invoice",
  "closest_starter": "invoice",
  "language": "en",
  "questions": [
    {
      "id": "q1",
      "prompt": "Is this paragraph printed the same on every document, or does it change?",
      "options": [
        {
          "value": "field_with_default"
        }
      ]
    }
  ],
  "fonts_substituted": [
    {
      "from": "Helvetica",
      "to": "public-sans"
    }
  ],
  "draft_summary": {
    "fields": [
      "buyer.name",
      "invoice_number",
      "line_items[]"
    ]
  },
  "template": {
    "ref": "ashcroft-invoice@1"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.