Content
Use the Content API to create content templates that can be sent in pushes and managed in the Airship dashboard.
Create content template
Create a new content template.
POST /api/content/templates
Security:
- basicAuth
- oauth2Token : tpl
Request body:
A single content template object.
Content-Type:
application/jsonA reusable template containing fields for a message type. Can be referenced by its UUID or a customer-defined external ID.
Responses
201
The template was created.
Response headers:
- Location string
The URI for the template, used for later updates or sends.
Response body:
- Content-Type:OBJECT PROPERTIES
application/vnd.urbanairship+json; version=3- ok booleanREQUIRED
If
true, the operation completed successfully and returns an expected response. - operation_id string
A unique string identifying the operation, useful for reporting and troubleshooting.
Format: uuid
Example:
ef625038-70a3-41f1-826f-57bc11dd625a - template_id string
A unique string identifying the template, used to reference it when sending messages and in other operations.
Format: uuid
Example:
0f7704e9-5dc0-4f7d-9964-e89055701b0a
400
There was a parsing or validation error in the request. Bad Request errors typically include
pathandlocationin the response to help you find the cause of the error.Response body:
- Content-Type:
application/jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
401
Authentication information (the app key and secret or bearer token) was either incorrect or missing.
Response body:
- Content-Type:
text/plainErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
Examples
Example create email content template with snippet and feed references
POST /api/content/templates HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
Content-Type: application/json
{
"external_id": "welcome_message",
"name": "Welcome Message",
"description": "Our welcome message",
"type": "email",
"content": {
"subject": "Welcome!",
"html_body": "<html><body>Hi, {{first_name}}! {{>footer}}</body></html>",
"plaintext_body": "Hi, {{first_name}}!"
},
"snippet_references": {
"snippets": [
{
"name": "footer"
}
]
},
"feed_references": {
"feeds": [
{
"name": "featured_product"
}
]
}
}
HTTP/1.1 201 Created
Location: https://go.urbanairship.com/api/content/templates/ef34a8d9-0ad7-491c-86b0-aea74da15161
Content-Type: application/vnd.urbanairship+json; version=3
{
"ok" : true,
"operation_id" : "9ce808c8-7176-45dc-b79e-44aa74249a5a",
"template_id": "ef34a8d9-0ad7-491c-86b0-aea74da15161"
}
Create or update content template by external ID
Create or update a content template by its external ID.
PUT /api/content/templates/external/{type}/{external_id}
Security:
- basicAuth
- oauth2Token : tpl
Path parameters:
- type stringREQUIREDThe message type for the template.
Possible values:
emailsmsopenappwebmessage_center
- external_id stringREQUIREDThe customer-defined external ID of the template.
Request body:
A partially defined content template object.
Content-Type:
application/jsonA reusable template containing fields for a message type. Can be referenced by its UUID or a customer-defined external ID.
Responses
200
Returned if the template has been successfully updated.
Response body:
- Content-Type:OBJECT PROPERTIES
application/vnd.urbanairship+json; version=3- ok booleanREQUIRED
If
true, the operation completed successfully and returns an expected response. - operation_id string
A unique string identifying the operation, useful for reporting and troubleshooting.
Format: uuid
Example:
ef625038-70a3-41f1-826f-57bc11dd625a
400
There was a parsing or validation error in the request. Bad Request errors typically include
pathandlocationin the response to help you find the cause of the error.Response body:
- Content-Type:
application/jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
401
Authentication information (the app key and secret or bearer token) was either incorrect or missing.
Response body:
- Content-Type:
text/plainErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
Examples
Example update content template by external ID
PUT /api/content/templates/external/email/customer-defined-id HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
Content-Type: application/json
{
"name": "Welcome Message",
"description": "Our welcome message",
"content": {
"subject": "Welcome!",
"html_body": "<html><body>Hi, {{first_name}}!</body></html>",
"plaintext_body": "Hi, {{first_name}}!"
}
}
HTTP/1.1 200 OK
Content-Type: application/vnd.urbanairship+json; version=3
{
"ok" : true,
"operation_id" : "9ce808c8-7176-45dc-b79e-44aa74249a5a"
}
Delete content template
Delete a content template.
DELETE /api/content/templates/{template_id}
Security:
- basicAuth
- oauth2Token : tpl
Path parameters:
- template_id stringREQUIREDThe UUID of the template.
Responses
200
The template with the given ID has been successfully deleted.
Response body:
- Content-Type:OBJECT PROPERTIES
application/vnd.urbanairship+json; version=3- ok booleanREQUIRED
If
true, the operation completed successfully and returns an expected response. - operation_id string
A unique string identifying the operation, useful for reporting and troubleshooting.
Format: uuid
Example:
ef625038-70a3-41f1-826f-57bc11dd625a
401
Authentication information (the app key and secret or bearer token) was either incorrect or missing.
Response body:
- Content-Type:
text/plainErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
404
The requested resource doesn’t exist.
Response body:
- Content-Type:
application/vnd.urbanairship+jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
Examples
Example delete content template
DELETE /api/content/templates/ef34a8d9-0ad7-491c-86b0-aea74da15161 HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
HTTP/1.1 200 OK
Content-Type: application/vnd.urbanairship+json; version=3
{
"ok" : true,
"operation_id" : "9ce808c8-7176-45dc-b79e-44aa74249a5a"
}
Delete content template by external ID
Delete a content template.
DELETE /api/content/templates/external/{type}/{external_id}
Security:
- basicAuth
- oauth2Token : tpl
Path parameters:
- type stringREQUIREDThe message type for the template.
Possible values:
emailsmsopenappwebmessage_center
- external_id stringREQUIREDThe customer-defined external ID of the template.
Responses
200
The template with the given external ID has been successfully deleted.
Response body:
- Content-Type:OBJECT PROPERTIES
application/vnd.urbanairship+json; version=3- ok booleanREQUIRED
If
true, the operation completed successfully and returns an expected response. - operation_id string
A unique string identifying the operation, useful for reporting and troubleshooting.
Format: uuid
Example:
ef625038-70a3-41f1-826f-57bc11dd625a
401
Authentication information (the app key and secret or bearer token) was either incorrect or missing.
Response body:
- Content-Type:
text/plainErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
404
The requested resource doesn’t exist.
Response body:
- Content-Type:
application/vnd.urbanairship+jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
Examples
Example delete content template by external ID
DELETE /api/content/templates/external/email/customer-defined-id HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
HTTP/1.1 200 OK
Content-Type: application/vnd.urbanairship+json; version=3
{
"ok" : true,
"operation_id" : "9ce808c8-7176-45dc-b79e-44aa74249a5a"
}
List content templates
List all existing content templates. Returns an array of content template objects in the content_templates attribute.
GET /api/content/templates
Security:
- basicAuth
- oauth2Token : tpl
Query parameters:
- page integerSpecifies the desired page number. Defaults to 1.
- page_size integerSpecifies how many results to return per page.
- sort stringSpecifies the name of the field you want to sort results by. Defaults to
created_at.Possible values:
created_atmodified_at
- order stringSpecifies the sort order as ascending (
asc) or descending (desc). Defaults toasc.Possible values:
ascdesc
Responses
200
Returned on success, with the JSON representation of the content templates in the body of the response.
Response body:
- Content-Type:OBJECT PROPERTIES
application/vnd.urbanairship+json; version=3- content_templates array
An array of content template objects.
- count integer
The number of content templates in the current response. This is effectively the page size.
- next_page string
There might be more than one page of results for this listing. When present, use this URL to fetch the next batch of results.
Format: url
- ok booleanREQUIRED
Success.
- prev_page string
Link to the previous page, if available.
Format: url
- total_count integer
The total number of content templates.
401
Authentication information (the app key and secret or bearer token) was either incorrect or missing.
Response body:
- Content-Type:
text/plainErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
Examples
Example list content templates
GET /api/content/templates HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
HTTP/1.1 200 OK
Content-Type: application/vnd.urbanairship+json; version=3
{
"ok" : true,
"count": 1,
"total_count": 1,
"content_templates": [
{
"id": "ef34a8d9-0ad7-491c-86b0-aea74da15161",
"external_id": "welcome_message",
"name": "Welcome Message",
"description": "Our welcome message",
"type": "email",
"content": {
"subject": "Welcome!",
"html_body": "<html><body>Hi, {{first_name}}!</body></html>",
"plaintext_body": "Hi, {{first_name}}!"
},
"created_at": "2020-08-17T11:10:02Z",
"modified_at": "2020-08-17T11:10:02Z"
}
],
"next_page": null,
"prev_page": null
}
Look up a content template
Fetch a single content template using UUID.
GET /api/content/templates/{template_id}
Security:
- basicAuth
- oauth2Token : tpl
Path parameters:
- template_id stringREQUIREDThe UUID of the template.
Responses
200
Returned on success, with the JSON representation of the template in the body of the response.
Response body:
- Content-Type:OBJECT PROPERTIES
application/vnd.urbanairship+json; version=3- content_template object<Content template object>
A reusable template containing fields for a message type. Can be referenced by its UUID or a customer-defined external ID.
- ok booleanREQUIRED
If
true, the operation completed successfully and returns an expected response.
401
Authentication information (the app key and secret or bearer token) was either incorrect or missing.
Response body:
- Content-Type:
text/plainErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
404
The requested resource doesn’t exist.
Response body:
- Content-Type:
application/vnd.urbanairship+jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
Examples
Example look up content template
GET /api/content/templates/ef34a8d9-0ad7-491c-86b0-aea74da15161 HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
HTTP/1.1 200 OK
Content-Type: application/vnd.urbanairship+json; version=3
{
"ok" : true,
"content_template": {
"id": "ef34a8d9-0ad7-491c-86b0-aea74da15161",
"external_id": "welcome_message",
"name": "Welcome Message",
"description": "Our welcome message",
"type": "email",
"content": {
"subject": "Welcome!",
"html_body": "<html><body>Hi, {{first_name}}! {{>footer}}</body></html>",
"plaintext_body": "Hi, {{first_name}}!"
},
"created_at": "2020-08-17T11:10:02Z",
"modified_at": "2020-08-17T11:10:02Z",
"snippets": [
{
"name": "footer"
}
]
}
}
Look up a content template by external ID
Fetch a single content template using external ID.
GET /api/content/templates/external/{type}/{external_id}
Security:
- basicAuth
- oauth2Token : tpl
Path parameters:
- type stringREQUIREDThe message type for the template.
Possible values:
emailsmsopenappwebmessage_center
- external_id stringREQUIREDThe customer-defined external ID of the template.
Responses
200
Returned on success, with the JSON representation of the template in the body of the response.
Response body:
- Content-Type:OBJECT PROPERTIES
application/vnd.urbanairship+json; version=3- content_template object<Content template object>
A reusable template containing fields for a message type. Can be referenced by its UUID or a customer-defined external ID.
- ok booleanREQUIRED
If
true, the operation completed successfully and returns an expected response.
401
Authentication information (the app key and secret or bearer token) was either incorrect or missing.
Response body:
- Content-Type:
text/plainErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
404
The requested resource doesn’t exist.
Response body:
- Content-Type:
application/vnd.urbanairship+jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
Examples
Example look up content template by external ID
GET /api/content/templates/external/email/customer-defined-id HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
HTTP/1.1 200 OK
Content-Type: application/vnd.urbanairship+json; version=3
{
"ok" : true,
"content_template": {
"id": "ef34a8d9-0ad7-491c-86b0-aea74da15161",
"external_id": "customer-defined-id",
"name": "Welcome Message",
"description": "Our welcome message",
"type": "email",
"content": {
"subject": "Welcome!",
"html_body": "<html><body>Hi, {{first_name}}! {{>footer}}</body></html>",
"plaintext_body": "Hi, {{first_name}}!"
},
"created_at": "2020-08-17T11:10:02Z",
"modified_at": "2020-08-17T11:10:02Z",
"snippets": [
{
"name": "footer"
}
]
}
}
Update content template
Update a content template.
PUT /api/content/templates/{template_id}
Security:
- basicAuth
- oauth2Token : tpl
Path parameters:
- template_id stringREQUIREDThe UUID of the template.
Request body:
A partially defined content template object.
Content-Type:
application/jsonA reusable template containing fields for a message type. Can be referenced by its UUID or a customer-defined external ID.
Responses
200
Returned if the template has been successfully updated.
Response body:
- Content-Type:OBJECT PROPERTIES
application/vnd.urbanairship+json; version=3- ok booleanREQUIRED
If
true, the operation completed successfully and returns an expected response. - operation_id string
A unique string identifying the operation, useful for reporting and troubleshooting.
Format: uuid
Example:
ef625038-70a3-41f1-826f-57bc11dd625a
400
There was a parsing or validation error in the request. Bad Request errors typically include
pathandlocationin the response to help you find the cause of the error.Response body:
- Content-Type:
application/jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
401
Authentication information (the app key and secret or bearer token) was either incorrect or missing.
Response body:
- Content-Type:
text/plainErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
Examples
Example update content template
PUT /api/content/templates/ef34a8d9-0ad7-491c-86b0-aea74da15161 HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
Content-Type: application/json
{
"name": "Welcome Message",
"description": "Our welcome message",
"content": {
"subject": "Welcome!",
"html_body": "<html><body>Hi, {{first_name}}!</body></html>",
"plaintext_body": "Hi, {{first_name}}!"
}
}
HTTP/1.1 200 OK
Content-Type: application/vnd.urbanairship+json; version=3
{
"ok" : true,
"operation_id" : "9ce808c8-7176-45dc-b79e-44aa74249a5a"
}