> ## Documentation Index
> Fetch the complete documentation index at: https://www.canva.dev/docs/apps/llms.txt
> Use this file to discover all available pages before exploring further.
# Publish brand template
Publish a design as a brand template.
This API is currently provided as a preview. Be aware of the following:
* There might be unannounced breaking changes.
* Any breaking changes to preview APIs won't produce a new [API version](https://www.canva.dev/docs/apps/rest-apis/versions/).
* Public apps that use preview APIs will not pass the review process, and can't be made available to all Canva users.
AVAILABILITY: To use this API, your app must act on behalf of a user that's on a Canva plan with access to brand templates (such as Canva Pro, Canva Teams, or Canva Enterprise). Additionally, the user must have one of the following [roles](https://www.canva.com/help/roles-and-permissions/): Team admin, Brand designer, Organization admin, or Organization designer.
Publishes a design as a [brand template](https://www.canva.com/help/publish-team-template/). Brand templates are design templates that can be shared across a team for consistent content creation.
This API supports two workflows:
* **Initial publish**: If the design is not linked to an existing brand template, a new brand template is created.
* **Republish**: If the design is a draft of an existing brand template (created by editing an existing template), the existing template is updated with the changes.
The API returns the published brand template immediately.
The `thumbnail` field might be `null` immediately after publishing, as thumbnails are generated asynchronously. You can use the [Get brand template API](https://www.canva.dev/docs/apps/rest-apis/reference/brand-templates/get-brand-template/) to retrieve the thumbnail once it's ready. The brand template's `view_url` and `create_url` are available immediately.
## HTTP method and URL path
POST https\://api.canva.com/rest/v1/brand-templates
This operation is rate limited to 20 requests per minute for each user of your app.
## Authentication and authorization
This endpoint requires a valid access token that acts on behalf of a user. For more information, see [Generate an access token](/docs/apps/rest-apis/reference/authentication/generate-access-token).
### Scopes
The access token must have all the following [scopes](/docs/apps/rest-apis/scopes) (permissions):
* `brandtemplate:content:write`
## Header parameters
Provides credentials to authenticate the request, in the form of a `Bearer` token.
For example: `Authorization: Bearer {token}`
Indicates the media type of the information sent in the request. This must be set to `application/json`.
For example: `Content-Type: application/json`
## Body parameters
The ID of the design to publish as a brand template. If this design is a draft of an existing brand template, that template will be updated. Otherwise, a new brand template is created.
## Example request
Examples for using the `/v1/brand-templates` endpoint:
```sh
curl --request POST 'https://api.canva.com/rest/v1/brand-templates' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data '{
"design_id": "DABCdesign123"
}'
```
```js
const fetch = require("node-fetch");
fetch("https://api.canva.com/rest/v1/brand-templates", {
method: "POST",
headers: {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
},
body: JSON.stringify({
"design_id": "DABCdesign123"
}),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
```java
import java.io.IOException;
import java.net.URI;
import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/rest/v1/brand-templates"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"design_id\": \"DABCdesign123\"}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
```py
import requests
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json"
}
data = {
"design_id": "DABCdesign123"
}
response = requests.post("https://api.canva.com/rest/v1/brand-templates",
headers=headers,
json=data
)
print(response.json())
```
```csharp
using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.canva.com/rest/v1/brand-templates"),
Headers =
{
{ "Authorization", "Bearer {token}" },
},
Content = new StringContent(
"{\"design_id\": \"DABCdesign123\"}",
Encoding.UTF8,
"application/json"
),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
```go
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"design_id": "DABCdesign123"
}`)
url := "https://api.canva.com/rest/v1/brand-templates"
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
```php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.canva.com/rest/v1/brand-templates",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer {token}',
'Content-Type: application/json',
),
CURLOPT_POSTFIELDS => json_encode([
"design_id" => "DABCdesign123"
])
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
```ruby
require 'net/http'
require 'uri'
url = URI('https://api.canva.com/rest/v1/brand-templates')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/json'
request.body = <
## Success response
If successful, the endpoint returns a `200` response with a JSON body with the following parameters:
An object representing a brand template with associated metadata.
Properties of brand_template>} defaultExpanded={true}>
The brand template ID.
The brand template title, as shown in the Canva UI.
A URL Canva users can visit to view the brand template.
A URL Canva users can visit to create a new design from the template.
When the brand template was created, as a Unix timestamp
(in seconds since the Unix Epoch).
When the brand template was last updated, as a Unix timestamp
(in seconds since the Unix Epoch).
A thumbnail image representing the object.
Properties of thumbnail>}>
The width of the thumbnail image in pixels.
The height of the thumbnail image in pixels.
A URL for retrieving the thumbnail image.
This URL expires after 15 minutes. This URL includes a query string
that's required for retrieving the thumbnail.
## Example response
### Successful brand template publishing
Response from successfully publishing a brand template. Note that the thumbnail might be null initially and will be available after async processing completes.
```json
{
"brand_template": {
"id": "EABCtemplate789",
"title": "My Brand Template",
"view_url": "https://www.canva.com/design/EABCtemplate789/view",
"create_url": "https://www.canva.com/design/EABCtemplate789/remix",
"created_at": 1704110400,
"updated_at": 1704110400
}
}
```
## Error responses
### 400 Bad Request - includes validation errors and other bad request errors
A short string indicating what failed. This field can be used to handle errors programmatically. For a complete list of error codes, see [Error responses](/docs/apps/rest-apis/error-responses/).
A human-readable description of what went wrong.
#### Example error responses
##### The design ID format is invalid
```json
{
"code": "bad_request_params",
"message": "Design ID '{designId}' is not valid"
}
```
##### Validation error - resource limit exceeded
```json
{
"code": "bad_request_params",
"message": "Design contains {count} {resource_name}, but brand templates can only contain up to {max}. Reduce the number and try again."
}
```
### 403 Forbidden
A short string indicating what failed. This field can be used to handle errors programmatically. For a complete list of error codes, see [Error responses](/docs/apps/rest-apis/error-responses/).
A human-readable description of what went wrong.
#### Example error response
##### User does not have permission to publish the design as a brand template
```json
{
"code": "permission_denied",
"message": "User does not have permission to publish design {designId} as a brand template"
}
```
### 404 Not Found
A short string indicating what failed. This field can be used to handle errors programmatically. For a complete list of error codes, see [Error responses](/docs/apps/rest-apis/error-responses/).
A human-readable description of what went wrong.
#### Example error response
##### The design was not found
```json
{
"code": "not_found",
"message": "Design with id {designId} not found"
}
```