Quick start

The Canva Connect API has resource-oriented URLs, accepts requests with parameters, and returns JSON responses with standard HTTP response codes.

By default, the Canva Connect API endpoint URL paths have the following format:

https://api.canva.com/rest/<version>/<path>/<endpoint>

For example, the URL path for the endpoint used to generate an access token is:

https://api.canva.com/rest/v1/oauth/token

To use Canva Connect API:

To check if curl is installed on your machine, run the following command in your terminal:

curl --version

If you get information about the version, curl is installed. Otherwise, download and install curl. The installation steps depend on your machine.

Canva Connect API authentication is based on OAuth. An OAuth access token authenticates your integration to use the API endpoints on a user's behalf. You need to add the access token as a header to every API request. Follow the steps below to get the access token:

  1. Get the authorization code by visiting the /authorize endpoint through a browser.

  2. Use the authorization code and generate an access token using the /token endpoint.

Once you are authenticated to use Canva Connect API, you can make API requests.

The example below shows how you can create a folder, and upload an asset to the folder using the Canva Connect API.

Go through the API Reference section and find the HTTP method and the path of the endpoint you wish to use.

To create a folder you need the following HTTP method and URL path:

HTTP Method: POST

URL Path: https://api.canva.com/rest/v1/folders

Similarly, to upload an asset you need the following HTTP method and URL path:

HTTP Method: POST

URL Path: https://api.canva.com/rest/v1/assets/upload

The API Reference section also specifies the request parameters required for your operation.

To create a folder you need the following header and body parameters:

Authorization: Bearer {token}

Content-Type: application/json

#namestring
Required

Name of the folder

#parent_folder_idstring?
Optional

Create a folder in this folder. Defaults to the root folder (main folder) if not provided.

Similarly, to upload an asset you need the following header and body parameters:

Authorization: Bearer {token}

Content-Type: application/json

Upload-Metadata: {Upload Metadata}

Upload-Metadata

#namestring
Required

Name of the asset. This is displayed in the UI.

#parent_folder_idstring
Optional

ID of the folder where the asset will be uploaded.

#tagsstring
Optional

A set of tags to attach to the asset. This is displayed in the UI.

The binary blob of the uploaded file. Can be attached to curl using --data-binary "@filepath".

Once you know the HTTP method, path, and request parameters, you can create the curl request.

For example, let your access token be eyJraWQiOiI3MjUxMzM0ZS1hNTUzL.

The CURL request for creating a folder named Team (in the root directory) becomes:

curl --request POST 'https://api.canva.com/rest/v1/folders' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJraWQiOiI3MjUxMzM0ZS1hNTUzL' \
--data '{
"name": "Team",
"parent_folder_id": "root"
}'
sh

The success response looks like the following:

{
"folder": {
"id": "FvqYUvJO28i",
"name": "Team",
"created_at": 1672514508,
"updated_at": 1675318908
}
}
json

The CURL request for uploading an asset (an image named John Doe) to the Team folder (with folder id: FvqYUvJO28i) is:

curl --request POST 'https://api.canva.com/rest/v1/assets/upload' \
--header 'content-type: application/octet-stream' \
--header 'Upload-Metadata: {
"name":"John Doe",
"tags":"manager",
"parent_folder_id":"FvqYUvJO28i"
}' \
--header 'Authorization: Bearer eyJraWQiOiI3MjUxMzM0ZS1hNTUzL' \
--data '@/Users/username/folder-location/johndoe.png'
sh

The success response looks like the following:

{
"asset": {
"id": "QvqYUvJO28i",
"name": "John Doe",
"tags": ["manager"],
"parent_folder_id": "FvqYUvJO28i",
"import_status": {
"state": "IN_PROGRESS"
},
"created_at": 1672514508,
"updated_at": 1675318908
}
}
json