Create a collection template

posthttps://api.expiryedge.com/v1/createCollectionTemplate
editor or admin60/minIdempotency-KeyAny method
Request
curl -X POST 'https://api.expiryedge.com/v1/createCollectionTemplate' \
  -H "Authorization: Bearer $EXPIRYEDGE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "id": "tpl_W9onboard",
  "name": "New client onboarding - Northwind Dental",
  "description": "Documents we need before the first engagement.",
  "pages": [
    {
      "id": "p_company",
      "title": "Company details",
      "description_html": "<p>Tell us about your practice.</p>",
      "sections": [
        {
          "id": "s_basics",
          "title": "Basics",
          "fields": [
            {
              "id": "fld_company_name",
              "type": "short_text",
              "label": "Legal company name",
              "required": true
            },
            {
              "id": "fld_insurance",
              "type": "file_upload",
              "label": "Liability insurance certificate",
              "required": true,
              "allowed_types": [
                "pdf",
                "jpg",
                "png"
              ],
              "max_size_bytes": 26214400
            }
          ]
        }
      ]
    }
  ],
  "intro_email": {
    "body_html": "<p>Hi, please upload the documents below by Friday.</p>"
  }
}'
Response
{
  "message": "Template created",
  "template": {
    "id": "tpl_W9onboard",
    "organization_id": "org_northwind",
    "name": "New client onboarding - Northwind Dental",
    "description": "Documents we need before the first engagement.",
    "pages": [
      {
        "id": "p_company",
        "title": "Company details",
        "order": 0,
        "description_html": "<p>Tell us about your practice.</p>",
        "sections": [
          {
            "id": "s_basics",
            "title": "Basics",
            "order": 0,
            "description_html": "",
            "fields": [
              {
                "id": "fld_company_name",
                "type": "short_text",
                "label": "Legal company name",
                "required": true,
                "help_text": ""
              },
              {
                "id": "fld_entity",
                "type": "dropdown",
                "label": "Entity type",
                "required": true,
                "help_text": "",
                "options": [
                  "LLC",
                  "Corporation",
                  "Sole proprietor"
                ]
              },
              {
                "id": "fld_insurance",
                "type": "file_upload",
                "label": "Liability insurance certificate",
                "required": true,
                "help_text": "PDF or image, current policy year.",
                "allowed_types": [
                  "pdf",
                  "jpg",
                  "png"
                ],
                "max_size_bytes": 26214400,
                "reference_file": {
                  "storage_path": "organizations/org_northwind/collection-templates/tpl_W9onboard/fields/fld_insurance/reference-1b2c-sample.pdf",
                  "original_filename": "sample-certificate.pdf",
                  "content_type": "application/pdf",
                  "size_bytes": 120331
                }
              }
            ]
          }
        ]
      }
    ],
    "intro_email": {
      "body_html": "<p>Hi, please upload the documents below by Friday.</p>"
    },
    "schema_version": 2,
    "status": "active",
    "created_by": "u_71bXq",
    "created_by_name": "Priya Shah",
    "created_at": "2026-09-27T14:05:00.000Z",
    "updated_at": "2026-09-27T14:05:00.000Z"
  }
}

Counts against the collection_templates plan limit. Limits: 20 pages, 20 sections per page, 50 fields in total, 20KB of HTML per rich-text block. Pass an optional client-generated id to upload field reference files before the first save. The handler does not check the HTTP method.

Headers

  • Idempotency-Keystring
    Optional client-generated key (1-255 characters of letters, digits, - _ : .).
    pattern: ^[A-Za-z0-9_\-:.]{1,255}$

Body parameters

application/json
  • namestringrequired
    max length: 200
  • pagesarray of objectsrequired
    Max 50 fields across all pages.
    min items: 1 · max items: 20
  • idstring
    Optional client-chosen id for the new template (create only; 409 if it exists).
    pattern: ^[a-zA-Z0-9_-]+$
  • descriptionstring
    max length: 1000
  • intro_emailobject | null
    Custom introduction for the request email; null uses the default text.

Returns

201
Template created.
  • messagestringrequired
  • templateobjectrequired
    A Document Collection template (form definition).

Errors

400
The request is missing required fields or contains invalid values.
401
Missing, expired or invalid bearer token.
403
Your role does not allow this, the record belongs to another organization (Access denied), or the plan limit is reached (body adds current, limit, remaining).
404
The record does not exist or is not in your organization.
409
A template with the given id already exists.; or a request with the same Idempotency-Key is still being processed (code IDEMPOTENCY_IN_PROGRESS).
422
The Idempotency-Key was already used with a different request body.
429
Too many requests for this endpoint from your IP. Wait Retry-After seconds.