Mailpark
API reference

Assets

Images for templates. Uploading is two steps: create the asset to get a signed upload form, POST the file to it, then mark the asset complete. Files up to 5 MB: JPEG, PNG, GIF or WebP.

The Asset object
type Asset = {
  id: string; url: string; filename: string;
  content_type: string; size: number;
  width: number | null; height: number | null;
  created_at: string;
};

List assets

GET/v1/assets

Uploaded images, newest first.

curl https://api.mailpark.io/v1/assets \
  -H "Authorization: Bearer $MAILPARK_API_KEY"
Response · 200
{
  "data": [
    {
      "id": "ast_4Fk9",
      "url": "https://assets.mailpark.io/acc_demo/ast_4Fk9/hero.png",
      "filename": "hero.png",
      "content_type": "image/png",
      "size": 182044,
      "width": 1200,
      "height": 600,
      "created_at": "2026-10-22T10:02:11Z"
    }
  ],
  "next_cursor": null
}
▶ Try it in the playground

Start an upload

POST/v1/assets

Creates the asset and returns a signed form. POST a multipart form to upload.url with every entry of upload.fields, then the file. The form expires in 10 minutes.

scope templates:write

Body

  • filenamestringrequired

    e.g. hero.png.

  • content_typestringrequired

    image/jpeg, image/png, image/gif or image/webp.

  • sizeintegerrequired

    Bytes, up to 5 MB.

  • widthinteger

    Pixels.

  • heightinteger

    Pixels.

curl -X POST https://api.mailpark.io/v1/assets \
  -H "Authorization: Bearer $MAILPARK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filename": "hero.png",
    "content_type": "image/png",
    "size": 182044,
    "width": 1200,
    "height": 600
  }'
Response · 200
{
  "asset": {
    "id": "ast_4Fk9",
    "url": "https://assets.mailpark.io/acc_demo/ast_4Fk9/hero.png",
    "filename": "hero.png",
    "content_type": "image/png",
    "size": 182044,
    "width": 1200,
    "height": 600,
    "created_at": "2026-10-22T10:02:11Z"
  },
  "upload": {
    "url": "https://mailpark-assets.s3.amazonaws.com/",
    "fields": {
      "key": "acc_demo/ast_4Fk9/hero.png",
      "Content-Type": "image/png",
      "Policy": "eyJ…",
      "X-Amz-Signature": "3f1c…"
    }
  }
}
▶ Try it in the playground

Finish an upload

POST/v1/assets/{id}/complete

Call after the file is uploaded. Returns the asset with its public url.

scope templates:write

Path parameters

  • idstringrequired

    ast_…

curl -X POST https://api.mailpark.io/v1/assets/ast_4Fk9/complete \
  -H "Authorization: Bearer $MAILPARK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
Response · 200
{
  "id": "ast_4Fk9",
  "url": "https://assets.mailpark.io/acc_demo/ast_4Fk9/hero.png",
  "filename": "hero.png",
  "content_type": "image/png",
  "size": 182044,
  "width": 1200,
  "height": 600,
  "created_at": "2026-10-22T10:02:11Z"
}
▶ Try it in the playground

Remove an asset

DELETE/v1/assets/{id}

Hides the image from the library. The file stays, so emails already sent keep their images.

scope templates:write

Path parameters

  • idstringrequired

    ast_…

curl -X DELETE https://api.mailpark.io/v1/assets/ast_4Fk9 \
  -H "Authorization: Bearer $MAILPARK_API_KEY"
Response · 200
{
  "removed": true
}
▶ Try it in the playground