Skip to main content

Create Session

Endpoint

POST /v1/session

Description

This endpoint enables the creation of a session for autofilling a PDF form. The request body should be in JSON format and must include the form_id, sources (a list of URLs pointing to the sources of the instructions), and optionally instructions. Upon successful submission, the response will contain details of the created session, including its ID, creation timestamp, and session ID. After the initial call, users must call the GET endpoint repeatedly until they receive a status update about the completion of the session.

Request

Headers

  • Content-Type: application/json

Body

The request body should contain a JSON object with the following fields:

  • form_id (string): The unique identifier of the form.
  • sources (array of strings): A list of URLs pointing to the sources of the instructions.
  • instructions (string, optional): Custom instructions in text format.

Example

{
"form_id": "w9-2024",
"sources": [
"https://example.com/instructions.txt",
"https://example.com/additional-instructions.txt"
],
"instructions": "YOUR_CUSTOM_INSTRUCTIONS_HERE"
}

Success Response

  • Code: 200 OK
  • Content:
{
"id": "cs_44cfe04df1114b6c81326fe61951b81d",
"created": "2024-06-17T10:17:22.848106Z",
"object": "session",
"session_id": "66700d319ad27d71fa6cbd8d"
}

Error Responses

  • Code: 500 Internal Server Error
  • Content:
{
"id": "error_7d7f52761e134352addbd1b406a15ba0",
"created": "2024-06-19T13:41:47.4991643Z",
"object": "error",
"error_message": "Error when creating form."
}