Public Alpha. Easel is in early development, so expect rough edges.

Easel

← API Documentation

Digital Files API

Manage the downloadable file attached to a digital product variant. Uploads
use multipart/form-data. When a customer buys a digital variant, Easel issues
a download link for the file. See Order Downloads for the
customer-facing side.

Endpoints

There is no list endpoint. The file is returned when it is uploaded, and a
variant carries at most one digital file.


Upload Digital File

Attach a file to a digital product variant. Send the file as a part in a
multipart/form-data body. If the body contains more than one file, only the
first is stored.

Endpoint: POST /api/v1/products/{id}/variants/{variant_id}/digital-files/

Permission Required: Write

Limits

  • The file must be 500 MiB or smaller.

Request

curl -X POST "https://studio.easel.engineering/api/v1/products/pro_d0b6fmv28q6vn14peun0/variants/prv_d0b6fmv28q6vn14peun0/digital-files/" \
  -H "Authorization: Bearer your_api_key_here" \
  -H "Idempotency-Key: unique-request-id-12345" \
  -F "file=@ebook.pdf"

Response

Status: 201 Created

{
  "id": "pdf_d0b6fmv28q6vn14peun0",
  "file_name": "ebook.pdf",
  "file_size": 1048576,
  "created_at": "2023-01-01T10:00:00Z",
  "updated_at": "2023-01-01T10:00:00Z"
}

Error Responses

Missing file

Status: 400 Bad Request

{
  "error": "file is required",
  "code": "MISSING_FIELD"
}

Variant not found

Status: 404 Not Found

{
  "error": "Resource not found",
  "code": "NOT_FOUND"
}

File too large

Status: 500 Internal Server Error

{
  "error": "Internal server error",
  "code": "INTERNAL_ERROR"
}

Delete Digital File

Delete the file attached to a variant.

Endpoint: DELETE /api/v1/products/{id}/variants/{variant_id}/digital-files/{file_id}/

Permission Required: Write

Request

curl -X DELETE "https://studio.easel.engineering/api/v1/products/pro_d0b6fmv28q6vn14peun0/variants/prv_d0b6fmv28q6vn14peun0/digital-files/pdf_d0b6fmv28q6vn14peun0/" \
  -H "Authorization: Bearer your_api_key_here"

Response

Status: 204 No Content

Error Responses

File not found

Status: 404 Not Found

{
  "error": "Resource not found",
  "code": "NOT_FOUND"
}

Digital File Object

Fields

Field Type Description
id string Digital file public ID
file_name string Original file name
file_size integer File size in bytes
created_at string ISO 8601 timestamp
updated_at string ISO 8601 timestamp