POST /publish/resources/get

API reference for the "/publish/resources/get" endpoint.

If a publish extension uses the Flat list or Nested list layout, the user can select a container (folder) before publishing their design. If the user selects a container, Canva sends a POST request to the following endpoint:

<base_url>/publish/resources/get

Canva sends the request immediately before sending the request to the /publish/resources/upload endpoint.

The purpose of the request is to verify that:

  • The selected container still exists on the destination platform.

  • The user still has access to the selected container.

If the extension can't verify the existence of the container or the permissions of the user, Canva shows an error to the user and doesn't continue the publishing process.

Notes

  • Extensions must respond to this request within 8 seconds.

  • When sending this request, Canva replaces <base_url> with the extension's Base URL. You can configure the Base URL via the Developer Portal.

Request

Endpoint

POST <base_url>/publish/resources/get

Headers

Property

Type

Required

Description

X-Canva-Signatures

string

Yes

A comma-separated list of request signatures.

X-Canva-Timestamp

string

Yes

The UNIX timestamp (in seconds) of when Canva sent the request.

Body

Properties

Property

Type

Required

Description

user

string

Yes

The ID of the user.

brand

string

Yes

The ID of the user's team.

label

string

Yes

The type of extension that sent the request.

id

string

Yes

The ID of the selected container.

preferredThumbnailHeight

integer

Yes

The recommended height (in pixels) of any thumbnails in the response.

preferredThumbnailWidth

integer

Yes

The recommended width (in pixels) of any thumbnails in the response.

Example

{
"preferredThumbnailHeight": 500,
"preferredThumbnailWidth": 500,
"user": "<user>",
"brand": "<brand>",
"label": "<label>",
"id": "<id>"
}

Responses

200 - Success

The response an extension provides when the selected container still exists on the destination platform.

Properties

Property

Type

Required

Description

type

"SUCCESS"

Yes

The type of response.

resource

object

Yes

‚Äč

resource.id

string

Yes

A unique ID for the resource.

resource.name

string

Yes

A human readable name for the resource.

resource.type

string

Yes

The type of resource. Canva renders "CONTAINER" resources as folders and "IMAGE" resources as files. Enum: "CONTAINER", "IMAGE"

resource.thumbnail

object

No

A thumbnail image. If you don't provide the dimensions of a thumbnail, Canva sends a HEAD request to the URL to request its dimensions. This adds a perceptible delay to thumbnail load times and may result in CORS issues. As such, we recommend always providing the dimensions.

resource.isOwner

boolean

Yes

A value of true indicates that the user is the owner of the resource.

resource.readOnly

boolean

Yes

A value of true indicates that the user has read-only access to the resource.

Example

{
"resource": {
"isOwner": true,
"readOnly": true,
"id": "<id>",
"name": "<name>",
"type": "<type>"
},
"type": "SUCCESS"
}

200 - Error

Properties

Property

Type

Required

Description

type

"ERROR"

Yes

The type of response.

errorCode

string

Yes

An error code that describes what went wrong. Enum: "CONFIGURATION_REQUIRED", "FORBIDDEN", "INTERNAL_ERROR", "INVALID_REQUEST", "NOT_FOUND", "TIMEOUT"

Example

{
"type": "ERROR",
"errorCode": "<error_code>"
}

401 - Invalid request signature or timestamp

An extension must verify the request signature and timestamp of all incoming requests. When an extension can't verify either of these values, it must reject the request with a 401 status code.