Search documentation
karat

+

K

User Documentation ↗
Version 2.0

Save Document Generation Job

POST/api/v2/notepad/templates/{templateRid}/generationJobs/{generationJobRid}/saveDocument
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.

Save generated content as a new notepad document. This is only possible if the GenerationJob succeeded.

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

generationJobRid
string

The unique identifier for a GenerationJob

Query parameters

preview
boolean
optional

Enables the use of preview functionality.

Request body

SaveDocumentGenerationJobRequest
object
Hide child attributes

Hide child attributes

documentName
string
optional

The name of the document to save. If not provided, a name will be generated.

parentFolderRid
string

The parent folder to save the document in.

Response body

SaveDocumentResponse
object

Response for saving a document

Hide child attributes

Hide child attributes

documentRid
string

The RID of the newly created document

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/generationJobs/ri.notepad.main.generation-job.ab12c039-353c-4555-9704-eacfdfaa2c1c/saveDocument?preview=true" \ -d '{"parentFolderRid":"ri.compass.main.folder.c410f510-2937-420e-8ea3-8c9bcb3c1791"}'

Response

Copied!
1 2 3 { "documentRid": "ri.notepad.main.notepad.ef32c039-353c-4555-9704-eacfdfaa2c1c" }

Error responses

Error Name
GenerationJobStatusFailedError CodeFAILED_PRECONDITION
Status Code500
DescriptionThe operation cannot be completed because the generation job has failed status.
ParametersgenerationJobRid
GenerationJobStatusRunningError CodeFAILED_PRECONDITION
Status Code500
DescriptionThe operation cannot be completed because the generation job has running status.
ParametersgenerationJobRid
InvalidDisplayNameError CodeINVALID_ARGUMENT
Status Code400
DescriptionThe display name of a Resource should not be exactly `.` or `..`, contain a forward slash `/` and must be less than or equal to 700 characters.
ParametersdisplayName
ResourceNameAlreadyExistsError CodeCONFLICT
Status Code409
DescriptionThe provided resource name is already in use by another resource in the same folder.
ParametersparentFolderRid, displayName
InvalidFolderError CodeINVALID_ARGUMENT
Status Code400
DescriptionThe given Resource is not a Folder.
ParametersresourceRid
SaveDocumentGenerationJobPermissionDeniedError CodePERMISSION_DENIED
Status Code403
DescriptionCould not saveDocument the GenerationJob.
ParametersgenerationJobRid, templateRid
FolderNotFoundError CodeNOT_FOUND
Status Code404
DescriptionThe given Folder could not be found.
ParametersfolderRid