Hello from {{user}}
\",\n \"name\": \"Nylas Alias\",\n \"subject\": \"New notification for {{user}}\",\n \"engine\": \"mustache\"\n }'" responses: '200': $ref: '#/components/responses/template' '400': $ref: '#/components/responses/template_400' /v3/templates/{template_id}: parameters: - schema: type: string name: template_id in: path required: true description: The ID of the template to access. example: 14c00cc8-648c-4381-ad10-52641d9bac8e get: summary: Return a template tags: - Templates and Workflows operationId: get-app-level-template description: Returns the specified application-level template. x-scopes: google: min: '' microsoft: min: '' yahoo: min: '' security: - NYLAS_API_KEY: [] x-code-samples: - lang: bash label: cURL source: "curl --request GET \\\n --url \"https://api.us.nylas.com/v3/templates/Test from {{user.name}}
\",\n \"name\": \"Update Template\",\n \"subject\": \"Test from {{user.name}}\",\n \"engine\": \"mustache\"\n }'" responses: '200': $ref: '#/components/responses/template' '400': $ref: '#/components/responses/template_400' delete: summary: Delete a template tags: - Templates and Workflows operationId: delete-app-level-template description: Deletes the specified application-level template. x-scopes: google: min: '' microsoft: min: '' yahoo: min: '' security: - NYLAS_API_KEY: [] x-code-samples: - lang: bash label: cURL source: "curl --request DELETE \\\n --url \"https://api.us.nylas.com/v3/templates/Hello from {{user.name}}, test {{ foo }}
\",\n \"variables\": {\n \"user\": {\n \"name\": \"Nylas\",\n \"surname\": \"Tester\"\n },\n \"foo\": \"hi\"\n },\n \"engine\": \"mustache\"\n }'" responses: '200': $ref: '#/components/responses/template_render_html' '400': description: 'Error: Bad request' content: application/json: schema: $ref: '#/components/schemas/400-2' /v3/templates/{template_id}/render: parameters: - schema: type: string name: template_id in: path required: true description: The ID of the template to access. example: 14c00cc8-648c-4381-ad10-52641d9bac8e post: summary: Render a template tags: - Templates and Workflows operationId: render-app-level-template description: Renders the specified application-level template with the provided variables. x-scopes: google: min: '' microsoft: min: '' yahoo: min: '' security: - NYLAS_API_KEY: [] requestBody: $ref: '#/components/requestBodies/template_render' x-code-samples: - lang: bash label: cURL source: "curl --request POST \\\n --url \"https://api.us.nylas.com/v3/templates/Hello from {{user}}
\",\n \"name\": \"Nylas Alias\",\n \"subject\": \"New notification for {{user}}\",\n \"engine\": \"mustache\"\n }'" responses: '200': $ref: '#/components/responses/template' '400': $ref: '#/components/responses/template_400' /v3/grants/{grant_id}/templates/{template_id}: parameters: - schema: type: string name: grant_id in: path required: true description: 'ID of the grant to access. You can also use the email address associated with the grant, or use `/me/` to refer to the grant associated with an access token.' example: nyla@example.com - schema: type: string name: template_id in: path required: true description: The ID of the template to access. example: 14c00cc8-648c-4381-ad10-52641d9bac8e get: summary: Return a template tags: - Templates and Workflows operationId: get-grant-level-template description: Returns the specified grant-level template. x-scopes: google: min: '' microsoft: min: '' yahoo: min: '' security: - NYLAS_API_KEY: [] - ACCESS_TOKEN: [] x-code-samples: - lang: bash label: cURL source: "curl --request GET \\\n --url \"https://api.us.nylas.com/v3/grants/Test from {{user.name}}
\",\n \"name\": \"Update Template\",\n \"subject\": \"Test from {{user.name}}\",\n \"engine\": \"mustache\"\n }'" responses: '200': $ref: '#/components/responses/template' '400': $ref: '#/components/responses/template_400' delete: summary: Delete a template tags: - Templates and Workflows operationId: delete-grant-level-template description: Deletes the specified grant-level template. x-scopes: google: min: '' microsoft: min: '' yahoo: min: '' security: - NYLAS_API_KEY: [] - ACCESS_TOKEN: [] x-code-samples: - lang: bash label: cURL source: "curl --request DELETE \\\n --url \"https://api.us.nylas.com/v3/grants/Hello from {{user.name}}, test {{ foo }}
\",\n \"variables\": {\n \"user\": {\n \"name\": \"Nylas\",\n \"surname\": \"Tester\"\n },\n \"foo\": \"hi\"\n },\n \"engine\": \"mustache\"\n }'" responses: '200': $ref: '#/components/responses/template_render_html' '400': description: 'Error: Bad request' content: application/json: schema: $ref: '#/components/schemas/400-2' /v3/workflows: get: summary: Return all workflows tags: - Templates and Workflows operationId: list-workflows description: Returns all application-level workflows. x-scopes: google: min: '' microsoft: min: '' yahoo: min: '' security: - NYLAS_API_KEY: [] parameters: - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/page_token' x-code-samples: - lang: bash label: cURL source: "curl --request GET \\\n --url \"https://api.us.nylas.com/v3/workflows?limit=10\" \\\n --header 'Accept: application/json' \\\n --header 'Authorization: BearerHello {{user.name}}, your booking has been confirmed.
engine: type: string description: The templating engine to use. enum: - handlebars - mustache - nunjucks - twig default: mustache example: mustache name: type: string description: The name of the template. example: Booking confirmed message subject: type: string description: The subject line of the template. example: '{{user.name}}, your booking is confirmed!' template_render_html: content: application/json: schema: type: object required: - body - engine - variables properties: body: type: string description: The body content of the template, in HTML format. example:Hello {{user.name}}, this shows test was {{ foo }}.
engine: type: string description: The templating engine to use. enum: - handlebars - mustache - nunjucks - twig example: mustache strict: type: boolean description: 'When `true`, Nylas returns an error if the template contains variables that aren''t defined in the `variables` object.' default: true example: true variables: type: object description: 'A set of key/value pairs representing variables to substitute for values in the template.' additionalProperties: type: string example: user: name: Leyah surname: Miller foo: testing successful template_update: description: Update template request content: application/json: schema: type: object properties: body: type: string description: The body content of the template, in HTML format. example:Hello {{user.name}}, your booking has been confirmed.
engine: type: string description: The templating engine to use. enum: - handlebars - mustache - nunjucks - twig example: mustache name: type: string description: The name of the template. example: Updated booking confirmed message subject: type: string description: The subject line of the template. example: '{{user.name}}, your booking is confirmed!' workflow_create: description: Create workflow request required: true content: application/json: schema: type: object required: - name - template_id - trigger_event properties: delay: type: integer description: 'The number of minutes between a `trigger_event` being met and the workflow sending a message.' default: 0 example: 5 is_enabled: type: boolean description: When `true`, indicates that the workflow is enabled. default: true example: true name: type: string description: The name of the workflow. example: New booking confirmation workflow template_id: type: string description: The ID of the email template the workflow uses. example: 14c00cc8-648c-4381-ad10-52641d9bac8e trigger_event: type: string enum: - booking.cancelled - booking.created - booking.pending - booking.reminder - booking.rescheduled description: The event which triggers the workflow. example: booking.created from: type: - object - 'null' description: 'Details of the sender if the workflow should use [transactional send](/docs/reference/api/transactional-send/). If not provided, the sender will be the grant associated with the trigger event.' properties: email: type: string description: The email address of the sender. example: support@example.com name: type: string description: The name of the sender. example: Support workflow_update: description: Update workflow request required: true content: application/json: schema: type: object properties: delay: type: integer description: 'The number of minutes between a `trigger_event` being met and the workflow sending a message.' example: 1 is_enabled: type: boolean description: When `true`, indicates that the workflow is enabled. example: false name: type: string description: The name of the workflow. example: Updated booking confirmation workflow template_id: type: string description: The ID of the email template the workflow uses. example: 14c00cc8-648c-4381-ad10-52641d9bac8e trigger_event: type: string enum: - booking.cancelled - booking.created - booking.pending - booking.reminder - booking.rescheduled description: The event which triggers the workflow. example: booking.created from: type: - object - 'null' description: 'Details of the sender if the workflow should use [transactional send](/docs/reference/api/transactional-send/). If not provided, the sender will be the grant associated with the trigger event.' properties: email: type: string description: The email address of the sender. example: support@example.com name: type: string description: The name of the sender. example: Support responses: '400': description: Bad Request content: application/json: schema: title: error type: object properties: request_id: type: string description: The request ID. error: type: object description: The response error object. properties: type: type: string description: The error type. message: type: string description: The error message. provider_error: type: object description: The error from the provider. examples: Bad Request: value: request_id: 5fa64c92-e840-4357-86b9-2aa364d35b88 error: type: invalid_request_error message: error parsing request body provider_error: code: TargetIdShouldNotBeMeOrWhitespace message: Id is malformed. Invalid Idempotency-Key: value: request_id: 5fa64c92-e840-4357-86b9-2aa364d35b88 error: type: api.invalid_idempotency_key message: Idempotency-Key must be 256 characters or fewer. template_render_html: description: Success. Returns rendered HTML. content: application/json: schema: type: object required: - data - request_id properties: request_id: type: string description: The ID of the request. example: 3907012912-13b5a9a4-f136-4761-a31b-68c6a8af825d data: type: object required: - body properties: body: type: string description: The rendered HTML with variables substituted. example:Hello Leyah, your booking has been confirmed.
template_400: description: 'Error: Bad request' content: application/json: schema: type: object required: - error - request_id properties: request_id: type: string description: The ID of the request. example: 3704952820-faf9214c-8bdd-4419-9d9c-f8f5ee464d57 error: type: object required: - message - type properties: type: type: string description: The type of error that occurred. example: api.invalid_request_error message: type: string description: A human-readable message describing the error. example: Validation of request body failed template_render: description: Success. Returns rendered template. content: application/json: schema: type: object required: - data - request_id properties: request_id: type: string description: The ID of the request. example: 3822450015-47d9207c-4d06-4e15-b3e7-752c5dd5585d data: type: object required: - body - subject properties: body: type: string description: The rendered HTML body content with variables substituted. example:Hello Leyah, your booking has been confirmed.
subject: type: string description: The rendered subject content with variables substituted. example: Leyah, your booking is confirmed! templates_list: description: Success. Returns list of templates. content: application/json: schema: type: object required: - data - next_cursor - request_id properties: request_id: type: string description: The ID of the request. example: 3821703913-a3548169-0de0-49de-9801-37d972b51766 data: type: array items: $ref: '#/components/schemas/template' example: - id: template_123 grant_id: grant_456 app_id: null engine: mustache name: Welcome Email subject: Welcome {{user.name}}! body:Hello {{user.name}}, welcome to our service!
We're excited to have you on board.
created_at: 1640995200 updated_at: 1640995200 object: template - id: template_456 grant_id: grant_456 app_id: null engine: handlebars name: Password Reset subject: Reset your password - {{company.name}} body:Hi {{user.name}},
Click here to reset your password.
This link expires in {{expiry_hours}} hours.
created_at: 1640995300 updated_at: 1640995400 object: template - id: template_789 grant_id: grant_456 app_id: null engine: twig name: Order Confirmation subject: 'Order #{{order.number}} confirmed' body: 'Order #{{order.number}} has been confirmed.
Total: ${{order.total}}
' created_at: 1640995500 updated_at: 1640995500 object: template next_cursor: type: string description: A cursor pointing to the next page of results for the request. example: eyJjdXJzb3IiOiJ0ZW1wbGF0ZV8xMjMifQ== template: description: Success. Returns template. content: application/json: schema: type: object required: - data - request_id properties: request_id: type: string description: The ID of the request. data: $ref: '#/components/schemas/template' example: request_id: 3822087561-67d4f28f-a46b-4c90-8fd3-765a04105043 data: id: 14c00cc8-648c-4381-ad10-52641d9bac8e grant_id: 6c45fe5e-0bb6-41b9-9acc-ccb15bfc51eb app_id: null engine: mustache name: Booking confirmed message subject: '{{user.name}}, your booking is confirmed!' body:Hello {{user.name}}, your booking has been confirmed.
created_at: 1640995200 updated_at: 1640995200 object: template delete_200_simple: description: 'Success: Object deleted' content: application/json: schema: type: object required: - request_id properties: request_id: type: string description: The ID of the request. example: 3906564297-48e7fb5b-f220-427b-a4de-255736adba08 workflow: description: Success. Returns workflow. content: application/json: schema: type: object required: - data - request_id properties: request_id: type: string description: The ID of the request. data: $ref: '#/components/schemas/workflow' example: request_id: 9ca1d434-5ac7-4331-b8fb-3749c9a758d3 data: app_id: null date_created: 1756477389 delay: 5 grant_id: 6c45fe5e-0bb6-41b9-9acc-ccb15bfc51eb id: b79c82b2-a51b-4c54-8469-28006a43551a is_enabled: true name: New booking confirmation workflow template_id: 14c00cc8-648c-4381-ad10-52641d9bac8e trigger_event: booking.created from: email: support@example.com name: Support workflows_list: description: Success. Returns list of workflows. content: application/json: schema: type: object required: - data - next_cursor - request_id properties: request_id: type: string description: The ID of the request. example: 9ca1d434-5ac7-4331-b8fb-3749c9a758d3 data: type: array items: $ref: '#/components/schemas/workflow' example: - id: b79c82b2-a51b-4c54-8469-28006a43551a grant_id: 6c45fe5e-0bb6-41b9-9acc-ccb15bfc51eb app_id: null is_enabled: true name: Booking Confirmation Workflow trigger_event: booking.created delay: 1 template_id: 14c00cc8-648c-4381-ad10-52641d9bac8e date_created: 1756477389 - id: c89d93c3-b62c-5d65-9570-39117b54662b grant_id: 6c45fe5e-0bb6-41b9-9acc-ccb15bfc51eb app_id: null is_enabled: true name: Booking Reminder Workflow trigger_event: booking.reminder delay: 60 template_id: 25d11dd9-759d-5492-be21-63752e6cbd9f date_created: 1756477500 - id: d90e04d4-c73d-6e76-a681-40228c65773c grant_id: 6c45fe5e-0bb6-41b9-9acc-ccb15bfc51eb app_id: null is_enabled: false name: Booking Cancellation Workflow trigger_event: booking.cancelled delay: 0 template_id: 36e22ee0-86ae-6603-cf32-74863f7dce0g date_created: 1756477600 next_cursor: type: string description: A cursor pointing to the next page of results for the request. example: eyJjdXJzb3IiOiJub3RpZmljYXRpb25fd29ya2Zsb3dfYjc5YzgyYjIifQ== workflow_400: description: 'Error: Bad request' content: application/json: schema: type: object required: - error - request_id properties: request_id: type: string description: The ID of the request. example: 02674fc0-b8cf-43cd-8bd2-506fa401b81f error: type: object required: - message - type properties: type: type: string description: The type of error that occurred. example: api.invalid_request_error message: type: string description: A human-readable message describing the error. example: invalid_event is not a valid option workflow_404: description: 'Error: Not found' content: application/json: schema: type: object required: - error - request_id properties: request_id: type: string description: The ID of the request. example: 02674fc0-b8cf-43cd-8bd2-506fa401b81f error: type: object required: - message - type properties: type: type: string description: The type of error that occurred. example: api.not_found_error message: type: string description: A human-readable message describing the error. example: template not found parameters: page_token: name: page_token in: query required: false schema: type: string description: 'An identifier that specifies which page of data to return. You can get this value from the `next_cursor` response field. See [Pagination](/docs/reference/api/#pagination) for more information.' limit: name: limit in: query required: false schema: type: integer default: 50 maximum: 200 description: 'The maximum number of objects to return. See [Pagination](/docs/reference/api/#pagination) for more information.' schemas: 400-2: description: Bad Request content: application/json: schema: title: error type: object properties: request_id: type: string description: The request ID. error: type: object description: The response error object. properties: type: type: string description: The error type. message: type: string description: The error message. provider_error: type: object description: The error from the provider. examples: Bad Request: value: request_id: 5fa64c92-e840-4357-86b9-2aa364d35b88 error: type: invalid_request_error message: error parsing request body provider_error: code: TargetIdShouldNotBeMeOrWhitespace message: Id is malformed. Invalid Idempotency-Key: value: request_id: 5fa64c92-e840-4357-86b9-2aa364d35b88 error: type: api.invalid_idempotency_key message: Idempotency-Key must be 256 characters or fewer. template: type: object description: A custom message template. required: - body - created_at - engine - id - name - object - subject - updated_at properties: app_id: type: - string - 'null' description: 'The ID of the Nylas application associated with the template. Returned only if the template is configured at the application level.' example: 6c45fe5e-0bb6-41b9-9acc-ccb15bfc51eb body: type: string description: The body content of the template, in HTML format. example:Hello {{user.name}}, your booking has been confirmed.
created_at: type: integer description: When the template was created, in seconds using the Unix timestamp format. example: 1640995200 engine: type: string enum: - handlebars - mustache - nunjucks - twig description: The templating engine. example: mustache grant_id: type: - string - 'null' description: 'The ID of the grant associated with the template. Returned only if the template is configured at the grant level.' example: 6c45fe5e-0bb6-41b9-9acc-ccb15bfc51eb id: type: string description: The template ID. example: b79c82b2-a51b-4c54-8469-28006a43551a name: type: string description: The name of the template. example: Booking confirmed message object: type: string description: The object type identifier. default: template example: template subject: type: string description: The subject line of the template. example: '{{user.name}}, your booking is confirmed!' updated_at: type: integer description: When the template was last updated, in seconds using the Unix timestamp format. example: 1640995200 workflow: type: object description: A custom workflow that sends messages from a template when certain events are triggered. required: - date_created - delay - id - is_enabled - name - template_id - trigger_event properties: app_id: type: - string - 'null' description: 'The ID of the Nylas application associated with the workflow. Returned only if the workflow is configured at the application level.' example: 6c45fe5e-0bb6-41b9-9acc-ccb15bfc51eb date_created: type: integer description: When the workflow was created, in seconds using the Unix timestamp format. example: 1756477389 delay: type: integer description: 'The number of minutes between a `trigger_event` being met and the workflow sending a message.' example: 5 grant_id: type: - string - 'null' description: 'The ID of the grant associated with the workflow. Returned only if the workflow is configured at the grant level.' example: 6c45fe5e-0bb6-41b9-9acc-ccb15bfc51eb id: type: string description: The ID of the workflow. example: b79c82b2-a51b-4c54-8469-28006a43551a is_enabled: type: boolean description: When `true`, indicates that the workflow is enabled. example: true name: type: string description: The name of the workflow. example: New booking confirmation workflow template_id: type: string description: The ID of the email template the workflow uses. example: 14c00cc8-648c-4381-ad10-52641d9bac8e trigger_event: type: string enum: - booking.cancelled - booking.created - booking.pending - booking.reminder - booking.rescheduled description: The event which triggers the workflow. example: booking.created from: type: - object - 'null' description: Details of the sender if the workflow uses transactional send. properties: email: type: string description: The email address of the sender. example: support@example.com name: type: string description: The name of the sender. example: Support