> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emtelligent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emtelligent.com/_mcp/server.

# Submit a job

POST https://formfill.emtelligent.com/v1/jobs
Content-Type: application/json

Queue a document for Questionnaire filling or question answering. Returns immediately; poll `GET /v1/jobs/{id}` or use `callback_url`.

Reference: https://docs.emtelligent.com/formfill/api/jobs/submit-job-v-1-jobs-post

## Authentication

- `Authorization` header (bearer token, required) — Customer API key or OAuth 2.0 access token (scope `formfill:process`)

## Request

### Headers

- `idempotency-key` (string, optional, nullable) — Optional, recommended: retrying with the same key and body returns the original job instead of a new one (per organization, 24 h). 1-128 of [A-Za-z0-9_.:-]

### Body (application/json)

This endpoint expects a JobRequest.

- `type` (enum, required) — `questionnaire`: fill a FHIR Questionnaire. `questions`: answer a list of free-form questions
  - Allowed values: `questionnaire`, `questions`
- `document` (DocumentIn, required)
- `questionnaire` (map from string to any, optional, nullable) — FHIR R4 Questionnaire resource (required for type `questionnaire`)
- `questions` (list of JobRequestQuestionsItems, optional, nullable) — Questions (required for type `questions`): bare strings or Question objects, at most 100
- `options` (OptionsIn, optional)
- `callback_url` (string, optional, nullable) — HTTPS URL to notify when the job finishes (see the `job.finished` webhook). Must resolve to public addresses only

## Response

### 200

Idempotent retry: the job already created with this Idempotency-Key

- `id` (string, required)
- `type` (enum, required)
  - Allowed values: `questionnaire`, `questions`
- `status` (enum, required) — `expired`: the result was downloaded or the 24-hour window passed
  - Allowed values: `queued`, `running`, `succeeded`, `failed`, `canceled`, `expired`
- `created_at` (string, required) — UTC, `YYYY-MM-DDTHH:MM:SSZ`
- `expires_at` (string, required) — When the job and any unread result are deleted
- `result_available` (boolean, required)
- `started_at` (string, optional, nullable)
- `completed_at` (string, optional, nullable)
- `error` (JobError, optional, nullable) — Present when `status` is `failed`
- `webhook` (WebhookInfo, optional, nullable) — Present when a `callback_url` was given

### 202

Accepted and queued

- `id` (string, required)
- `type` (enum, required)
  - Allowed values: `questionnaire`, `questions`
- `status` (enum, required) — `expired`: the result was downloaded or the 24-hour window passed
  - Allowed values: `queued`, `running`, `succeeded`, `failed`, `canceled`, `expired`
- `created_at` (string, required) — UTC, `YYYY-MM-DDTHH:MM:SSZ`
- `expires_at` (string, required) — When the job and any unread result are deleted
- `result_available` (boolean, required)
- `started_at` (string, optional, nullable)
- `completed_at` (string, optional, nullable)
- `error` (JobError, optional, nullable) — Present when `status` is `failed`
- `webhook` (WebhookInfo, optional, nullable) — Present when a `callback_url` was given

## Errors

### 400 Bad Request Error

Invalid document, Questionnaire, questions, JSON, Idempotency-Key or callback_url

- `error` (ErrorDetail, required)

### 401 Unauthorized Error

Missing, unknown or unscoped credentials

- `error` (ErrorDetail, required)

### 402 Payment Required Error

Organization suspended or out of credit

- `error` (ErrorDetail, required)

### 409 Conflict Error

Idempotency-Key reused with a different body

- `error` (ErrorDetail, required)

### 413 Content Too Large Error

Document, Questionnaire, questions or body too large

- `error` (ErrorDetail, required)

### 422 Unprocessable Entity Error

Wrong request shape; names the fields, never echoes values

- `error` (ErrorDetail, required)

### 429 Too Many Requests Error

Organization rate or active-job limit; see Retry-After

- `error` (ErrorDetail, required)

### 503 Service Unavailable Error

Temporarily unavailable

- `error` (ErrorDetail, required)

## Types

### DocumentIn

- `text` (string, required) — The clinical document as UTF-8 text, at most 64 KiB
- `category` (string, optional, nullable) — Document category, e.g. `Pathology`. Omit it to have the type detected automatically (recommended)
- `subcategory` (string, optional, nullable) — Document subcategory, e.g. `Surgical Pathology`. Omit it to have the type detected automatically (recommended)

