# Get Word fill job

Check a Word-template job. A completed job includes the generated document and warnings; a failed job includes its reason.

POST https://api.brigg.app/v1/operations/documents.GetWordFillJob

## Access & visibility

Allow `documents.GetWordFillJob` on your API key.

**Acting member required.** Send `Brigg-Act-As` with an [approved member account ID](https://developer.brigg.app/authentication#member-delegation). The key supplies permissions; the member selects whose data is used.

The selected member must be active and approved by the credential. This selects whose private data is used; the credential supplies permissions. Private ownership and project boundaries still apply.

[Set up authentication](https://developer.brigg.app/authentication) · [Choose permissions](https://developer.brigg.app/permissions)

## Request fields

Send a JSON object with the following fields. Required fields must be included; omit optional fields you do not need.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `job_id` | string | Yes | Exact job_id returned by FillWordTemplate. Use the same approved member; another member's job is not visible. At least 1 character. |

## Start, poll, then download

Choose a Word template from [List templates](https://developer.brigg.app/reference/workspace/ListTemplates): it must retain its original .docx. Supply a visible meeting_id, non-blank context, or both to [Fill Word template](https://developer.brigg.app/reference/documents/FillWordTemplate). Starting a job uses workspace credit; the start response is not the generated document.

Keep job_id and use [Get Word fill job](https://developer.brigg.app/reference/documents/GetWordFillJob) under the same approved member. While status is pending, wait before polling again and honor Retry-After on rate limits. On done, review warnings and pass result.file_id to [Get file download](https://developer.brigg.app/reference/documents/GetFileDownload). The resulting .docx belongs to that member. On failed, stop polling and review error; the result is not available. A cancelled job also reports failed.

Repeating a start for the same member and template while matching work is in progress can return its job_id with deduped=true. Reuse the original idempotency key to recover a lost start response. After failure, a deliberate new attempt uses a new key and may consume more credit.

## Response

Returns **200 OK** with a JSON body.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | string | Yes | pending means work is still queued or running; done supplies result; failed supplies error and is terminal. A cancelled job is reported as failed. |
| `result` | [object](#response-result) | No | Present only after successful completion. Use its file_id for download and inspect warnings before relying on the document. |
| `error` | string | No | Terminal failure reason. Stop polling, inspect the cause and decide whether to start a new attempt. It is not an HTTP transport error. |

### response.result

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `file_id` | string | Yes | Generated .docx file belonging to the member who started the fill. Pass it to GetFileDownload with the same member delegation. |
| `filename` | string | Yes | Original filename, including its extension. |
| `warnings` | array of string | Yes | Issues reported while generating the document; review the output before using it. |

## Errors & retries

This operation reads data. It needs no idempotency key and can be retried after a transient failure.

For rate limits, follow the server’s retry guidance and back off. See [HTTP errors](https://developer.brigg.app/http#errors) and [safe retries and limits](https://developer.brigg.app/reliability).

| HTTP status | Code | What to do |
| --- | --- | --- |
| 400 | `invalid_json` | Send a JSON object with Content-Type: application/json. |
| 400 | `invalid_input` | Check the request fields and types. |
| 401 | `invalid_key` | The workspace API key is missing, invalid or revoked. |
| 403 | `forbidden` | Check the key’s operation and resource grants. Supply Brigg-Act-As with a member authorized by the key’s delegation grant. The selected member must be active and approved by the credential. This selects whose private data is used; the credential supplies permissions. Private ownership and project boundaries still apply. |
| 404 | `not_found` | The Word job is missing, of another kind, or belongs to another member. Use its original job_id and approved member. |
| 429 | `rate_limited` | Wait for Retry-After before retrying. |
| 409 | `result_unavailable` | The completed job's file is no longer accessible. Review it in Brigg rather than interpreting this as pending. |

## Next steps

- [List templates](https://developer.brigg.app/reference/workspace/ListTemplates)
- [Fill Word template](https://developer.brigg.app/reference/documents/FillWordTemplate)
- [Get file download](https://developer.brigg.app/reference/documents/GetFileDownload)

[Download OpenAPI](https://developer.brigg.app/openapi.json) · [Versioning & retirement](https://developer.brigg.app/versioning)

## Examples

### Generation is still running

HTTP 200 confirms the status read, not completion.
#### cURL


```sh
curl 'https://api.brigg.app/v1/operations/documents.GetWordFillJob' \
  -H "Authorization: Bearer $BRIGG_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Brigg-Act-As: $BRIGG_ACT_AS" \
  --data-raw '{
  "job_id": "job_proposal"
}'
```

#### TypeScript


```typescript
const actAs = process.env.BRIGG_ACT_AS;
if (!actAs) throw new Error("Set BRIGG_ACT_AS to an approved member account ID.");

const response = await fetch("https://api.brigg.app/v1/operations/documents.GetWordFillJob", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
    "Content-Type": "application/json",
    "Brigg-Act-As": actAs,
  },
  body: JSON.stringify({
    "job_id": "job_proposal"
  }),
});
const result = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${result.error} — ${result.message}`);
console.log(result);
```

#### Python


```python
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError

payload = {
  "job_id": "job_proposal"
}
request = Request(
    "https://api.brigg.app/v1/operations/documents.GetWordFillJob",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['BRIGG_API_KEY']}",
        "Content-Type": "application/json",
        "Brigg-Act-As": os.environ["BRIGG_ACT_AS"],
    },
    method="POST",
)
try:
    with urlopen(request) as response:
        print(json.load(response))
except HTTPError as error:
    print(error.code, json.load(error))
    raise
```

#### Response example


```json
{
  "status": "pending"
}
```

### Download the generated document

Inspect warnings, then use the returned file ID for download.
#### cURL


```sh
curl 'https://api.brigg.app/v1/operations/documents.GetWordFillJob' \
  -H "Authorization: Bearer $BRIGG_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Brigg-Act-As: $BRIGG_ACT_AS" \
  --data-raw '{
  "job_id": "job_proposal"
}'
```

#### TypeScript


```typescript
const actAs = process.env.BRIGG_ACT_AS;
if (!actAs) throw new Error("Set BRIGG_ACT_AS to an approved member account ID.");

const response = await fetch("https://api.brigg.app/v1/operations/documents.GetWordFillJob", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
    "Content-Type": "application/json",
    "Brigg-Act-As": actAs,
  },
  body: JSON.stringify({
    "job_id": "job_proposal"
  }),
});
const result = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${result.error} — ${result.message}`);
console.log(result);
```

#### Python


```python
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError

payload = {
  "job_id": "job_proposal"
}
request = Request(
    "https://api.brigg.app/v1/operations/documents.GetWordFillJob",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['BRIGG_API_KEY']}",
        "Content-Type": "application/json",
        "Brigg-Act-As": os.environ["BRIGG_ACT_AS"],
    },
    method="POST",
)
try:
    with urlopen(request) as response:
        print(json.load(response))
except HTTPError as error:
    print(error.code, json.load(error))
    raise
```

#### Response example


```json
{
  "status": "done",
  "result": {
    "file_id": "f_proposal",
    "filename": "Proposal.docx",
    "warnings": []
  }
}
```

### Generation stopped

Stop polling this job. A deliberate new attempt is a separate action.
#### cURL


```sh
curl 'https://api.brigg.app/v1/operations/documents.GetWordFillJob' \
  -H "Authorization: Bearer $BRIGG_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Brigg-Act-As: $BRIGG_ACT_AS" \
  --data-raw '{
  "job_id": "job_proposal"
}'
```

#### TypeScript


```typescript
const actAs = process.env.BRIGG_ACT_AS;
if (!actAs) throw new Error("Set BRIGG_ACT_AS to an approved member account ID.");

const response = await fetch("https://api.brigg.app/v1/operations/documents.GetWordFillJob", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
    "Content-Type": "application/json",
    "Brigg-Act-As": actAs,
  },
  body: JSON.stringify({
    "job_id": "job_proposal"
  }),
});
const result = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${result.error} — ${result.message}`);
console.log(result);
```

#### Python


```python
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError

payload = {
  "job_id": "job_proposal"
}
request = Request(
    "https://api.brigg.app/v1/operations/documents.GetWordFillJob",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['BRIGG_API_KEY']}",
        "Content-Type": "application/json",
        "Brigg-Act-As": os.environ["BRIGG_ACT_AS"],
    },
    method="POST",
)
try:
    with urlopen(request) as response:
        print(json.load(response))
except HTTPError as error:
    print(error.code, json.load(error))
    raise
```

#### Response example


```json
{
  "status": "failed",
  "error": "wordfill_failed"
}
```

## JSON schemas


```json-schema-request
{
  "type": "object",
  "properties": {
    "job_id": {
      "type": "string",
      "minLength": 1,
      "description": "Exact job_id returned by FillWordTemplate. Use the same approved member; another member's job is not visible."
    }
  },
  "required": [
    "job_id"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "job_id": "job_proposal"
    }
  ]
}
```


```json-schema-response
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "pending means work is still queued or running; done supplies result; failed supplies error and is terminal. A cancelled job is reported as failed."
    },
    "result": {
      "type": "object",
      "properties": {
        "file_id": {
          "type": "string",
          "description": "Generated .docx file belonging to the member who started the fill. Pass it to GetFileDownload with the same member delegation."
        },
        "filename": {
          "type": "string",
          "description": "Original filename, including its extension."
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Issues reported while generating the document; review the output before using it."
        }
      },
      "required": [
        "file_id",
        "filename",
        "warnings"
      ],
      "additionalProperties": false,
      "description": "Present only after successful completion. Use its file_id for download and inspect warnings before relying on the document."
    },
    "error": {
      "type": "string",
      "description": "Terminal failure reason. Stop polling, inspect the cause and decide whether to start a new attempt. It is not an HTTP transport error."
    }
  },
  "required": [
    "status"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "status": "pending"
    }
  ]
}
```

