Skip to main content

Create Form

Endpoint

POST /v1/forms

Description

This endpoint allows the creation of a PDF form. The form data can be provided either as a JSON object containing a URL to the form or as an octet-stream (e.g., a PDF file). Upon successful creation, the response body contains details of the created form, including its ID, creation timestamp, and the form data.

Request

Headers

  • Content-Type: application/json or application/octet-stream

Body

Depending on the Content-Type:

application/json

When Content-Type is application/json, the request body should contain a JSON object with the following field:

  • form_url: A string containing the URL to the form.

Example:

{
"form_url": "https://example.com/file.pdf"
}

application/octet-stream

When Content-Type is application/octet-stream, the request body should contain the binary data of the form file (e.g., a PDF file):

<binary data of the PDF file>

Responses

Success Response

  • Code: 200 OK
  • Content:
{
"id": "cf_891eb111b3a146cbb89516e1bfa2012f",
"created": "2024-06-19T13:34:46.9393562Z",
"object": "create_form",
"form": {
"as_text": "FORM_CONTENT_HERE",
"fields": [
{
"id": "c3bf",
"name": "Name",
"form_name": "topmostSubform[0].Page1[0].f1_01[0]",
"form_type": "Text"
},
{
"id": "fac0",
"name": "Surname",
"form_name": "topmostSubform[0].Page1[0].f1_02[0]",
"form_type": "Text"
},
//so on
],
"form_url": "https://example.com/file.pdf",
"id": "example-id"
}
}

Error Responses

  • Code: 415 Unsupported Content Type
  • Content:
{
"id": "error_6b63acaf4baf4d179b33ebe580571c0a",
"created": "2024-06-19T13:45:08.4531108Z",
"object": "error",
"error_message": "Unsupported content type"
}