Stashr

Stashr docs

API access, projects, uploads, clean links, transforms, usage, and billing.

API Reference

Use the versioned management API from a server, CMS, build process, or trusted automation:

https://stashr.dev/api/v1

The machine-readable OpenAPI 3.1 contract includes every supported method, request body, response schema, and error status.

Authentication

Send one of these headers:

Authorization: Bearer stshr_live_...
X-API-Key: stshr_live_...

API keys are server-side credentials. Do not place them in browser JavaScript, mobile bundles, public repositories, or URLs.

Scopes

ScopeAccess
assets:readRead workspace details, projects, folders, assets, usage, and upload settings.
assets:writeCreate, update, move, upload, and delete DAM resources, and change upload settings.

Existing keys keep their scopes and automatically work with the expanded DAM endpoints.

Endpoints

MethodPathScopePurpose
GET/workspaceReadGet the key's workspace and slug.
GET, POST/projectsRead, WriteList or create projects.
GET, PATCH, DELETE/projects/{projectId}Read, WriteRead, update, or delete one project.
GET, POST/assetsRead, WriteList or upload assets.
GET/assets/lookupReadResolve JSON metadata from projectSlug and path.
GET, PATCH, DELETE/assets/{assetId}Read, WriteRead, update, move, rename, or delete an asset.
GET/assets/{assetId}/fileReadFetch a file through a 302 delivery redirect.
GET, DELETE/assets/by-path/{projectSlug}/{assetPath}Read, WriteFetch or delete a file by path.
GET, POST, DELETE/foldersRead, WriteList, create, or delete folders by path.
GET, PATCH, DELETE/folders/{folderId}Read, WriteRead, update, move, or delete a folder.
GET/usageReadRead storage, delivery, project, and asset usage.
GET, PATCH/settings/optimizationRead, WriteRead or change upload optimization defaults.

Paths in this table are relative to https://stashr.dev/api/v1.

Asset Upload Requests

Uploads use multipart/form-data with two parts:

PartStatusContent
fileRequiredThe binary file, up to 100 MB.
metadataRequired for new integrationsA JSON object containing projectSlug or projectId plus any optional asset metadata.

Inside metadata, at least one project identifier is required. folderPath, title, altText, tags, and storeOriginalImages are optional. Existing flat multipart metadata fields remain compatible, but they cannot be mixed with the JSON metadata part. See Uploads and API recipes for language-selectable examples.

Asset Listing

Uploads and asset listings require projectSlug or projectId. Prefer stable project slugs in integrations.

By default, listing returns every asset directly in the selected folder. Omit folderPath to list the project root.

For a paginated whole-project scan:

GET /api/v1/assets?projectSlug=website&recursive=true&page=1&limit=100

limit can be from 1 to 100. Sending either page or limit activates pagination. Responses include:

{
  "assets": [],
  "pagination": {
    "page": 1,
    "limit": 100,
    "total": 0,
    "totalPages": 0,
    "nextPage": null
  }
}

Add folderPath, q, or kind=image|pdf|audio|video|file to narrow results. Original and optimized image files are returned as one logical asset with an optional variants array.

Delivery Paths

Asset responses contain relative deliveryUrl and publicPath values. Prefix the returned value with the Stashr origin:

const publicUrl = new URL(asset.deliveryUrl, "https://stashr.dev").href;

Always use the returned path. Image optimization can change the stored extension or add a variant suffix.

File endpoints return 302; use a client that follows redirects, or use the public delivery URL directly. Public delivery is subject to the workspace delivery allowance.

Errors

Errors use JSON:

{
  "error": "Project is required",
  "code": "PROJECT_REQUIRED"
}

Validation errors can also include issues. Common status codes are:

StatusMeaning
400Invalid fields, paths, filters, or uploaded content.
401API key missing, revoked, or invalid.
402Delivery allowance exhausted.
403Scope, plan, storage, or media restriction.
404Resource is not in the key's workspace.
409Duplicate path/slug, non-empty folder, or confirmation required.
429Rate limit exceeded; inspect Retry-After and RateLimit headers.
502The media service could not complete the operation.

The external API allows 300 requests per minute, mutations allow 120 per minute, and uploads allow 30 per minute. The most restrictive applicable limit wins.

Management Versus Delivery

The management API uses a private API key to organize and update assets. Public delivery links do not use an API key. Image transforms are also public delivery URL parameters, not management endpoints. See Image transforms.