Search documentation
karat

+

K

User Documentation ↗
Version 2.0

Generate Template

POST/api/v2/notepad/templates/{templateRid}/generate
Warning

This endpoint is in preview and may be modified or removed at any time. To use this endpoint, add preview=true to the request query parameters.

Creates a new GenerationJob. The template generation job will produce new document content by applying template parameters to an existing template. If the GenerationJob succeeds, the resulting contents can be saved as a new Document or exported to a File.

The user must have the api scope to create GenerationJobs. Once created a GenerationJob is only accessible to the user that created it.

Third-party applications using this endpoint via OAuth2 must request the following operation scope: api:notepad-write.

Path parameters

templateRid
string

The unique identifier for a Template

Query parameters

preview
boolean
optional

Enables the use of preview functionality.

Request body

GenerateTemplateRequest
object
Hide child attributes

Hide child attributes

templateVersion
string
optional

The published version of the template to use. If not provided, the latest published version will be used.

templateParameters
map<TemplateParameterName, TemplateParameterValue>
optional

The parameters to apply to the template during generation.

Show child attributes

Show child attributes

Response body

GenerationJobRid
string

The unique identifier for a GenerationJob

Examples

Request

Copied!
1 2 3 4 5 curl -X POST \ \t-H "Content-type: application/json" \ \t-H "Authorization: Bearer $TOKEN" \ "https://$HOSTNAME/api/v2/notepad/templates/ri.notepad.main.notepad-template.bef90a51-d37d-4983-abde-56e5bd0fcf52/generate?preview=true" \ -d '{"templateParameters":{"customerName":{"type":"string","value":"John Doe"}},"templateVersion":42}'

Response

Copied!
1 ri.notepad.main.generation-job.ab12c039-353c-4555-9704-eacfdfaa2c1c

Error responses

Error Name
TemplateNotFoundError CodeNOT_FOUND
Status Code404
DescriptionThe requested template was not found.
ParameterstemplateRid
InvalidTimezoneError CodeINVALID_ARGUMENT
Status Code400
DescriptionThe provided timezone is not valid.
ParametersuserTimezone
InvalidGenerationJobTemplateVersionError CodeINVALID_ARGUMENT
Status Code400
DescriptionThe provided template version doesn't exist or the template has no published versions.
ParameterstemplateVersion
MissingGenerationJobTemplateParametersError CodeINVALID_ARGUMENT
Status Code400
DescriptionOne or more template parameters are missing.
ParameterstemplateParameterNames
InvalidGenerationJobTemplateParameterError CodeINVALID_ARGUMENT
Status Code400
DescriptionA template parameter value is invalid (for example, is of the wrong type).
ParameterstemplateParameterName, reason
GenerateTemplatePermissionDeniedError CodePERMISSION_DENIED
Status Code403
DescriptionCould not generate the Template.
ParameterstemplateRid