Email templates API
The WSO2 Identity Platform - Email Templates API (version v1).
Download the OpenAPI definition (YAML)
Security schemes
OAuth2: oauth2
clientCredentials flow, token URL https://api.asgardeo.io/t/{org-name}/oauth2/token
4 scopes
| Scope | Description |
|---|---|
internal_email_mgt_view | Grants read access |
internal_email_mgt_create | Grants write access |
internal_email_mgt_delete | Grants permission to delete records |
internal_email_mgt_update | Grants permission to update existing records |
Email template types
An email template type can have multiple email templates for different languages.
Get email template types
GET /email/template-types
Retrieves all the email template types in your organization, with limited details of the email templates.
Scopes required: internal_email_mgt_view
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
requiredAttributes | query | string | Specifies the required parameters in the response. See the response schema for the complete list of parameters your can get in the response. </br></br> By default, all the required parameters (in the response schema) will be returned. Use this parameter to specify additional attributes that you need in the response. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Results matching the request criteria | array of EmailTemplateTypeWithoutTemplates |
400 | Invalid input request | Error |
401 | Unauthorized | |
403 | Forbidden | |
500 | Internal Server Error | Error |
Add email template type
POST /email/template-types
Adds a new email template type to your organization. An email template type can have any number of email templates.
- Note that the displayName attribute of the template type should be unique.
Scopes required: internal_email_mgt_create
Request body: application/json
Use the following parameters in your request body to define your new email template type.
Schema: EmailTemplateType
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
displayName | string | Yes | The unique display name of the email template type. |
templates | array of EmailTemplateWithID | Yes | Email templates for the template type. |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Item Created | EmailTemplateTypeWithoutTemplates |
400 | Invalid input request | Error |
401 | Unauthorized | |
403 | Forbidden | |
409 | Item Already Exists | Error |
500 | Internal Server Error | Error |
Remove email template type
DEL /email/template-types/{template-type-id}
Removes an existing email template type with all its email templates
from your organization.
Scopes required: internal_email_mgt_delete
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
template-type-id | path | string | Yes | The ID of the email template type. |
Responses
| Code | Description | Schema |
|---|---|---|
204 | Item Deleted | |
400 | Invalid input request | Error |
401 | Unauthorized | |
403 | Forbidden | |
404 | The specified resource is not found | Error |
500 | Internal Server Error | Error |
Email templates
An email template of a specific type and language.
Get email templates per type
GET /email/template-types/{template-type-id}
Retrieves an email template type (matching the template type ID) including all of its email templates.
Scopes required: internal_email_mgt_view
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
template-type-id | path | string | Yes | The ID of the email template type. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Results matching the request criteria | EmailTemplateTypeWithID |
400 | Invalid input request | Error |
401 | Unauthorized | |
403 | Forbidden | |
404 | The specified resource is not found | Error |
500 | Internal Server Error | Error |
Replace all email templates
PUT /email/template-types/{template-type-id}
Replaces all the email templates of the respective email template type with
the newly provided email templates.
Scopes required: internal_email_mgt_update
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
template-type-id | path | string | Yes | The ID of the email template type. |
Request body: application/json
Use the following parameters in your request body. These parameter values will replace all the content in all the existing templates for the template type.
Schema: array of EmailTemplateWithID
Responses
| Code | Description | Schema |
|---|---|---|
200 | Item Updated | |
400 | Invalid input request | Error |
401 | Unauthorized | |
403 | Forbidden | |
404 | The specified resource is not found | Error |
500 | Internal Server Error | Error |
Add email template
POST /email/template-types/{template-type-id}
Adds a new email template to a template type. Note that the template ID is the locale and it be unique for the template type. You cannot have two templates with the same locale for a template type.
Scopes required:
internal_email_mgt_create
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
template-type-id | path | string | Yes | The ID of the email template type. |
Request body: application/json
Use the following parameters in your request body to define your new email template type.
Schema: EmailTemplateWithID
5 properties
| Name | Type | Required | Description |
|---|---|---|---|
contentType | string | Yes | Content type of the email template. |
subject | string | Yes | The subject of the email. |
body | string | Yes | The body (HTML) of the email. |
footer | string | Yes | The footer of the email. |
id | string | Yes | Unique ID of the email template. This ID represents the locale of the email template. |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Item Created | SimpleEmailTemplate |
400 | Invalid input request | Error |
401 | Unauthorized | |
403 | Forbidden | |
409 | Item Already Exists | Error |
500 | Internal Server Error | Error |
List email templates per type
GET /email/template-types/{template-type-id}/templates
Retrieves the list of email templates for the template type ID.
Scopes required: internal_email_mgt_view
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
template-type-id | path | string | Yes | The ID of the email template type. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Results matching the request criteria | array of SimpleEmailTemplate |
400 | Invalid input request | Error |
401 | Unauthorized | |
403 | Forbidden | |
404 | The specified resource is not found | Error |
500 | Internal Server Error | Error |
Get an email template
GET /email/template-types/{template-type-id}/templates/{template-id}
Retrieves the email template that matches the specified template ID and template type.
Scopes required: internal_email_mgt_view
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
template-type-id | path | string | Yes | The ID of the email template type. |
template-id | path | string | Yes | Email template ID. This should be a valid locale. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Results matching the request criteria | EmailTemplateWithID |
400 | Invalid input request | Error |
401 | Unauthorized | |
403 | Forbidden | |
404 | The specified resource is not found | Error |
500 | Internal Server Error | Error |
Replace an email template
PUT /email/template-types/{template-type-id}/templates/{template-id}
Replaces the email template identified by the template ID and template type.
Scopes required: internal_email_mgt_update
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
template-type-id | path | string | Yes | The ID of the email template type. |
template-id | path | string | Yes | Email template ID. This should be a valid locale. |
Request body: application/json
Email templates for the template type
Schema: EmailTemplateWithID
5 properties
| Name | Type | Required | Description |
|---|---|---|---|
contentType | string | Yes | Content type of the email template. |
subject | string | Yes | The subject of the email. |
body | string | Yes | The body (HTML) of the email. |
footer | string | Yes | The footer of the email. |
id | string | Yes | Unique ID of the email template. This ID represents the locale of the email template. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Item Updated | |
400 | Invalid input request | Error |
401 | Unauthorized | |
403 | Forbidden | |
404 | The specified resource is not found | Error |
500 | Internal Server Error | Error |
Remove email template
DEL /email/template-types/{template-type-id}/templates/{template-id}
Removes an email template identified by the template ID and template type.
Scopes required: internal_email_mgt_delete
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
template-type-id | path | string | Yes | The ID of the email template type. |
template-id | path | string | Yes | Email template ID. This should be a valid locale. |
Responses
| Code | Description | Schema |
|---|---|---|
204 | Item Deleted | |
400 | Invalid input request | Error |
401 | Unauthorized | |
403 | Forbidden | |
404 | The specified resource is not found | Error |
500 | Internal Server Error | Error |
Schemas
EmailTemplateTypeWithoutTemplates
Type: object
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique ID of the email template type. |
displayName | string | Yes | Display name of the email template type. |
templates | array of EmailTemplateWithID | Email templates for the template type. This is the HTML template of the email body. | |
self | string | Yes | Location of the created/updated resource. |
EmailTemplateType
Type: object
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
displayName | string | Yes | The unique display name of the email template type. |
templates | array of EmailTemplateWithID | Yes | Email templates for the template type. |
EmailTemplateTypeWithID
Type: EmailTemplateType
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
displayName | string | Yes | The unique display name of the email template type. |
templates | array of EmailTemplateWithID | Yes | Email templates for the template type. |
id | string | Yes | Unique ID of the email template type. |
EmailTemplate
Type: object
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
contentType | string | Yes | Content type of the email template. |
subject | string | Yes | The subject of the email. |
body | string | Yes | The body (HTML) of the email. |
footer | string | Yes | The footer of the email. |
EmailTemplateWithID
Type: EmailTemplate
5 properties
| Name | Type | Required | Description |
|---|---|---|---|
contentType | string | Yes | Content type of the email template. |
subject | string | Yes | The subject of the email. |
body | string | Yes | The body (HTML) of the email. |
footer | string | Yes | The footer of the email. |
id | string | Yes | Unique ID of the email template. This ID represents the locale of the email template. |
SimpleEmailTemplate
Type: object
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique ID of the email template. This ID represents the locale of the email template. |
self | string | Yes | Location of the created/updated resource. |
Error
Type: object
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
code | string | Yes | |
message | string | Yes | |
description | string | ||
traceId | string |
Was this page helpful?