Stashr

Stashr docs

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

Start Here

Upload an asset, then publish it with a delivery URL or readable public path.

1. Create A Project

Create a project in the dashboard or through the management API with a short slug:

const baseUrl = "https://stashr.dev";
const apiKey = process.env.STASHR_API_KEY;
const projectId = process.env.STASHR_PROJECT_ID || "";
const folderId = process.env.STASHR_FOLDER_ID || "";
const assetId = process.env.STASHR_ASSET_ID || "";
const authHeaders = { Authorization: "Bearer " + apiKey };
const payload = {
  "name": "Website",
  "slug": "website",
  "description": "Website assets"
};

const response = await fetch(baseUrl + "/api/v1/projects", {
  method: "POST",
  headers: { ...authHeaders, "Content-Type": "application/json" },
  body: JSON.stringify(payload)
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());

Every upload must belong to a project.

2. Upload Your First Asset

Upload from the dashboard. Pick the project first, then choose an optional folder path:

brand/launch

For automated uploads, create an API key and upload from your server, CMS, or build tool:

import { readFile } from "node:fs/promises";

const metadata = {
  "projectSlug": "website",
  "folderPath": "brand/launch",
  "title": "Hero image",
  "altText": "Dashboard preview on a laptop",
  "tags": ["hero", "launch"],
  "storeOriginalImages": false
};
const form = new FormData();
form.set("metadata", JSON.stringify(metadata));
form.set("file", new Blob([await readFile("./hero.png")], { type: "image/png" }), "hero.png");

const response = await fetch(baseUrl + "/api/v1/assets", {
  method: "POST",
  headers: authHeaders,
  body: form
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());

The binary file and one project identifier are required. Folder path, title, alt text, tags, and original-image storage are optional.

3. Use The Clean Link

Copy the asset link. Images can be resized and converted from the URL:

<img
  src="https://stashr.dev/acme/website/brand/launch/hero.optimized.webp?w=1200&format=webp&q=82"
  alt="Dashboard preview on a laptop"
/>

Use the URL anywhere the asset should appear.

Use the returned deliveryUrl rather than constructing the stored filename. See Image transforms for URL parameter limits.

4. Keep An Eye On Usage

The dashboard and GET /api/v1/usage show storage, project count, asset count, media mix, delivery, and active API keys.