Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.docinject.com/llms.txt

Use this file to discover all available pages before exploring further.

DocInject can render any published or draft document as a formatted Word document (.docx) or as plain Markdown. Word exports use a template you upload to control the visual styling — your branding, fonts, and layout are applied automatically. Markdown exports return a clean text representation of the document hierarchy.

Export as Word (.docx)

GET https://api.docinject.io/api/v1/documents/{doc_id}/export?template_id={template_id}
Renders the document using the specified Word template and returns a binary .docx file. The response includes a Content-Disposition header with the filename. You must supply a template_id. Retrieve available template IDs from the List templates endpoint.

Path parameters

doc_id
string
required
The ID of the document to export.

Query parameters

template_id
string
required
The ID of the Word template to use for rendering. Get available IDs from GET /templates.

Example request

curl "https://api.docinject.io/api/v1/documents/doc_01hxyz1a2b3c4d5e6f7g8h9j/export?template_id=tmpl_01habcdefghijklmnopqrstu" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o "incident-response-playbook.docx"

Response

Returns 200 OK with the binary .docx content.
HeaderValue
Content-Typeapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Dispositionattachment; filename="<document-title>.docx"
Returns 400 Bad Request if template_id is missing, or 404 Not Found if the document or template does not exist.

Export as Markdown

GET https://api.docinject.io/api/v1/documents/{doc_id}/export/markdown
Exports the document as plain Markdown. The document title becomes an h1, sections become h2, steps become h3, and sub-steps become h4. Node content is converted from the rich text format to plain text paragraphs and bullet lists.

Path parameters

doc_id
string
required
The ID of the document to export.

Example request

curl "https://api.docinject.io/api/v1/documents/doc_01hxyz1a2b3c4d5e6f7g8h9j/export/markdown" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o "incident-response-playbook.md"

Response

Returns 200 OK with the Markdown content as plain text.
HeaderValue
Content-Typetext/markdown
Content-Dispositionattachment; filename="<document-title>.md"
Example output:
# Incident Response Playbook
Version 1.0  Engineering

## Detection and Triage

### Acknowledge the alert
Check the alerting system and confirm the incident is real before escalating.

### Assign an incident commander
The on-call engineer should claim the incident in the incident management tool.

## Containment

### Isolate affected systems
Remove affected hosts from the load balancer and revoke any compromised credentials.

List templates

GET https://api.docinject.io/api/v1/templates
Returns all Word export templates available to your organization.

Example request

curl "https://api.docinject.io/api/v1/templates" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

Returns 200 OK with an array of template objects.
id
string
required
Unique template identifier. Use this as template_id in the export endpoint.
organization_id
string
required
ID of the organization that owns this template.
created_by
string
required
User ID of the member who uploaded the template.
name
string
required
Display name for the template.
tab_width
number
required
Indentation width in inches used for nested content inside the template.
created_at
string
required
ISO 8601 timestamp of when the template was uploaded.
updated_at
string
required
ISO 8601 timestamp of the last update.
200
[
  {
    "id": "tmpl_01habcdefghijklmnopqrstu",
    "organization_id": "org_01habcdefghijklmnopqrstu",
    "created_by": "usr_01ha1b2c3d4e5f6g7h8i9j0k",
    "name": "Acme Standard SOP",
    "tab_width": 0.5,
    "created_at": "2025-03-15T10:00:00.000Z",
    "updated_at": "2025-03-15T10:00:00.000Z"
  },
  {
    "id": "tmpl_01hbcdefghijklmnopqrstuv",
    "organization_id": "org_01habcdefghijklmnopqrstu",
    "created_by": "usr_01ha1b2c3d4e5f6g7h8i9j0k",
    "name": "Compact Playbook",
    "tab_width": 0.25,
    "created_at": "2025-04-01T09:30:00.000Z",
    "updated_at": "2025-04-01T09:30:00.000Z"
  }
]

Upload a template

POST https://api.docinject.io/api/v1/templates
Uploads a new Word template (.docx) to your organization. The template controls the visual styling of exported documents — formatting, branding, and layout are derived from the uploaded file. Only .docx files are accepted. Send the request as multipart/form-data.

Request body

name
string
required
A display name for the template, for example "Q3 Brand Template".
file
file
required
The .docx template file. Must be a valid Word document.
tab_width
number
default:"0.5"
Indentation width in inches for nested content within the exported document. Defaults to 0.5.

Example request

curl -X POST "https://api.docinject.io/api/v1/templates" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "name=Acme Standard SOP" \
  -F "file=@./acme-template.docx" \
  -F "tab_width=0.5"

Response

Returns 201 Created with the new template object.
201
{
  "id": "tmpl_01hzef3g4h5j6k7l8m9n0p1q",
  "organization_id": "org_01habcdefghijklmnopqrstu",
  "created_by": "usr_01ha1b2c3d4e5f6g7h8i9j0k",
  "name": "Acme Standard SOP",
  "tab_width": 0.5,
  "created_at": "2025-05-24T17:00:00.000Z",
  "updated_at": "2025-05-24T17:00:00.000Z"
}
Returns 400 Bad Request if name or file is missing, or if the uploaded file is not a .docx.

Delete a template

DELETE https://api.docinject.io/api/v1/templates/{template_id}
Permanently deletes a template. Only the template creator or an organization admin can delete a template.

Path parameters

template_id
string
required
The ID of the template to delete.

Example request

curl
curl -X DELETE "https://api.docinject.io/api/v1/templates/tmpl_01habcdefghijklmnopqrstu" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

Returns 204 No Content on success. Returns 403 Forbidden if you are not the template creator or an organization admin, or 404 Not Found if the template does not exist.