Skip to content
FacilydevelopersDashboard
Build with Facily
DocsREST APIsGenerate Document
Search the full API reference Esc to close

Generate Document

Documents · REST API reference

Get support
POST/v1/facilities/{facility_id}/documents/generate
On-demand document generation (communications-documents-settings design 4.1).

Authentication

Bearer API key or Facily session, subject to permissions and facility scope.

Authentication and scope

Request example

Replace bracketed path values with real IDs from your environment. The body, where shown, is generated from the schema and uses illustrative values.

cURL
curl --request POST \
  --url 'https://api.staging.facily.ai/v1/facilities/<FACILITY_ID>/documents/generate' \
  --header "Authorization: Bearer $FACILY_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "document_type": "string",
  "format": "pdf",
  "lease_id": "00000000-0000-4000-8000-000000000001",
  "params": {},
  "tenant_id": "00000000-0000-4000-8000-000000000001"
}'
An example for building your request, not an executed call. Check required fields, allowed values, and environment configuration before sending.

Parameters

facility_idpath · stringrequired

Format: uuid

Request body

application/json · Required

document_typestringrequired

Max length: 50

formatstring

Default: "pdf"

lease_idstring | null

Format: uuid

Show lease_id schema
string | null
Variant 1: string
string
Variant 2: null
null
paramsobject
tenant_idstring | null

Format: uuid

Show tenant_id schema
string | null
Variant 1: string
string
Variant 2: null
null

Responses

Expand a status to inspect its schema. Generated examples show structure and synthetic values.

201Successful Response
JSON · generated example
{
  "data": {
    "created_at": "2026-10-29T12:00:00Z",
    "document_type": "string",
    "documentable_id": "00000000-0000-4000-8000-000000000001",
    "documentable_type": "string",
    "facility_id": "00000000-0000-4000-8000-000000000001",
    "format": "string",
    "id": "00000000-0000-4000-8000-000000000001",
    "mime_type": "string",
    "origin": "string",
    "updated_at": "2026-10-29T12:00:00Z",
    "file_size_bytes": 0,
    "generated_at": "2026-10-29T12:00:00Z"
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

dataDocumentResponserequired

Document metadata. Excludes raw S3 key/bucket; downloads use the /download endpoint, which returns a presigned URL.

Show data schema
created_atstringrequired

When the document record was created.

Format: date-time

document_typestringrequired

What the document is, for example a signed lease, an invoice, or an insurance certificate.

documentable_idstringrequired

Identifier of the record named by documentable_type.

Format: uuid

documentable_typestringrequired

The kind of record the document is attached to, for example a lease or a tenant.

facility_idstringrequired

The facility this document belongs to.

Format: uuid

file_size_bytesinteger | null

Size of the stored file in bytes.

Show file_size_bytes schema
integer | null

Size of the stored file in bytes.

Variant 1: integer
integer
Variant 2: null
null
formatstringrequired

Document format. Generated documents are PDF.

generated_atstring | null

When a generated document was rendered. On an imported document, the date the previous system recorded for it.

Format: date-time

Show generated_at schema
string | null

When a generated document was rendered. On an imported document, the date the previous system recorded for it.

Variant 1: string
string
Variant 2: null
null
idstringrequired

Unique identifier for this document.

Format: uuid

mime_typestringrequired

MIME type of the stored file.

originstringrequired

uploaded when a person uploaded the file, generated when a system produced it. Generated covers documents this platform rendered and documents carried over from a previous system by a data import; only the first kind has a template_version.

template_versionstring | null

Version of the template a generated document was rendered from, so an old document stays reproducible after the template changes. Null on an upload and on a document carried over by a data import.

Show template_version schema
string | null

Version of the template a generated document was rendered from, so an old document stays reproducible after the template changes. Null on an upload and on a document carried over by a data import.

Variant 1: string
string
Variant 2: null
null
titlestring | null

Display title of the document.

Show title schema
string | null

Display title of the document.

Variant 1: string
string
Variant 2: null
null
updated_atstringrequired

When the document record was last modified.

Format: date-time

uploaded_bystring | null

The user who uploaded the document, where a person did.

Format: uuid

Show uploaded_by schema
string | null

The user who uploaded the document, where a person did.

Variant 1: string
string
Variant 2: null
null
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
400Validation error
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
401Unauthenticated
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
403Permission denied
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
404Not found
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
409Business logic error
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
503Temporary failure
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
Continue exploringAll documents operations
Build something that works beautifully.

Facily API · Contract v1.200 · Reviewed October 29, 2026

Generate Document | Facily Developers