TrellisDevelopers

Media Uploads

POST
/media/uploads/direct

Header Parameters

x-tenant-id?string

Selects the tenant by id. When both tenant headers are omitted, the server falls back to the configured default tenant slug.

x-tenant-slug?string

Selects the tenant by slug. Use this when you know the tenant slug instead of the tenant id.

x-location-id?string

Adds a location scope to the request for location-aware reads, writes, and audit entries.

x-auth-provider?"hexclave"

Test-only Hexclave provider identifier used with x-auth-user-id when trusted identity headers are explicitly enabled. Production clients must use a Hexclave bearer token.

Value in

  • "hexclave"
x-auth-user-id?string

Temporary auth subject used to resolve the acting staff user through the staff auth identity mapping.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/media/uploads/direct" \  -H "x-tenant-id: tenant-local" \  -H "x-tenant-slug: trellis-local" \  -H "x-location-id: loc-tasting-room" \  -H "x-auth-provider: hexclave" \  -H "x-auth-user-id: user_abc123" \  -H "Content-Type: application/json" \  -d '{    "kind": "product_image"  }'
{  "asset": {    "id": "string",    "tenantId": "string",    "locationId": "string",    "kind": "product_image",    "provider": "cloudflare_images",    "providerAssetId": "string",    "uploadUrl": "string",    "publicUrl": "string",    "variants": {      "property1": "string",      "property2": "string"    },    "status": "draft",    "filename": "string",    "mimeType": "string",    "width": 1,    "height": 1,    "sizeBytes": 0,    "checksum": "string",    "linkedEntityType": "string",    "linkedEntityId": "string",    "role": "string",    "metadata": {      "property1": null,      "property2": null    },    "createdByStaffUserId": "string",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  },  "uploadUrl": "string",  "expiresAt": "2019-08-24T14:15:22Z"}