### JobRequestQuestionsItems

- string
- Question: Question

### OptionsIn

- `clinical_context` (boolean, optional, default: true) — Take clinical context into account when answering: negation, uncertainty and history (recommended)

### JobError

- `code` (string, required) — Why the job failed, e.g. `insufficient_credit`

### WebhookInfo

- `status` (enum, required)
  - Allowed values: `pending`, `delivered`, `failing`, `gave_up`
- `attempts` (integer, required)

### ErrorDetail

- `code` (string, required) — Stable machine-readable code, e.g. `invalid_credentials`
- `message` (string, required) — Human-readable summary. Never echoes submitted content
- `request_id` (string, required) — Quote this to support; also in `X-Request-Id`

### Question

- `text` (string, required)
- `id` (string, optional, nullable)
- `type` (enum, optional, default: text)
  - Allowed values: `text`, `number`, `boolean`, `date`, `choice`
- `options` (list of string, optional, nullable)
- `multiple` (boolean, optional, default: false)

## Examples

### Example 1

**Request**

```json
{
  "type": "questionnaire",
  "document": {
    "text": "string"
  }
}
```

**Response**

```json
{
  "id": "job_8f2c1d0e9b7a6c5d4e3f2a1b",
  "type": "questionnaire",
  "status": "queued",
  "created_at": "string",
  "expires_at": "string",
  "result_available": true,
  "started_at": "string",
  "completed_at": "string",
  "error": {
    "code": "string"
  },
  "webhook": {
    "status": "pending",
    "attempts": 1
  }
}
```

**SDK Code**

```python
import requests

url = "https://formfill.emtelligent.com/v1/jobs"

payload = {
    "type": "questionnaire",
    "document": { "text": "string" }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://formfill.emtelligent.com/v1/jobs';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"type":"questionnaire","document":{"text":"string"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://formfill.emtelligent.com/v1/jobs"

	payload := strings.NewReader("{\n  \"type\": \"questionnaire\",\n  \"document\": {\n    \"text\": \"string\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://formfill.emtelligent.com/v1/jobs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"type\": \"questionnaire\",\n  \"document\": {\n    \"text\": \"string\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://formfill.emtelligent.com/v1/jobs")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"questionnaire\",\n  \"document\": {\n    \"text\": \"string\"\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://formfill.emtelligent.com/v1/jobs', [
  'body' => '{
  "type": "questionnaire",
  "document": {
    "text": "string"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://formfill.emtelligent.com/v1/jobs");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"questionnaire\",\n  \"document\": {\n    \"text\": \"string\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "questionnaire",
  "document": ["text": "string"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://formfill.emtelligent.com/v1/jobs")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Example 2

**Request**

```json
{
  "type": "questionnaire",
  "document": {
    "text": "string"
  }
}
```

**Response**

```json
{
  "id": "job_8f2c1d0e9b7a6c5d4e3f2a1b",
  "type": "questionnaire",
  "status": "queued",
  "created_at": "string",
  "expires_at": "string",
  "result_available": true,
  "started_at": "string",
  "completed_at": "string",
  "error": {
    "code": "string"
  },
  "webhook": {
    "status": "pending",
    "attempts": 1
  }
}
```

**SDK Code**

```python
import requests

url = "https://formfill.emtelligent.com/v1/jobs"

payload = {
    "type": "questionnaire",
    "document": { "text": "string" }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://formfill.emtelligent.com/v1/jobs';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"type":"questionnaire","document":{"text":"string"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://formfill.emtelligent.com/v1/jobs"

	payload := strings.NewReader("{\n  \"type\": \"questionnaire\",\n  \"document\": {\n    \"text\": \"string\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://formfill.emtelligent.com/v1/jobs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"type\": \"questionnaire\",\n  \"document\": {\n    \"text\": \"string\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://formfill.emtelligent.com/v1/jobs")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"questionnaire\",\n  \"document\": {\n    \"text\": \"string\"\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://formfill.emtelligent.com/v1/jobs', [
  'body' => '{
  "type": "questionnaire",
  "document": {
    "text": "string"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://formfill.emtelligent.com/v1/jobs");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"questionnaire\",\n  \"document\": {\n    \"text\": \"string\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "questionnaire",
  "document": ["text": "string"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://formfill.emtelligent.com/v1/jobs")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```