POST
Create an audit template

Authorizations

Authorization
string
header
required

Obtain a token via POST /api/v1/oauth/token (password grant) and send it as Authorization: Bearer <token>.

Path Parameters

database
string
required

Project identifier (each project has its own database). Obtain it from GET /api/v2/data/projects.

Body

application/json
name
string
required

The template's name, as shown in the app.

groupId
string
required

The template group this template belongs to — the group document's bare CouchDB id, not the composite {database}|{couchDbId} the group list returns.

Mandatory, and it must name an existing, non-deleted template group in the same project. The Ed Controls editor refuses to save a template with no group, so a template created without one is readable here and impossible to edit in the app.

isPublished
boolean
default:false

Only a published template can be used to create audits. Publish later with PATCH { "isPublished": true } if you would rather build the template first.

auditType
string
default:area

area or object. Left open rather than enumerated: point also appears in stored data, and no two components of the platform agree on the full set.

tags
string[]
answeredStatusEnabled
boolean
questions
object[]

The question tree, exactly two levels deep: this array holds categories, and each category holds questions. There is no recursion, and a bare question at this level is rejected.

May be empty — a template with no questions is valid, and you can add them with PATCH later.

_attachments
object

CouchDB inline attachments, keyed by file name, each { "content_type": "...", "data": "<base64>" }.

This is where images used by questions live. Template images do not go through Filestack or the attachment service — the question refers to them by file name and the bytes sit on the document.

Response

The created audit template document.

_id
string
_rev
string
name
string
groupId
string

The template group, as the group document's bare CouchDB id. Mandatory on create, and a template can never be left ungrouped.

group
string

The group's display name. Derived from groupId and ignored if you send it, so the two cannot disagree — the app reads this field rather than looking the group up.

project
string

The project database.

isPublished
boolean

Whether the template is released for use. Unpublished templates can still be used to create audits; only archived or deleted ones are refused.

archived
string

Set when the template is archived. Absent means active.

auditType
string
answeredStatusEnabled
boolean
tags
string[]
dates
object
author
object
lastmodifier
object
versionInfo
object

The app's version history for this template.

_attachments
object

CouchDB inline attachments, keyed by file name — where images used by questions live. Always present, even when empty.

questions
object[]

The question tree, exactly two levels deep: categories, each holding questions.