# Create an app (/docs/api-reference/apps/create-app) `POST https://api.remagica.com/api/v1/apps` Makes the app of a workflow page (a page has at most one: asking again returns it). It starts as a `draft` with no inputs or outputs. Requires scope `apps:write`. Request and response schemas: the operation at `/apps` in https://api.remagica.com/api/v1/openapi.json. # Delete an app (/docs/api-reference/apps/delete-app) `DELETE https://api.remagica.com/api/v1/apps/{appId}` Deletes an app. Runs people made keep their results in their own workspaces. Requires scope `apps:write`. Request and response schemas: the operation at `/apps/{appId}` in https://api.remagica.com/api/v1/openapi.json. # Get an app (/docs/api-reference/apps/get-app) `GET https://api.remagica.com/api/v1/apps/{appId}` Returns an app: its form (the inputs a run takes, with the app's own values), its outputs and an estimate of a run's cost. Requires scope `apps:read`. Request and response schemas: the operation at `/apps/{appId}` in https://api.remagica.com/api/v1/openapi.json. # Get a page's app (/docs/api-reference/apps/get-page-app) `GET https://api.remagica.com/api/v1/workflows/{workflowId}/app` Returns the app of a workflow page, or `null` when it has none. Requires scope `apps:read`. Request and response schemas: the operation at `/workflows/{workflowId}/app` in https://api.remagica.com/api/v1/openapi.json. # List your app runs (/docs/api-reference/apps/list-app-runs) `GET https://api.remagica.com/api/v1/apps/{appId}/runs` Your 30 most recent runs of an app, newest first. Requires scope `apps:read`. Request and response schemas: the operation at `/apps/{appId}/runs` in https://api.remagica.com/api/v1/openapi.json. # List apps (/docs/api-reference/apps/list-apps) `GET https://api.remagica.com/api/v1/apps` Apps to run: your workspace's (`team`), your own (`mine`), the community's public ones (`community`), or those waiting for review (`review`, platform admins). 100 at most, newest first. Requires scope `apps:read`. Request and response schemas: the operation at `/apps` in https://api.remagica.com/api/v1/openapi.json. # Publish an app (/docs/api-reference/apps/publish-app) `POST https://api.remagica.com/api/v1/apps/{appId}/publish` Publishes the app: its page, inputs and outputs as they are now become what runs. A `team` or `personal` app is `published` at once; a `public` one goes `in_review` until a platform admin approves it. Requires scope `apps:publish`. Request and response schemas: the operation at `/apps/{appId}/publish` in https://api.remagica.com/api/v1/openapi.json. # Remix an app (/docs/api-reference/apps/remix-app) `POST https://api.remagica.com/api/v1/apps/{appId}/remix` Copies an app's workflow (its published page, or the draft for its editors) into a new project of yours, to change and build on. The app must allow remixing, unless you can edit it. Requires scope `apps:write`. Request and response schemas: the operation at `/apps/{appId}/remix` in https://api.remagica.com/api/v1/openapi.json. # Run an app (/docs/api-reference/apps/start-app-run) `POST https://api.remagica.com/api/v1/apps/{appId}/runs` Runs an app with your values: they go into a copy of its published page in a workflow of your own, and every node its outputs need runs there (your workspace pays). Results show up `pending` at once. Follow them with `GET /workflows/{workflowId}/events` (the run's `workflowId`), or poll `GET /workflow-runs/{runId}`. A run that can't start is refused with `409 RUN_REFUSED`, as a workflow run is. Requires scope `apps:run`. Request and response schemas: the operation at `/apps/{appId}/runs` in https://api.remagica.com/api/v1/openapi.json. # Update an app (/docs/api-reference/apps/update-app) `PATCH https://api.remagica.com/api/v1/apps/{appId}` Changes an app's name, description, cover, visibility, inputs or outputs. Inputs and outputs only reach people when it's published again; a visibility change on a published app takes effect then too. Requires scope `apps:write`. Request and response schemas: the operation at `/apps/{appId}` in https://api.remagica.com/api/v1/openapi.json. # Create a brand kit from a file (/docs/api-reference/brand-kits/create-brand-kit-from-file) `POST https://api.remagica.com/api/v1/brand-kits/from-file` Makes a brand kit from a brand file you uploaded (a PDF or Word brand book, up to 50 MB): its text is summarised into the kit's sections and its pictures become the kit's photography. Requires scope `brand:write`. Request and response schemas: the operation at `/brand-kits/from-file` in https://api.remagica.com/api/v1/openapi.json. # Create a brand kit from a sample (/docs/api-reference/brand-kits/create-brand-kit-from-sample) `POST https://api.remagica.com/api/v1/brand-kits/from-sample` Copies a sample brand kit (`GET /brand-kits/samples`) into a kit of your own to edit or use. Requires scope `brand:write`. Request and response schemas: the operation at `/brand-kits/from-sample` in https://api.remagica.com/api/v1/openapi.json. # Create a brand kit from a website (/docs/api-reference/brand-kits/create-brand-kit-from-website) `POST https://api.remagica.com/api/v1/brand-kits/from-website` Makes a brand kit from a brand's website: its name, colours, fonts, logo and share image, with mission, values, tone, photography, spacing and do's and don'ts written from its text. The page is fetched from our servers (public addresses only). Requires scope `brand:write`. Request and response schemas: the operation at `/brand-kits/from-website` in https://api.remagica.com/api/v1/openapi.json. # Create a brand kit (/docs/api-reference/brand-kits/create-brand-kit) `POST https://api.remagica.com/api/v1/brand-kits` Adds a brand kit to the Team or your Private scope. Images are storage keys of the workspace's own images (uploads, generations, Library files). Requires scope `brand:write`. Request and response schemas: the operation at `/brand-kits` in https://api.remagica.com/api/v1/openapi.json. # Delete a brand kit (/docs/api-reference/brand-kits/delete-brand-kit) `DELETE https://api.remagica.com/api/v1/brand-kits/{brandKitId}` Deletes a brand kit. Its images stay in storage (the Library may use them). Requires scope `brand:delete`. Request and response schemas: the operation at `/brand-kits/{brandKitId}` in https://api.remagica.com/api/v1/openapi.json. # Duplicate a brand kit (/docs/api-reference/brand-kits/duplicate-brand-kit) `POST https://api.remagica.com/api/v1/brand-kits/{brandKitId}/duplicate` Copies a brand kit you can see into a new one you own, named “ copy” unless you name it. Requires scope `brand:write`. Request and response schemas: the operation at `/brand-kits/{brandKitId}/duplicate` in https://api.remagica.com/api/v1/openapi.json. # Get a brand kit (/docs/api-reference/brand-kits/get-brand-kit) `GET https://api.remagica.com/api/v1/brand-kits/{brandKitId}` Requires scope `brand:read`. Request and response schemas: the operation at `/brand-kits/{brandKitId}` in https://api.remagica.com/api/v1/openapi.json. # List brand kits (/docs/api-reference/brand-kits/list-brand-kits) `GET https://api.remagica.com/api/v1/brand-kits` The workspace's Team brand kits and your Private ones, last edited first. Requires scope `brand:read`. Request and response schemas: the operation at `/brand-kits` in https://api.remagica.com/api/v1/openapi.json. # List sample brand kits (/docs/api-reference/brand-kits/list-sample-brand-kits) `GET https://api.remagica.com/api/v1/brand-kits/samples` Sample brand kits: made-up brands that show a full kit. Copy one with `POST /brand-kits/from-sample`. Requires scope `brand:read`. Request and response schemas: the operation at `/brand-kits/samples` in https://api.remagica.com/api/v1/openapi.json. # Update a brand kit (/docs/api-reference/brand-kits/update-brand-kit) `PATCH https://api.remagica.com/api/v1/brand-kits/{brandKitId}` Changes a brand kit: the fields you send replace theirs (lists whole, in order); the rest stay. Requires scope `brand:write`. Request and response schemas: the operation at `/brand-kits/{brandKitId}` in https://api.remagica.com/api/v1/openapi.json. # Re-export a clip (/docs/api-reference/clip-exports/create-clip-export) `POST https://api.remagica.com/api/v1/clips/{clipId}/exports` Re-renders one of your clips with a new caption style, a changed hook (text, look, position or hidden) and/or edited words. Nothing is re-transcribed or re-cut: the worker burns the clip's clean picture again, so an export takes seconds. Everything in the body is optional; whatever is left out stays as the clip has it. The response is `202 Accepted` with the export id; poll `GET /clips/{clipId}/exports/{exportId}` until `status` is `completed` (then `videoUrl` is the new clip) or `failed`. Clips made before re-exports existed have no `words.json` and answer `409 CONFLICT`. An export costs credits for the clip's length (a base plus each minute), charged when it starts (`402` when the workspace can't cover it) and refunded if it fails. Requires scope `clips:submit`. Request and response schemas: the operation at `/clips/{clipId}/exports` in https://api.remagica.com/api/v1/openapi.json. # Get a clip export (/docs/api-reference/clip-exports/get-clip-export) `GET https://api.remagica.com/api/v1/clips/{clipId}/exports/{exportId}` Returns one export of your clip. Once `status` is `completed`, `videoUrl` and `posterUrl` are the new clip and its poster. Poll every second or two while it is `queued` or `processing`. Requires scope `clips:read`. Request and response schemas: the operation at `/clips/{clipId}/exports/{exportId}` in https://api.remagica.com/api/v1/openapi.json. # List a clip's exports (/docs/api-reference/clip-exports/list-clip-exports) `GET https://api.remagica.com/api/v1/clips/{clipId}/exports` Returns the 100 most recent exports of one of your clips, newest first, with download links for the finished ones. Requires scope `clips:read`. Request and response schemas: the operation at `/clips/{clipId}/exports` in https://api.remagica.com/api/v1/openapi.json. # Create a clip job (/docs/api-reference/clip-jobs/create-clip-job) `POST https://api.remagica.com/api/v1/clip-jobs` Queues a job that turns one of your uploads into short vertical clips: it finds the strongest moments, reframes them to 9:16 and adds captions and a hook card. Processing is asynchronous and takes minutes. The response is `202 Accepted` with the job id; poll `GET /clip-jobs/{jobId}` (every 5 seconds or so) until `status` is `completed` or `failed`, or stream `GET /clip-jobs/{jobId}/events`. `progress` says which stage the job is in and how far along it is. A job costs credits per minute of source it processes (see `GET /credits`). The upload's length is measured from the file itself when the job is created (a file whose length can't be read is refused with `400`), and credits for that length, cut to `maxMinutes`, are set aside then (`402` when the workspace can't cover it). The job processes no more of the source than that, is charged for the minutes it processed when it completes (never more than was set aside), and nothing if it fails. Requires scope `clips:submit`. Request and response schemas: the operation at `/clip-jobs` in https://api.remagica.com/api/v1/openapi.json. # Get a clip job (/docs/api-reference/clip-jobs/get-clip-job) `GET https://api.remagica.com/api/v1/clip-jobs/{jobId}` Returns one of your jobs. `progress` says what it is doing (stage, percent, a short message, clips rendered so far and, while rendering, a rough ETA). Once `status` is `completed`, `clips` lists every clip with a `videoUrl` and `posterUrl` to download. While the job is `queued` or `processing`, poll every 5 seconds or so (progress changes at each stage and after each clip, every few seconds to a minute), or stream `GET /clip-jobs/{jobId}/events` instead. Requires scope `clips:read`. Request and response schemas: the operation at `/clip-jobs/{jobId}` in https://api.remagica.com/api/v1/openapi.json. # List clip jobs (/docs/api-reference/clip-jobs/list-clip-jobs) `GET https://api.remagica.com/api/v1/clip-jobs` Returns your 100 most recent jobs, newest first, each with its clip count and progress. Fetch one with `GET /clip-jobs/{jobId}` for its clips. Requires scope `clips:read`. Request and response schemas: the operation at `/clip-jobs` in https://api.remagica.com/api/v1/openapi.json. # List clips (/docs/api-reference/clip-jobs/list-clips) `GET https://api.remagica.com/api/v1/clips` Lists the clips of all your jobs, a page at a time: newest job first, each job's clips in order, with links to the poster and the video. Clips show up here as each one renders. Requires scope `clips:read`. Request and response schemas: the operation at `/clips` in https://api.remagica.com/api/v1/openapi.json. # Stream a clip job's progress (/docs/api-reference/clip-jobs/watch-clip-job) `GET https://api.remagica.com/api/v1/clip-jobs/{jobId}/events` Streams one of your jobs' status and progress as server-sent events (`text/event-stream`): the current state at once, then a `message` event whenever the stage, percent, message or status changes. Each event's `data` is JSON (`id`, `status`, `error`, `progress`, as on `GET /clip-jobs/{jobId}`). Once the job is `completed` or `failed`, its final state is sent as a `message`, then a `done` event (`{"status": "completed"}` or `"failed"`) ends the stream: close your `EventSource` on `done`, or it reconnects and gets the final state again. A stream closed without `done` (after 30 minutes at most, or a server restart) means the job is still running: reconnect to keep watching. The server checks the job every 2 seconds and sends a keep-alive comment every 15 seconds. An unknown job, or someone else's, is a `404` before the stream starts. Requires scope `clips:read`. Request and response schemas: the operation at `/clip-jobs/{jobId}/events` in https://api.remagica.com/api/v1/openapi.json. # Let AI pick thumbnail frames (/docs/api-reference/generations/analyze-video-frames) `POST https://api.remagica.com/api/v1/video-frames/analyze` "Let AI pick": finds the video's candidate frames (as `extract`), then has a vision model tag each one (people and expressions, products, the setting, the moment, the thumbnail role it suits) and pick the best 1–3 with a reason; with speech, it also suggests a thumbnail brief. Kept per video content: a video analyzed before returns its result at once, free. Otherwise the analysis is queued and charged (`402` when the workspace can't cover it; refunded if it fails): follow it with `GET /video-frames/{analysisId}/events`. Videos up to 2 GB. Requires scope `generations:submit`. Request and response schemas: the operation at `/video-frames/analyze` in https://api.remagica.com/api/v1/openapi.json. # Cancel a generation (/docs/api-reference/generations/cancel-generation) `POST https://api.remagica.com/api/v1/generations/{generationId}/cancel` Cancels a generation that hasn't finished, as a workflow's Stop does. One still queued, here or at its provider (which then drops it), is `cancelled` and its credits come back. One its provider is already rendering (or may have started: a request on its way) can't be stopped without being billed, so it's kept: it finishes, is charged, and comes back with `stopRequested: true` and its `status` unchanged. Nothing more is sent for it either way. Requires scope `generations:cancel`. Request and response schemas: the operation at `/generations/{generationId}/cancel` in https://api.remagica.com/api/v1/openapi.json. # Remove an image's background (/docs/api-reference/generations/create-background-removal-generation) `POST https://api.remagica.com/api/v1/generations/background-removals` Starts generating a cutout of `image`: its subject on a transparent background (a PNG). Pick the model from `GET /models`; the request is validated against what that model accepts, and files are referenced by storage key (an upload's `key` or an earlier generation's output `key`). The response is `202 Accepted` with the generation. Poll `GET /generations/{generationId}` until `status` is `completed` (then `outputs` holds the files) or `failed`. Requires scope `generations:submit`. Request and response schemas: the operation at `/generations/background-removals` in https://api.remagica.com/api/v1/openapi.json. # Register a character (/docs/api-reference/generations/create-character) `POST https://api.remagica.com/api/v1/characters` Registers a character the provider already holds (ModelArk: a preset digital character or an authorised real person), for one workspace or, with `shared`, for every workspace. Platform admins only. Requires scope `generations:submit`. Request and response schemas: the operation at `/characters` in https://api.remagica.com/api/v1/openapi.json. # Generate images (/docs/api-reference/generations/create-image-generation) `POST https://api.remagica.com/api/v1/generations/images` Starts generating images from a prompt, optionally editing or composing reference images. Pick the model from `GET /models`; the request is validated against what that model accepts, and files are referenced by storage key (an upload's `key` or an earlier generation's output `key`). Mention Library items in the prompt with their `mention` token (`[@ id="lib:" label="ninja"]`, or `lib:@v2` for a version): their files are added after your references, the prompt points at them, and their locked descriptions are added. Point at references yourself as `@Image1`, `@Video1`, `@Audio1` (the n-th of that kind); each provider gets its own syntax. The response is `202 Accepted` with the generation. Poll `GET /generations/{generationId}` until `status` is `completed` (then `outputs` holds the files) or `failed`. Requires scope `generations:submit`. Request and response schemas: the operation at `/generations/images` in https://api.remagica.com/api/v1/openapi.json. # Generate music (/docs/api-reference/generations/create-music-generation) `POST https://api.remagica.com/api/v1/generations/music` Starts generating a song or instrumental from a description. Pick the model from `GET /models`; the request is validated against what that model accepts, and files are referenced by storage key (an upload's `key` or an earlier generation's output `key`). Mention Library items in the prompt with their `mention` token (`[@ id="lib:" label="ninja"]`, or `lib:@v2` for a version): their files are added after your references, the prompt points at them, and their locked descriptions are added. Point at references yourself as `@Image1`, `@Video1`, `@Audio1` (the n-th of that kind); each provider gets its own syntax. The response is `202 Accepted` with the generation. Poll `GET /generations/{generationId}` until `status` is `completed` (then `outputs` holds the files) or `failed`. Requires scope `generations:submit`. Request and response schemas: the operation at `/generations/music` in https://api.remagica.com/api/v1/openapi.json. # Generate a sound effect (/docs/api-reference/generations/create-sound-effect-generation) `POST https://api.remagica.com/api/v1/generations/sound-effects` Starts generating a sound effect from a description. Pick the model from `GET /models`; the request is validated against what that model accepts, and files are referenced by storage key (an upload's `key` or an earlier generation's output `key`). Mention Library items in the prompt with their `mention` token (`[@ id="lib:" label="ninja"]`, or `lib:@v2` for a version): their files are added after your references, the prompt points at them, and their locked descriptions are added. Point at references yourself as `@Image1`, `@Video1`, `@Audio1` (the n-th of that kind); each provider gets its own syntax. The response is `202 Accepted` with the generation. Poll `GET /generations/{generationId}` until `status` is `completed` (then `outputs` holds the files) or `failed`. Requires scope `generations:submit`. Request and response schemas: the operation at `/generations/sound-effects` in https://api.remagica.com/api/v1/openapi.json. # Generate speech (/docs/api-reference/generations/create-speech-generation) `POST https://api.remagica.com/api/v1/generations/speech` Starts generating speech from text, with word timings in `metadata.timestamps`. Pick the model from `GET /models`; the request is validated against what that model accepts, and files are referenced by storage key (an upload's `key` or an earlier generation's output `key`). Mention Library items in the prompt with their `mention` token (`[@ id="lib:" label="ninja"]`, or `lib:@v2` for a version): their files are added after your references, the prompt points at them, and their locked descriptions are added. Point at references yourself as `@Image1`, `@Video1`, `@Audio1` (the n-th of that kind); each provider gets its own syntax. The response is `202 Accepted` with the generation. Poll `GET /generations/{generationId}` until `status` is `completed` (then `outputs` holds the files) or `failed`. Requires scope `generations:submit`. Request and response schemas: the operation at `/generations/speech` in https://api.remagica.com/api/v1/openapi.json. # Generate a video (/docs/api-reference/generations/create-video-generation) `POST https://api.remagica.com/api/v1/generations/videos` Starts generating a video from a prompt, a first (and last) frame, or reference images, videos and audio. Pick the model from `GET /models`; the request is validated against what that model accepts, and files are referenced by storage key (an upload's `key` or an earlier generation's output `key`). Mention Library items in the prompt with their `mention` token (`[@ id="lib:" label="ninja"]`, or `lib:@v2` for a version): their files are added after your references, the prompt points at them, and their locked descriptions are added. Point at references yourself as `@Image1`, `@Video1`, `@Audio1` (the n-th of that kind); each provider gets its own syntax. The response is `202 Accepted` with the generation. Poll `GET /generations/{generationId}` until `status` is `completed` (then `outputs` holds the files) or `failed`. Requires scope `generations:submit`. Request and response schemas: the operation at `/generations/videos` in https://api.remagica.com/api/v1/openapi.json. # Estimate a generation's cost (/docs/api-reference/generations/estimate-generation) `POST https://api.remagica.com/api/v1/generations/estimate` What a generation would cost, in credits, if you sent it now: send the body you'd send to `POST /generations/images` (or `/videos`, `/music`, `/speech`, `/sound-effects`, `/background-removals`) with `kind` saying which. It's priced exactly as that request is charged, from today's price book, and validated against the model the same way. Nothing is started or charged. Requires scope `models:list`. Request and response schemas: the operation at `/generations/estimate` in https://api.remagica.com/api/v1/openapi.json. # Extract thumbnail frames (/docs/api-reference/generations/extract-video-frames) `POST https://api.remagica.com/api/v1/video-frames/extract` Finds a video's candidate thumbnail frames without a model call: shot changes plus an even grid, near-duplicates dropped, ranked by sharpness, exposure and faces; the best (48 by default) are stored as JPEGs. Free, and kept per video content: a video extracted before returns its frames at once. Otherwise it's queued: follow it with `GET /video-frames/{analysisId}/events`. Videos up to 2 GB. Requires scope `generations:submit`. Request and response schemas: the operation at `/video-frames/extract` in https://api.remagica.com/api/v1/openapi.json. # Get a generation (/docs/api-reference/generations/get-generation) `GET https://api.remagica.com/api/v1/generations/{generationId}` Returns one of your generations. Poll every couple of seconds (images, audio) or every 10 seconds or so (video) while it is `queued` or `running`. Requires scope `generations:read`. Request and response schemas: the operation at `/generations/{generationId}` in https://api.remagica.com/api/v1/openapi.json. # Get a frame analysis (/docs/api-reference/generations/get-video-frames) `GET https://api.remagica.com/api/v1/video-frames/{analysisId}` A video frame analysis: its status and progress, the candidate frames (with download URLs) and, after an AI pick, their tags, the picks and a brief suggestion. Requires scope `generations:read`. Request and response schemas: the operation at `/video-frames/{analysisId}` in https://api.remagica.com/api/v1/openapi.json. # List capabilities (/docs/api-reference/generations/list-capabilities) `GET https://api.remagica.com/api/v1/capabilities` Everything a workflow node can do (make an image, upscale a video, dub, relight, ...) with every model that does it: the node it backs, its default model, and per model the plans that may use it and what a run costs with default settings. Request and response schemas: the operation at `/capabilities` in https://api.remagica.com/api/v1/openapi.json. # List characters (/docs/api-reference/generations/list-characters) `GET https://api.remagica.com/api/v1/characters` The characters your workspace can put in a video (`{ asset: id }` in its frames or references): its own and the shared ones. Requires scope `generations:read`. Request and response schemas: the operation at `/characters` in https://api.remagica.com/api/v1/openapi.json. # List generations (/docs/api-reference/generations/list-generations) `GET https://api.remagica.com/api/v1/generations` Lists your workspace's generations, newest first, a page at a time: filter by kind, status, where they were requested from (`sources`, or leave some out with `excludeSources`) and whether you asked for them (`mine`). Each output carries the Library item it was filed as. Requires scope `generations:read`. Request and response schemas: the operation at `/generations` in https://api.remagica.com/api/v1/openapi.json. # List models (/docs/api-reference/generations/list-models) `GET https://api.remagica.com/api/v1/models` Every model you can generate with: what it makes, what it accepts (`capabilities`) and what it costs (`pricing`). Models are named by what they are (e.g. `google/nano-banana-pro`); which provider serves them is ours to choose and may change without notice. Requires scope `models:list`. Request and response schemas: the operation at `/models` in https://api.remagica.com/api/v1/openapi.json. # List thumbnail formats (/docs/api-reference/generations/list-thumbnail-formats) `GET https://api.remagica.com/api/v1/thumbnail-studio/formats` The thumbnail and cover formats: each platform's exact pixels and the parts of the frame its interface covers (safe zones). Requires scope `models:list`. Request and response schemas: the operation at `/thumbnail-studio/formats` in https://api.remagica.com/api/v1/openapi.json. # List thumbnail recipes (/docs/api-reference/generations/list-thumbnail-recipes) `GET https://api.remagica.com/api/v1/thumbnail-studio/recipes` The thumbnail niche recipes (what each shows, when to use it, its prompt language and curated references) and the job routing table that picks one from a brief. Requires scope `models:list`. Request and response schemas: the operation at `/thumbnail-studio/recipes` in https://api.remagica.com/api/v1/openapi.json. # Plan thumbnail concepts (/docs/api-reference/generations/plan-thumbnail) `POST https://api.remagica.com/api/v1/thumbnail-studio/plan` Turns a thumbnail brief into one to three concepts, each a different click angle: a short hook printed on the image, the references with their roles, and a ready image request for each. With `engine: llm` an art director model looks at the brief's images (video frames, a face, a product, a style) and writes each concept; `layout: collage` builds it from the supplied frames. Library references are `ref-NNNN` ids from the thumbnail reference library. Requires scope `generations:submit`. Request and response schemas: the operation at `/thumbnail-studio/plan` in https://api.remagica.com/api/v1/openapi.json. # Follow your generations (/docs/api-reference/generations/watch-generations) `GET https://api.remagica.com/api/v1/generations/events` Streams your generations as they change, as server-sent events: each one (as `GET /generations` lists it) when it's queued, starts, ends and is filed in the Library. Only yours, not teammates'; `kinds` narrows it further. Nothing is replayed: list your generations when you connect and again whenever you reconnect. The stream ends after 15 minutes; reconnect to keep following. Requires scope `generations:read`. Request and response schemas: the operation at `/generations/events` in https://api.remagica.com/api/v1/openapi.json. # Follow a frame analysis (/docs/api-reference/generations/watch-video-frames) `GET https://api.remagica.com/api/v1/video-frames/{analysisId}/events` Streams one frame analysis as server-sent events: its state at once (as `GET /video-frames/{analysisId}`), then each change, then a `done` event (`{"status": "completed"}` or `"failed"`) when it ends. A stream closed without `done` (after 15 minutes at most) means it's still running: reconnect. Requires scope `generations:read`. Request and response schemas: the operation at `/video-frames/{analysisId}/events` in https://api.remagica.com/api/v1/openapi.json. # API reference (/docs/api-reference) This reference is generated from the API itself, so it lists exactly what API keys can call. Routes that only the app uses aren't here. ## Base URL [#base-url] ```txt https://api.remagica.com/api/v1 ``` Every request sends your key in the `x-api-key` header. Each page shows the scope the endpoint needs; see [Authentication and scopes](/docs/authentication) for the full list. ## Try it [#try-it] Each endpoint has a playground. Paste a key into its `x-api-key` field and send real requests to the API from this page. They run against your workspace and spend its credits, so use a key with only the scopes you're testing. ## Download the spec [#download-the-spec] The OpenAPI 3.1 document is at [`https://api.remagica.com/api/v1/openapi.json`](https://api.remagica.com/api/v1/openapi.json). Point an SDK generator or an API client at it. ## Sections [#sections] # Add a version (/docs/api-reference/library/add-library-version) `POST https://api.remagica.com/api/v1/library/items/{itemId}/versions` Saves a new version of an item (a changed description, references, sheet or voice) and makes it current. Versions never change, so canvases pinned to an older one keep it until they're updated. `basedOn` alone makes an older version (an older sheet) the default again. Requires scope `library:write`. Request and response schemas: the operation at `/library/items/{itemId}/versions` in https://api.remagica.com/api/v1/openapi.json. # Create a folder (/docs/api-reference/library/create-library-folder) `POST https://api.remagica.com/api/v1/library/folders` Adds a folder to the Team or your Private Library, optionally inside another folder of the same scope. Requires scope `library:write`. Request and response schemas: the operation at `/library/folders` in https://api.remagica.com/api/v1/openapi.json. # Create an item (/docs/api-reference/library/create-library-item) `POST https://api.remagica.com/api/v1/library/items` Adds an asset (one file) or an element (a locked description plus ordered reference files) to the Library, from files the workspace already has: uploads, generation outputs, workflow node outputs. Requires scope `library:write`. Request and response schemas: the operation at `/library/items` in https://api.remagica.com/api/v1/openapi.json. # Create a label (/docs/api-reference/library/create-library-label) `POST https://api.remagica.com/api/v1/library/labels` Adds an asset label to the workspace (names are unique, any case). Requires scope `library:write`. Request and response schemas: the operation at `/library/labels` in https://api.remagica.com/api/v1/openapi.json. # Delete a folder (/docs/api-reference/library/delete-library-folder) `DELETE https://api.remagica.com/api/v1/library/folders/{folderId}` Deletes a folder you added. Its items move to the starting folder of its kind; the starting folders can't be deleted. Requires scope `library:delete`. Request and response schemas: the operation at `/library/folders/{folderId}` in https://api.remagica.com/api/v1/openapi.json. # Delete an item (/docs/api-reference/library/delete-library-item) `DELETE https://api.remagica.com/api/v1/library/items/{itemId}` Removes an item from the Library. Prompts that still mention it fail with a message saying it was deleted. Requires scope `library:delete`. Request and response schemas: the operation at `/library/items/{itemId}` in https://api.remagica.com/api/v1/openapi.json. # Delete a label (/docs/api-reference/library/delete-library-label) `DELETE https://api.remagica.com/api/v1/library/labels/{labelId}` Deletes a label; the assets that had it keep the rest. Requires scope `library:delete`. Request and response schemas: the operation at `/library/labels/{labelId}` in https://api.remagica.com/api/v1/openapi.json. # Favorite an item (/docs/api-reference/library/favorite-library-item) `PUT https://api.remagica.com/api/v1/library/items/{itemId}/favorite` Adds an item to your favorites. Requires scope `library:write`. Request and response schemas: the operation at `/library/items/{itemId}/favorite` in https://api.remagica.com/api/v1/openapi.json. # Generate a character sheet (/docs/api-reference/library/generate-library-sheet) `POST https://api.remagica.com/api/v1/library/items/{itemId}/sheets` AI Character: generates a turnaround sheet for an element (four views, full body over portrait) from its reference images and its description, as one image. It's a normal generation and costs its credits. `realistic` and `stylized` are drawn with Nano Banana Pro, which keeps the reference face best across views; Seedance refuses those real-looking faces. `seedance` is drawn with Seedream 5.0 Pro on ModelArk, whose faces Seedance accepts. When the generation completes, reading the item adds the sheet as a new version (the sheet history). Requires scope `library:write`. Request and response schemas: the operation at `/library/items/{itemId}/sheets` in https://api.remagica.com/api/v1/openapi.json. # Read a file's share link (/docs/api-reference/library/get-asset-share) `GET https://api.remagica.com/api/v1/asset-shares` A file's share link: its token, public page and who it lets in. `null` when it was never shared. Requires scope `library:share`. Request and response schemas: the operation at `/asset-shares` in https://api.remagica.com/api/v1/openapi.json. # Get an item (/docs/api-reference/library/get-library-item) `GET https://api.remagica.com/api/v1/library/items/{itemId}` Returns an item with every version (newest first) and download URLs. Sheets that finished generating are added as versions first. Requires scope `library:read`. Request and response schemas: the operation at `/library/items/{itemId}` in https://api.remagica.com/api/v1/openapi.json. # List filter choices (/docs/api-reference/library/list-asset-facets) `GET https://api.remagica.com/api/v1/library/facets` The models and projects your assets came from: the choices of the Assets page's filters. Requires scope `library:read`. Request and response schemas: the operation at `/library/facets` in https://api.remagica.com/api/v1/openapi.json. # List folders (/docs/api-reference/library/list-library-folders) `GET https://api.remagica.com/api/v1/library/folders` The folders of the Team or your Private Library, with how many items each holds. Every Library starts with Character, Scene, Item, Style, Sound Effect and Others. Requires scope `library:read`. Request and response schemas: the operation at `/library/folders` in https://api.remagica.com/api/v1/openapi.json. # List items (/docs/api-reference/library/list-library-items) `GET https://api.remagica.com/api/v1/library/items` Lists and searches the Library, most recently changed first, a page at a time: filter by scope, folder, kind, type and your favorites. Each item carries its `mention` token for prompts. Requires scope `library:read`. Request and response schemas: the operation at `/library/items` in https://api.remagica.com/api/v1/openapi.json. # List labels (/docs/api-reference/library/list-library-labels) `GET https://api.remagica.com/api/v1/library/labels` The workspace's asset labels, by name, with how many assets have each. Requires scope `library:read`. Request and response schemas: the operation at `/library/labels` in https://api.remagica.com/api/v1/openapi.json. # Copy to the other scope (/docs/api-reference/library/move-library-item) `POST https://api.remagica.com/api/v1/library/items/{itemId}/move` Puts a copy of an item in the other scope (Private → Team shares it; Team → Private keeps a copy for you). The original stays where it is; the copy starts at version 1 with the current files. Requires scope `library:write`. Request and response schemas: the operation at `/library/items/{itemId}/move` in https://api.remagica.com/api/v1/openapi.json. # Pin an item (/docs/api-reference/library/pin-library-item) `PUT https://api.remagica.com/api/v1/library/items/{itemId}/pin` Pins an asset for everyone who sees it (the Assets page's Pinned view). It keeps its place in other lists. Requires scope `library:write`. Request and response schemas: the operation at `/library/items/{itemId}/pin` in https://api.remagica.com/api/v1/openapi.json. # Delete an item for good (/docs/api-reference/library/purge-library-item) `DELETE https://api.remagica.com/api/v1/library/items/{itemId}/permanent` Deletes an item in Recently Deleted for good: it can't be restored. Items are purged 30 days after deletion anyway. Requires scope `library:delete`. Request and response schemas: the operation at `/library/items/{itemId}/permanent` in https://api.remagica.com/api/v1/openapi.json. # Restore an item (/docs/api-reference/library/restore-library-item) `POST https://api.remagica.com/api/v1/library/items/{itemId}/restore` Brings a deleted item back from Recently Deleted. Its slug gets a number if another item took it meanwhile. Requires scope `library:delete`. Request and response schemas: the operation at `/library/items/{itemId}/restore` in https://api.remagica.com/api/v1/openapi.json. # Label items (/docs/api-reference/library/set-library-item-labels) `POST https://api.remagica.com/api/v1/library/items/labels` Puts labels on items and takes others off, for many items at once. An item has at most 10 labels. Requires scope `library:write`. Request and response schemas: the operation at `/library/items/labels` in https://api.remagica.com/api/v1/openapi.json. # Set review status (/docs/api-reference/library/set-library-review-status) `POST https://api.remagica.com/api/v1/library/items/review-status` Sets (or, with `null`, clears) the review status of several items at once: To do, In progress, Under review or Done. Requires scope `library:write`. Request and response schemas: the operation at `/library/items/review-status` in https://api.remagica.com/api/v1/openapi.json. # File generations as assets (/docs/api-reference/library/sync-library-generations) `POST https://api.remagica.com/api/v1/library/generations/sync` Files the workspace's completed generations that aren't assets yet (newest first, up to 100). Finished generations are filed as they complete; this catches older ones. Requires scope `library:write`. Request and response schemas: the operation at `/library/generations/sync` in https://api.remagica.com/api/v1/openapi.json. # Unfavorite an item (/docs/api-reference/library/unfavorite-library-item) `DELETE https://api.remagica.com/api/v1/library/items/{itemId}/favorite` Removes an item from your favorites. Requires scope `library:write`. Request and response schemas: the operation at `/library/items/{itemId}/favorite` in https://api.remagica.com/api/v1/openapi.json. # Unpin an item (/docs/api-reference/library/unpin-library-item) `DELETE https://api.remagica.com/api/v1/library/items/{itemId}/pin` Requires scope `library:write`. Request and response schemas: the operation at `/library/items/{itemId}/pin` in https://api.remagica.com/api/v1/openapi.json. # Share a file (/docs/api-reference/library/update-asset-share) `PUT https://api.remagica.com/api/v1/asset-shares` Turns a file's share link on (`view` or `comment`) or off (`restricted`), and sets what its public page shows. The link (`/a/`) stays the same each time it's turned on. Requires scope `library:share`. Request and response schemas: the operation at `/asset-shares` in https://api.remagica.com/api/v1/openapi.json. # Update a folder (/docs/api-reference/library/update-library-folder) `PATCH https://api.remagica.com/api/v1/library/folders/{folderId}` Renames or reorders a folder. Requires scope `library:write`. Request and response schemas: the operation at `/library/folders/{folderId}` in https://api.remagica.com/api/v1/openapi.json. # Update an item (/docs/api-reference/library/update-library-item) `PATCH https://api.remagica.com/api/v1/library/items/{itemId}` Renames an item, changes its slug or kind, or moves it to another folder of its scope. Mentions resolve by id, so prompts keep working. Requires scope `library:write`. Request and response schemas: the operation at `/library/items/{itemId}` in https://api.remagica.com/api/v1/openapi.json. # Update a label (/docs/api-reference/library/update-library-label) `PATCH https://api.remagica.com/api/v1/library/labels/{labelId}` Renames a label or changes its colour. Requires scope `library:write`. Request and response schemas: the operation at `/library/labels/{labelId}` in https://api.remagica.com/api/v1/openapi.json. # Add an image from a link (/docs/api-reference/moodboards/add-moodboard-image-from-link) `POST https://api.remagica.com/api/v1/moodboards/{moodboardId}/images/from-link` Adds a picture from a link to the end of a moodboard: an image address, or a page with a share image. It's fetched from our servers (public addresses only) and kept in your workspace's storage. Requires scope `brand:write`. Request and response schemas: the operation at `/moodboards/{moodboardId}/images/from-link` in https://api.remagica.com/api/v1/openapi.json. # Capture a moodboard's style (/docs/api-reference/moodboards/capture-moodboard-style) `POST https://api.remagica.com/api/v1/moodboards/{moodboardId}/capture-style` Describes the board's shared look (palette, light, mood, composition, textures) from its images with a vision model, and saves it as the board's `styleDescription`. Needs at least 3 images; reads the first 8. Requires scope `brand:write`. Request and response schemas: the operation at `/moodboards/{moodboardId}/capture-style` in https://api.remagica.com/api/v1/openapi.json. # Create a moodboard (/docs/api-reference/moodboards/create-moodboard) `POST https://api.remagica.com/api/v1/moodboards` Adds a moodboard to the Team or your Private scope. Images are storage keys of the workspace's own images (uploads, generations, Library files). Requires scope `brand:write`. Request and response schemas: the operation at `/moodboards` in https://api.remagica.com/api/v1/openapi.json. # Delete a moodboard (/docs/api-reference/moodboards/delete-moodboard) `DELETE https://api.remagica.com/api/v1/moodboards/{moodboardId}` Deletes a moodboard. Its images stay in storage. Requires scope `brand:delete`. Request and response schemas: the operation at `/moodboards/{moodboardId}` in https://api.remagica.com/api/v1/openapi.json. # Get a moodboard (/docs/api-reference/moodboards/get-moodboard) `GET https://api.remagica.com/api/v1/moodboards/{moodboardId}` Requires scope `brand:read`. Request and response schemas: the operation at `/moodboards/{moodboardId}` in https://api.remagica.com/api/v1/openapi.json. # List moodboards (/docs/api-reference/moodboards/list-moodboards) `GET https://api.remagica.com/api/v1/moodboards` The workspace's Team moodboards and your Private ones, last edited first. Requires scope `brand:read`. Request and response schemas: the operation at `/moodboards` in https://api.remagica.com/api/v1/openapi.json. # Update a moodboard (/docs/api-reference/moodboards/update-moodboard) `PATCH https://api.remagica.com/api/v1/moodboards/{moodboardId}` Changes a moodboard: the fields you send replace theirs (images whole, in order); the rest stay. Requires scope `brand:write`. Request and response schemas: the operation at `/moodboards/{moodboardId}` in https://api.remagica.com/api/v1/openapi.json. # Get prices (/docs/api-reference/pricing/get-price-book) `GET https://api.remagica.com/api/v1/pricing` The current price book: what one credit sells for and every rate in microcredits (1,000,000 to a credit) per unit, by tier. Rates may be fractional credits; a request sums its meters and rounds up once, to at least 1 credit. Needs no session. Request and response schemas: the operation at `/pricing` in https://api.remagica.com/api/v1/openapi.json. # Copy a shared project (/docs/api-reference/projects/copy-shared-project) `POST https://api.remagica.com/api/v1/shared-projects/{workflowId}/copies` Makes a copy of a shared project (`public`, or one in your workspace) in your workspace's top level: its canvas and settings, with files it imports copied over. Results and run history stay with the original. Requires scope `projects:share`. Request and response schemas: the operation at `/shared-projects/{workflowId}/copies` in https://api.remagica.com/api/v1/openapi.json. # Create a folder (/docs/api-reference/projects/create-project-folder) `POST https://api.remagica.com/api/v1/project-folders` Adds a project folder: a team one, a personal one (`scope: personal`), or one inside another folder, which takes that folder's scope. Requires scope `projects:write`. Request and response schemas: the operation at `/project-folders` in https://api.remagica.com/api/v1/openapi.json. # Create a project (/docs/api-reference/projects/create-project) `POST https://api.remagica.com/api/v1/projects` Starts a project (workflow) in a scope or folder, empty or from a template (`templateId`): personal ones are listed only for you. Requires scope `projects:write`. Request and response schemas: the operation at `/projects` in https://api.remagica.com/api/v1/openapi.json. # Delete a folder (/docs/api-reference/projects/delete-project-folder) `DELETE https://api.remagica.com/api/v1/project-folders/{folderId}` Deletes a folder and its subfolders. The projects in them stay, at the top level. Requires scope `projects:delete`. Request and response schemas: the operation at `/project-folders/{folderId}` in https://api.remagica.com/api/v1/openapi.json. # Duplicate a project (/docs/api-reference/projects/duplicate-project) `POST https://api.remagica.com/api/v1/projects/{workflowId}/duplicate` Copies a project next to the original (same folder; a public one's copy is team-wide): its canvas and settings. Results and run history stay with the original. Requires scope `projects:write`. Request and response schemas: the operation at `/projects/{workflowId}/duplicate` in https://api.remagica.com/api/v1/openapi.json. # Get credit usage (/docs/api-reference/projects/get-credit-usage) `GET https://api.remagica.com/api/v1/credit-usage` Credits your workspace's generations have used this month (failed ones cost nothing). Requires scope `usage:read`. Request and response schemas: the operation at `/credit-usage` in https://api.remagica.com/api/v1/openapi.json. # List every folder (/docs/api-reference/projects/list-all-project-folders) `GET https://api.remagica.com/api/v1/project-folders/all` Every folder you can put a project in: the team's and your personal ones, by name (for a move dialog). Requires scope `projects:read`. Request and response schemas: the operation at `/project-folders/all` in https://api.remagica.com/api/v1/openapi.json. # List folders (/docs/api-reference/projects/list-project-folders) `GET https://api.remagica.com/api/v1/project-folders` A scope's top-level folders, or a folder's subfolders, with breadcrumbs to it. Requires scope `projects:read`. Request and response schemas: the operation at `/project-folders` in https://api.remagica.com/api/v1/openapi.json. # List projects (/docs/api-reference/projects/list-projects) `GET https://api.remagica.com/api/v1/projects` Lists projects (workflows) a page at a time (50 at most): a scope's top level or a folder, or, with `search`, the whole scope by name. Each comes with a canvas preview, its asset and credit counts and its author. Pass `nextCursor` as `cursor` for the next page. Requires scope `projects:read`. Request and response schemas: the operation at `/projects` in https://api.remagica.com/api/v1/openapi.json. # Move a project (/docs/api-reference/projects/move-project) `PUT https://api.remagica.com/api/v1/projects/{workflowId}/folder` Moves a project into a folder, or to the top level (`folderId: null`). The folder's scope decides who sees it: a team folder shares it with the workspace, a personal one keeps it yours (a public project stays public). Requires scope `projects:write`. Request and response schemas: the operation at `/projects/{workflowId}/folder` in https://api.remagica.com/api/v1/openapi.json. # Rename a folder (/docs/api-reference/projects/rename-project-folder) `PATCH https://api.remagica.com/api/v1/project-folders/{folderId}` Renames a folder. Requires scope `projects:write`. Request and response schemas: the operation at `/project-folders/{folderId}` in https://api.remagica.com/api/v1/openapi.json. # Rename or describe a project (/docs/api-reference/projects/rename-project) `PATCH https://api.remagica.com/api/v1/projects/{workflowId}` Renames a project or changes its description. Its document and `version` stay as they are, so an open canvas keeps saving. Requires scope `projects:write`. Request and response schemas: the operation at `/projects/{workflowId}` in https://api.remagica.com/api/v1/openapi.json. # Save a project as a template (/docs/api-reference/projects/save-project-as-template) `POST https://api.remagica.com/api/v1/projects/{workflowId}/template` Saves a project as a template of your workspace's: its canvas, with each node's newest result kept as the template's example. `team` templates show for everyone in the workspace, `personal` ones for you only. Later edits to the project don't change it. Requires scope `templates:write`. Request and response schemas: the operation at `/projects/{workflowId}/template` in https://api.remagica.com/api/v1/openapi.json. # Set a project's visibility (/docs/api-reference/projects/set-project-visibility) `PUT https://api.remagica.com/api/v1/projects/{workflowId}/visibility` Sets who sees a project: `personal`, `team` or `public` (anyone with its share link, read-only, who can make a copy). Copying the share link in the app makes it `public`. Requires scope `projects:share`. Request and response schemas: the operation at `/projects/{workflowId}/visibility` in https://api.remagica.com/api/v1/openapi.json. # Create a reference (/docs/api-reference/references/create-reference) `POST https://api.remagica.com/api/v1/references` Adds a style, colour palette, character or element of your own, in the Team or your Private scope. Images are storage keys of the workspace's own images. Requires scope `references:write`. Request and response schemas: the operation at `/references` in https://api.remagica.com/api/v1/openapi.json. # Delete a reference (/docs/api-reference/references/delete-reference) `DELETE https://api.remagica.com/api/v1/references/{referenceId}` Deletes a reference of your own. Nodes that use it fail until it's removed from them. Requires scope `references:delete`. Request and response schemas: the operation at `/references/{referenceId}` in https://api.remagica.com/api/v1/openapi.json. # List saved references (/docs/api-reference/references/list-reference-bookmarks) `GET https://api.remagica.com/api/v1/references/bookmarks` The references the workspace saved, newest first. Requires scope `references:read`. Request and response schemas: the operation at `/references/bookmarks` in https://api.remagica.com/api/v1/openapi.json. # List built-in previews (/docs/api-reference/references/list-reference-previews) `GET https://api.remagica.com/api/v1/references/previews/{catalog}` Preview images of a catalogue's built-ins (a reference category, or the video Effects). Requires scope `references:read`. Request and response schemas: the operation at `/references/previews/{catalog}` in https://api.remagica.com/api/v1/openapi.json. # List references (/docs/api-reference/references/list-references) `GET https://api.remagica.com/api/v1/references` The workspace's Team references and your Private ones, last edited first. Requires scope `references:read`. Request and response schemas: the operation at `/references` in https://api.remagica.com/api/v1/openapi.json. # Save a reference (/docs/api-reference/references/set-reference-bookmark) `PUT https://api.remagica.com/api/v1/references/bookmarks` Saves a reference for the workspace, or unsaves it. Requires scope `references:write`. Request and response schemas: the operation at `/references/bookmarks` in https://api.remagica.com/api/v1/openapi.json. # Approve a take (/docs/api-reference/sprites/approve-sprite-take) `POST https://api.remagica.com/api/v1/sprites/takes/{takeId}/approve` Approves a finished take (draft or needing review) as its action's frames in that direction and outfit. The take approved there before goes back to review. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/takes/{takeId}/approve` in https://api.remagica.com/api/v1/openapi.json. # Remove a storyboard sketch (/docs/api-reference/sprites/clear-sprite-action-sketch) `DELETE https://api.remagica.com/api/v1/sprites/actions/{actionId}/sketches/{slot}` Takes the sketch off a storyboard slot and deletes it; the slot's pinned frame stays. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/actions/{actionId}/sketches/{slot}` in https://api.remagica.com/api/v1/openapi.json. # Create an action (/docs/api-reference/sprites/create-sprite-action) `POST https://api.remagica.com/api/v1/sprites/characters/{characterId}/actions` Adds an action to a character, after its others. Its key is made from the name unless you send one; a key the character already uses is refused. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/characters/{characterId}/actions` in https://api.remagica.com/api/v1/openapi.json. # Create a character (/docs/api-reference/sprites/create-sprite-character) `POST https://api.remagica.com/api/v1/sprites/games/{gameId}/characters` Adds a character to a game's cast. It's also a Library item (kind `sprite`) in the Team Library's Sprites folder, and starts with the standard actions (idle, walk, run, attack, jump, hurt and death) and no master. `convertedFromItemId` names a Library character it's made from. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/games/{gameId}/characters` in https://api.remagica.com/api/v1/openapi.json. # Export sprites (/docs/api-reference/sprites/create-sprite-export) `POST https://api.remagica.com/api/v1/sprites/exports` Exports the characters' animations (each direction's standing take, per outfit: the approved one, else the newest finished one) for an engine: sheets or one atlas per character at a whole-number scale, the engine's own files, `metadata.json`, gameplay data and Sprite DNA, zipped. Charges nothing. Follow it on the studio's live feed (topic `export`) or with `GET /sprites/exports/{exportId}`, which has the download link once it's ready. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/exports` in https://api.remagica.com/api/v1/openapi.json. # Create a folder (/docs/api-reference/sprites/create-sprite-folder) `POST https://api.remagica.com/api/v1/sprites/folders` Makes a folder for characters, at the top level or inside `parentId`. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/folders` in https://api.remagica.com/api/v1/openapi.json. # Create a game (/docs/api-reference/sprites/create-sprite-game) `POST https://api.remagica.com/api/v1/sprites/games` Starts a game's style bible. What you leave out comes from the defaults: the `pixel` style and its recipe, a side-scroller camera, a 32 px canvas, the standard size classes, rules and cleanup. Its slug is made from the name, unique in the workspace. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/games` in https://api.remagica.com/api/v1/openapi.json. # Import a sprite sheet (/docs/api-reference/sprites/create-sprite-import) `POST https://api.remagica.com/api/v1/sprites/imports` Imports a sheet you uploaded (`POST /uploads`): sliced on `grid`, its ground taken out, each row fitted to the game's canvas (one scale for the sheet, so the master's figure stands at the size class's height, and each row's lowest feet on the baseline) and made a draft take of its action in its direction, then scored against the master. With no `characterId` a new character is made (a Library sprite); its master comes from `masterFrom`, by default the first row's first frame. Rows can name the character's actions by key or any action by name (new ones are added). Charges nothing. Follow it on the studio's live feed (topic `import`) or with `GET /sprites/imports/{importId}`. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/imports` in https://api.remagica.com/api/v1/openapi.json. # Create an outfit (/docs/api-reference/sprites/create-sprite-outfit) `POST https://api.remagica.com/api/v1/sprites/characters/{characterId}/outfits` Adds an outfit to a character. With a `prompt`, an edit of its master that keeps the pose, drawn later with `POST /sprites/characters/{characterId}/outfits/generate`. With `paletteOverrides` and no prompt, a colour skin: the master with those colours swapped, rendered at once (no credits). Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/characters/{characterId}/outfits` in https://api.remagica.com/api/v1/openapi.json. # Create a preset (/docs/api-reference/sprites/create-sprite-preset) `POST https://api.remagica.com/api/v1/sprites/presets` Saves a timing or export setup for every game of the workspace. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/presets` in https://api.remagica.com/api/v1/openapi.json. # Remove an action (/docs/api-reference/sprites/delete-sprite-action) `DELETE https://api.remagica.com/api/v1/sprites/actions/{actionId}` Removes an action and hides its takes. Its key is free again for a new action. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/actions/{actionId}` in https://api.remagica.com/api/v1/openapi.json. # Delete a folder (/docs/api-reference/sprites/delete-sprite-folder) `DELETE https://api.remagica.com/api/v1/sprites/folders/{folderId}` Deletes a folder and its subfolders. The characters in them stay, at the top level. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/folders/{folderId}` in https://api.remagica.com/api/v1/openapi.json. # Remove a frame (/docs/api-reference/sprites/delete-sprite-frame) `DELETE https://api.remagica.com/api/v1/sprites/frames/{frameId}` Removes an unlocked frame (an in-between or any other) and moves the later frames back one, with the action's loop points, storyboard keys and cancel window. The take is scored again; an approved take goes back to review. A take keeps at least one frame. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/frames/{frameId}` in https://api.remagica.com/api/v1/openapi.json. # Delete an outfit (/docs/api-reference/sprites/delete-sprite-outfit) `DELETE https://api.remagica.com/api/v1/sprites/outfits/{outfitId}` Deletes an outfit, the takes drawn in it and their frames. A character shown in it goes back to the base outfit, which can't be deleted. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/outfits/{outfitId}` in https://api.remagica.com/api/v1/openapi.json. # Delete a take (/docs/api-reference/sprites/delete-sprite-take) `DELETE https://api.remagica.com/api/v1/sprites/takes/{takeId}` Deletes a take (a version of an action in a direction) with its frames and files. A take still drawing can't be deleted; the action and its other takes stay. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/takes/{takeId}` in https://api.remagica.com/api/v1/openapi.json. # Estimate a frame edit (/docs/api-reference/sprites/estimate-sprite-frame-edit) `POST https://api.remagica.com/api/v1/sprites/frames/estimate` What a redraw (`count` 1) or `count` in-betweens of a take would set aside now, in credits: each frame an image edit and, at worst, background removal. Nothing is started or charged. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/frames/estimate` in https://api.remagica.com/api/v1/openapi.json. # Estimate a master request (/docs/api-reference/sprites/estimate-sprite-master) `POST https://api.remagica.com/api/v1/sprites/characters/{characterId}/masters/estimate` What a master request would set aside now, in credits: every candidate drawn three times (the first try and two silent retries), each with background removal. Nothing is started or charged. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/characters/{characterId}/masters/estimate` in https://api.remagica.com/api/v1/openapi.json. # Estimate an outfit (/docs/api-reference/sprites/estimate-sprite-outfit) `POST https://api.remagica.com/api/v1/sprites/characters/{characterId}/outfits/estimate` What drawing an outfit would set aside now, in credits: one edit of the master and a background removal. Nothing is started or charged. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/characters/{characterId}/outfits/estimate` in https://api.remagica.com/api/v1/openapi.json. # Estimate takes (/docs/api-reference/sprites/estimate-sprite-takes) `POST https://api.remagica.com/api/v1/sprites/characters/{characterId}/takes/estimate` What making takes would usually cost now, in credits (`credits`), and what they would set aside (`holdCredits`). A sheet take sets aside its sheet and a background removal; a clip take its clip by the second and a background removal per frame, used only when the clip's ground won't key, and what isn't used goes back. Send `items`, or leave them out to price every missing take (as `generateMissing` would make them). Nothing is started or charged. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/characters/{characterId}/takes/estimate` in https://api.remagica.com/api/v1/openapi.json. # Fix drifted frames (/docs/api-reference/sprites/fix-sprite-drift) `POST https://api.remagica.com/api/v1/sprites/characters/{characterId}/drift/fix` Redraws the character's frames scoring below the line (unlocked ones, worst first, at most 32) to match the master: up to `triesPerFrame` image edits each, cleaned up and scored again, one that clears the line replacing the frame (its old file kept for revert). One credit hold of at most `creditCap` covers the run, and it stops before a call would spend past the cap. Follow it on the studio's live feed (topic `drift`) or with `GET /sprites/drift/{runId}`. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/characters/{characterId}/drift/fix` in https://api.remagica.com/api/v1/openapi.json. # Redraw a frame (/docs/api-reference/sprites/fix-sprite-frame) `POST https://api.remagica.com/api/v1/sprites/frames/{frameId}/fix` Redraws one frame to match the master, with the frames either side as references and your prompt's change; with `region`, only that box is replaced (feathered into the frame). The old file is kept for revert. Holds credits for the worst case and settles at what ran; the take is scored again and an approved take goes back to review. Locked frames and takes still running are refused. Follow it on the live feed (`GET /sprites/events`, topic `take`, by take id), then read the take. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/frames/{frameId}/fix` in https://api.remagica.com/api/v1/openapi.json. # Draw the missing takes (/docs/api-reference/sprites/generate-missing-sprite-takes) `POST https://api.remagica.com/api/v1/sprites/characters/{characterId}/takes/missing` Makes every take the character lacks: each action (as a clip, or as `source` says) in each direction its game's camera draws (left-facing ones are mirrored at export), in the outfit asked for, with no take there that hasn't failed. At most 64 at a time; they run as the plan's renders at a time allow, under one credit hold. It starts as many as the balance covers, in action order, and says how many it `skipped`; `402` only when not even one can start. Nothing to draw: `requestId` is `null`. Follow it with `GET /sprites/events` (`sprites.watch`), then read the rows. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/characters/{characterId}/takes/missing` in https://api.remagica.com/api/v1/openapi.json. # Draw master candidates (/docs/api-reference/sprites/generate-sprite-master) `POST https://api.remagica.com/api/v1/sprites/characters/{characterId}/masters` Draws candidates (four by default) of a character's master: full body, a neutral ready pose, on a clean ground, fitted to its size class with its feet on the baseline and validated (one that fails is drawn again, up to twice). Holds credits for the worst case and settles at what ran. Follow it with `GET /sprites/events` (`sprites.watch`), then read the rows. Pick one with `POST /sprites/characters/{characterId}/masters/pick`. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/characters/{characterId}/masters` in https://api.remagica.com/api/v1/openapi.json. # Draw an outfit (/docs/api-reference/sprites/generate-sprite-outfit) `POST https://api.remagica.com/api/v1/sprites/characters/{characterId}/outfits/generate` Draws an outfit as an edit of the character's master: only the clothing and gear `prompt` names change, and the pose, size and framing stay the master's (the master and the pose guide are its references). Send `prompt` (and a `name`) for a new outfit, or `outfitId` to draw one again. The outfit goes `queued`, `generating`, then `ready` with its master and its fit check (height, baseline, width and position against the master, each within 1 px or a warning), or `failed`. Holds credits for the worst case and settles at what ran. Follow it with `GET /sprites/events` (topic `outfit`), then read `GET /sprites/characters/{characterId}/outfits`. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/characters/{characterId}/outfits/generate` in https://api.remagica.com/api/v1/openapi.json. # Draw a take (/docs/api-reference/sprites/generate-sprite-take) `POST https://api.remagica.com/api/v1/sprites/characters/{characterId}/takes` Makes one take of an action in a direction: a short video clip that starts on the master, with every frame kept, cut out and fitted to the master's height and baseline, and its best loop (or the whole clip, for a one-shot) selected as the take's frames (`takes.clipInspector` shows them all). With `source: sheet` or an image model, one sheet of its frames instead. It's `queued`, then `generating`, then a `draft` with its frames (or `failed`, refunded). The character needs a master. Follow it with `GET /sprites/events` (`sprites.watch`), then read the rows. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/characters/{characterId}/takes` in https://api.remagica.com/api/v1/openapi.json. # Draw turnaround views (/docs/api-reference/sprites/generate-sprite-views) `POST https://api.remagica.com/api/v1/sprites/characters/{characterId}/masters/{versionId}/views` Draws a master version's turnaround views for the game's camera (top-down 4-way: right and back; 8-way: also front-right and back-right; isometric: back-right), each at the master's height and baseline, into a new version. A side-scroller has none (left is mirrored). Follow it with `GET /sprites/events` (`sprites.watch`), then read the rows. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/characters/{characterId}/masters/{versionId}/views` in https://api.remagica.com/api/v1/openapi.json. # Get a character's running drift fix (/docs/api-reference/sprites/get-active-sprite-drift-run) `GET https://api.remagica.com/api/v1/sprites/characters/{characterId}/drift/active` The character's drift run still going (queued or running), so a page opened mid-run can follow it; `run` is null when none is. A character runs one fix at a time: starting another meanwhile is refused with `CONFLICT`. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/characters/{characterId}/drift/active` in https://api.remagica.com/api/v1/openapi.json. # Get a character's Sprite DNA (/docs/api-reference/sprites/get-sprite-character-dna) `GET https://api.remagica.com/api/v1/sprites/characters/{characterId}/dna` A character's Sprite DNA, as its export ships it: the JSON and a Markdown brief any LLM or image model can follow. Its animations' timing and gameplay come from their approved takes. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/characters/{characterId}/dna` in https://api.remagica.com/api/v1/openapi.json. # Get a character (/docs/api-reference/sprites/get-sprite-character) `GET https://api.remagica.com/api/v1/sprites/characters/{characterId}` Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/characters/{characterId}` in https://api.remagica.com/api/v1/openapi.json. # Get a character's drift report (/docs/api-reference/sprites/get-sprite-drift-report) `GET https://api.remagica.com/api/v1/sprites/characters/{characterId}/drift` Scores of every frame of each animation's standing take against the character's master (1 is identical), the frames below `threshold` worst first, counts, the take checks and what one try of a fix costs. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/characters/{characterId}/drift` in https://api.remagica.com/api/v1/openapi.json. # Get a drift run (/docs/api-reference/sprites/get-sprite-drift-run) `GET https://api.remagica.com/api/v1/sprites/drift/{runId}` A drift run as it stands: each queued frame's tries and outcome, what it spent, and its result once it ended. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/drift/{runId}` in https://api.remagica.com/api/v1/openapi.json. # Get an export (/docs/api-reference/sprites/get-sprite-export) `GET https://api.remagica.com/api/v1/sprites/exports/{exportId}` An export as it stands: its status, its manifest once built (files, sheets, animations and what's missing) and, while it's ready, a signed link to the ZIP. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/exports/{exportId}` in https://api.remagica.com/api/v1/openapi.json. # Get a game (/docs/api-reference/sprites/get-sprite-game) `GET https://api.remagica.com/api/v1/sprites/games/{gameId}` Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/games/{gameId}` in https://api.remagica.com/api/v1/openapi.json. # Get an import (/docs/api-reference/sprites/get-sprite-import) `GET https://api.remagica.com/api/v1/sprites/imports/{importId}` An import as it stands: queued, running (with what it's doing), done or failed (with why), and the takes it makes. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/imports/{importId}` in https://api.remagica.com/api/v1/openapi.json. # List a character's actions (/docs/api-reference/sprites/list-sprite-actions) `GET https://api.remagica.com/api/v1/sprites/characters/{characterId}/actions` A character's actions, in their order. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/characters/{characterId}/actions` in https://api.remagica.com/api/v1/openapi.json. # List a game's characters (/docs/api-reference/sprites/list-sprite-characters) `GET https://api.remagica.com/api/v1/sprites/games/{gameId}/characters` A game's cast, oldest first, each with its master's image, size class, role and how many of its takes are approved. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/games/{gameId}/characters` in https://api.remagica.com/api/v1/openapi.json. # List exports (/docs/api-reference/sprites/list-sprite-exports) `GET https://api.remagica.com/api/v1/sprites/exports` A game's exports, newest first (the last 100). Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/exports` in https://api.remagica.com/api/v1/openapi.json. # List folders (/docs/api-reference/sprites/list-sprite-folders) `GET https://api.remagica.com/api/v1/sprites/folders` Every folder in the workspace, by name, each with its parent and how many characters it holds. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/folders` in https://api.remagica.com/api/v1/openapi.json. # List games (/docs/api-reference/sprites/list-sprite-games) `GET https://api.remagica.com/api/v1/sprites/games` The workspace's games, last edited first. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/games` in https://api.remagica.com/api/v1/openapi.json. # List master candidates (/docs/api-reference/sprites/list-sprite-master-candidates) `GET https://api.remagica.com/api/v1/sprites/characters/{characterId}/masters/candidates` A character's master candidates, newest request first, each with its files (short-lived download URLs), what it measures, or why it failed. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/characters/{characterId}/masters/candidates` in https://api.remagica.com/api/v1/openapi.json. # List a character's outfits (/docs/api-reference/sprites/list-sprite-outfits) `GET https://api.remagica.com/api/v1/sprites/characters/{characterId}/outfits` A character's outfits: the base outfit (the master itself, made the first time it's asked for) first, then the rest oldest first, each with its master (a short-lived URL) and fit check once it's made. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/characters/{characterId}/outfits` in https://api.remagica.com/api/v1/openapi.json. # List presets (/docs/api-reference/sprites/list-sprite-presets) `GET https://api.remagica.com/api/v1/sprites/presets` The workspace's saved presets, oldest first. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/presets` in https://api.remagica.com/api/v1/openapi.json. # List a character's takes (/docs/api-reference/sprites/list-sprite-takes) `GET https://api.remagica.com/api/v1/sprites/characters/{characterId}/takes` A character's takes, newest first, each with its frames in order and short-lived download URLs. Takes of removed actions are left out. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/characters/{characterId}/takes` in https://api.remagica.com/api/v1/openapi.json. # List turnaround views (/docs/api-reference/sprites/list-sprite-views) `GET https://api.remagica.com/api/v1/sprites/characters/{characterId}/views` The character's master in use from each of its camera's turnaround views (top-down 4-way: front, right, back; 8-way: also front-right and back-right; isometric: front-right, back-right; side-scroller: its own only), the master's own first, with the ones drawn so far and what drawing them sets aside. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/characters/{characterId}/views` in https://api.remagica.com/api/v1/openapi.json. # Pack exports into one ZIP (/docs/api-reference/sprites/pack-sprite-exports) `POST https://api.remagica.com/api/v1/sprites/exports/pack` Puts ready exports in one ZIP: a folder's characters, each exported from a game of its own, as one bundle with a folder per character. Files the exports share as they are are kept once; an export whose files would clash goes in a folder of its own. Asking again for the same exports reuses the ZIP. Charges nothing. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/exports/pack` in https://api.remagica.com/api/v1/openapi.json. # Pick a master (/docs/api-reference/sprites/pick-sprite-master) `POST https://api.remagica.com/api/v1/sprites/characters/{characterId}/masters/pick` Makes a candidate the character's master: a new version of its Library item. Its approved takes go back to review, having been checked against the old master, and its colour skins are rendered again from it. Picking the same candidate again returns the version it made. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/characters/{characterId}/masters/pick` in https://api.remagica.com/api/v1/openapi.json. # Preview an export (/docs/api-reference/sprites/preview-sprite-export) `POST https://api.remagica.com/api/v1/sprites/exports/preview` A dry run of an export: the files it would hold and each sheet's size, from the standing takes (approved, else the newest finished), without drawing anything. With trim on, sizes are before trimming. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/exports/preview` in https://api.remagica.com/api/v1/openapi.json. # Preview a sheet import (/docs/api-reference/sprites/preview-sprite-import) `POST https://api.remagica.com/api/v1/sprites/imports/preview` Reads a sheet you uploaded without importing anything: its ground (clear, a key colour or neither), its grid (found from its gutters and the figures' spacing, or yours completed), the empty cells, frames per row, a suggested mapping of rows to actions and directions, what the master frame measures and warnings in plain words (mixed sizes, too many colours, feet off the baseline, figures cut off). Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/imports/preview` in https://api.remagica.com/api/v1/openapi.json. # Replace a frame's image (/docs/api-reference/sprites/replace-sprite-frame) `POST https://api.remagica.com/api/v1/sprites/frames/{frameId}/replace` Saves a touch-up: an uploaded PNG the frame's size (`POST /uploads` first) becomes the frame's file. The generated file is kept for revert (only the first original, so revert always gets back to it). The take is scored again; an approved take goes back to review. Locked frames can't change. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/frames/{frameId}/replace` in https://api.remagica.com/api/v1/openapi.json. # Bring an edit back to Sprites (/docs/api-reference/sprites/return-sprite-edit) `POST https://api.remagica.com/api/v1/sprites/characters/{characterId}/masters/returns` Brings an edit of one of a character's images back to Sprites: once the edit's generation ends, its image is cut out as a master is (keyed for free, or through background removal, which the request holds credits for and settles at what ran) and kept as a new candidate of the character. Asking again for the same edit is the same request. Follow it with `GET /sprites/events` (`sprites.watch`), then read the rows. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/characters/{characterId}/masters/returns` in https://api.remagica.com/api/v1/openapi.json. # Revert a frame (/docs/api-reference/sprites/revert-sprite-frame) `POST https://api.remagica.com/api/v1/sprites/frames/{frameId}/revert` Puts the generated frame back after touch-ups or redraws. The take is scored again; an approved take goes back to review. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/frames/{frameId}/revert` in https://api.remagica.com/api/v1/openapi.json. # Set a storyboard sketch (/docs/api-reference/sprites/set-sprite-action-sketch) `PUT https://api.remagica.com/api/v1/sprites/actions/{actionId}/sketches/{slot}` Pins a sketch of the pose to a storyboard slot (at the slot's frame, its default when it isn't pinned yet). Sheet takes send it to the model as a pose reference for that frame; clip takes don't use sketches. Upload the image first (`POST /uploads`). Sending another replaces it. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/actions/{actionId}/sketches/{slot}` in https://api.remagica.com/api/v1/openapi.json. # Add in-betweens (/docs/api-reference/sprites/tween-sprite-frames) `POST https://api.remagica.com/api/v1/sprites/frames/tween` Draws 1 to 3 in-betweens between the frames at `afterIndex` and `afterIndex + 1`, from both frames and the master. They're inserted after the first (flagged `isTween`), and the later frames, the action's frame count, loop points, storyboard keys, cancel window and beats move along. Holds credits for every frame at its worst and settles at what ran; an approved take goes back to review. Follow it on the live feed (`GET /sprites/events`, topic `take`, by take id), then read the take. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/frames/tween` in https://api.remagica.com/api/v1/openapi.json. # Update an action (/docs/api-reference/sprites/update-sprite-action) `PATCH https://api.remagica.com/api/v1/sprites/actions/{actionId}` Changes an action's name, key, prompt, timing, beats, storyboard or source: the fields you send replace theirs; the rest stay. Loop points, storyboard keys and the cancel window have to fall inside its frames. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/actions/{actionId}` in https://api.remagica.com/api/v1/openapi.json. # Update a character (/docs/api-reference/sprites/update-sprite-character) `PATCH https://api.remagica.com/api/v1/sprites/characters/{characterId}` Changes a character: the fields you send replace theirs; the rest stay. A new name renames its Library item too. `masterVersionId` switches which of its master versions it's animated from (and renders its colour skins again from that one). Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/characters/{characterId}` in https://api.remagica.com/api/v1/openapi.json. # Update a folder (/docs/api-reference/sprites/update-sprite-folder) `PATCH https://api.remagica.com/api/v1/sprites/folders/{folderId}` Renames a folder or moves it (`parentId`, `null` for the top level). A folder can't go inside itself or one of its subfolders. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/folders/{folderId}` in https://api.remagica.com/api/v1/openapi.json. # Update a frame (/docs/api-reference/sprites/update-sprite-frame) `PATCH https://api.remagica.com/api/v1/sprites/frames/{frameId}` Changes a frame's gameplay data (hurt and hit boxes, events, root motion), whether it's locked, or its hold. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/frames/{frameId}` in https://api.remagica.com/api/v1/openapi.json. # Update a game (/docs/api-reference/sprites/update-sprite-game) `PATCH https://api.remagica.com/api/v1/sprites/games/{gameId}` Changes a game's style bible: the fields you send replace theirs (`canvas`, `rules`, `sizeClasses` and `cleanup` field by field); the rest stay. A new `style` without a `recipe` takes that style's recipe. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/games/{gameId}` in https://api.remagica.com/api/v1/openapi.json. # Update an outfit (/docs/api-reference/sprites/update-sprite-outfit) `PATCH https://api.remagica.com/api/v1/sprites/outfits/{outfitId}` Changes an outfit's name, prompt or palette overrides; the rest stay. A colour skin's new overrides render it again. The base outfit only takes a new name. Requires scope `sprites:write`. Request and response schemas: the operation at `/sprites/outfits/{outfitId}` in https://api.remagica.com/api/v1/openapi.json. # Follow Sprite Studio (/docs/api-reference/sprites/watch-sprites) `GET https://api.remagica.com/api/v1/sprites/events` Streams the workspace's Sprite Studio changes as server-sent events: master requests and candidates (topic `master`), outfits (`outfit`), takes (`take`), drift runs (`drift`), exports (`export`) and sheet imports (`import`), each as `{ topic, id, status, step?, progress? }`. An event only says what changed: read the rows. Nothing is replayed: list when you connect and again whenever you reconnect. The stream ends after 15 minutes; reconnect to keep following. Requires scope `sprites:read`. Request and response schemas: the operation at `/sprites/events` in https://api.remagica.com/api/v1/openapi.json. # Keep a preset's example results (/docs/api-reference/templates/add-preset-results) `POST https://api.remagica.com/api/v1/presets/{slug}/results` Records a preset's example results on the nodes it was inserted as (after `insertPreset` and a save), so they stay on the canvas: the files are copied into your workspace and kept as one finished run. Requires scope `templates:use`. Request and response schemas: the operation at `/presets/{slug}/results` in https://api.remagica.com/api/v1/openapi.json. # Delete a template (/docs/api-reference/templates/delete-template) `DELETE https://api.remagica.com/api/v1/templates/{slug}` Deletes a template you saved from a project. Projects made from it stay. Requires scope `templates:delete`. Request and response schemas: the operation at `/templates/{slug}` in https://api.remagica.com/api/v1/openapi.json. # Get a template (/docs/api-reference/templates/get-template) `GET https://api.remagica.com/api/v1/templates/{slug}` A template with its canvas, read-only: each node's box, title and example image. Requires scope `templates:read`. Request and response schemas: the operation at `/templates/{slug}` in https://api.remagica.com/api/v1/openapi.json. # List presets (/docs/api-reference/templates/list-presets) `GET https://api.remagica.com/api/v1/presets` The presets for the canvas's Presets panel, by tab and search, each with the graph to insert and its example results. Requires scope `templates:read`. Request and response schemas: the operation at `/presets` in https://api.remagica.com/api/v1/openapi.json. # List templates (/docs/api-reference/templates/list-templates) `GET https://api.remagica.com/api/v1/templates` The templates on the Templates page, by category and search, with their cover and hover preview. Requires scope `templates:read`. Request and response schemas: the operation at `/templates` in https://api.remagica.com/api/v1/openapi.json. # Get a thumbnail reference (/docs/api-reference/thumbnails/get-thumbnail-reference) `GET https://api.remagica.com/api/v1/thumbnail-references/{id}` One thumbnail reference with its curation notes and licence record. Requires scope `references:read`. Request and response schemas: the operation at `/thumbnail-references/{id}` in https://api.remagica.com/api/v1/openapi.json. # List thumbnail references (/docs/api-reference/thumbnails/list-thumbnail-references) `GET https://api.remagica.com/api/v1/thumbnail-references` Lists the thumbnail reference library, curated references first, a page at a time. Filter by niche recipe, source or text; `readyOnly` keeps the curated ones. Requires scope `references:read`. Request and response schemas: the operation at `/thumbnail-references` in https://api.remagica.com/api/v1/openapi.json. # Create an upload URL (/docs/api-reference/uploads/create-upload) `POST https://api.remagica.com/api/v1/uploads` Returns a presigned URL for uploading one media file straight to object storage, so large videos never pass through the API. Upload the file with `PUT uploadUrl`, sending the returned `headers` and the raw bytes as the body, before `expiresAt`. Then pass `key` to `POST /clip-jobs`. Requires scope `uploads:write`. Request and response schemas: the operation at `/uploads` in https://api.remagica.com/api/v1/openapi.json. # Get file URLs (/docs/api-reference/uploads/get-file-urls) `POST https://api.remagica.com/api/v1/files/urls` Returns short-lived download URLs for files of your workspace by storage key (an upload, a generation output, a workflow's file) and for thumbnail reference library files and built-in reference previews. Other keys are left out. Requires scope `uploads:write`. Request and response schemas: the operation at `/files/urls` in https://api.remagica.com/api/v1/openapi.json. # Upload from a link (/docs/api-reference/uploads/upload-from-url) `POST https://api.remagica.com/api/v1/uploads/from-url` Copies an image, video or audio file from a public link into the workspace's storage (up to 200 MB) and returns its key, as an upload would. Links to private addresses are refused. Requires scope `uploads:write`. Request and response schemas: the operation at `/uploads/from-url` in https://api.remagica.com/api/v1/openapi.json. # Get credits (/docs/api-reference/usage/get-credits) `GET https://api.remagica.com/api/v1/credits` The workspace's credit balance (what it may spend now: its credits less any debt and what runs in progress set aside), its plan, credits expiring in the next 7 days, what you've spent this month and your credit limit if an admin set one. New workspaces start at 0: credits come from a paid plan, a credit pack or a code. Requires scope `usage:read`. Request and response schemas: the operation at `/credits` in https://api.remagica.com/api/v1/openapi.json. # List API keys that spent credits (/docs/api-reference/usage/list-credit-api-keys) `GET https://api.remagica.com/api/v1/credits/api-keys` Every API key that has spent the workspace's credits, by name, including keys deleted since (by the name they last spent under): what `apiKeyId` on the history and usage filters by. Requires scope `usage:read`. Request and response schemas: the operation at `/credits/api-keys` in https://api.remagica.com/api/v1/openapi.json. # List credit history (/docs/api-reference/usage/list-credit-history) `GET https://api.remagica.com/api/v1/credits/history` The credit ledger, newest first: grants (with their `source`), each workflow run (its estimate and what it actually cost, refunds of failed or cancelled results taken off), each generation made outside a run, and credits that expired (`expire`), were clawed back (`reversal`) or adjusted by staff (`adjustment`). Each line says which API key spent it (`apiKey`, null for the app); `apiKeyId` shows only one key's. Requires scope `usage:read`. Request and response schemas: the operation at `/credits/history` in https://api.remagica.com/api/v1/openapi.json. # app_run.canceled (/docs/api-reference/webhook-events/app-run-canceled) Webhook event `app_run.canceled`: Remagica POSTs it to your endpoint (see /docs/webhooks). A app run was cancelled (or stopped). Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["app_run.canceled"]` in https://api.remagica.com/api/v1/openapi.json. # app_run.failed (/docs/api-reference/webhook-events/app-run-failed) Webhook event `app_run.failed`: Remagica POSTs it to your endpoint (see /docs/webhooks). A app run failed. Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["app_run.failed"]` in https://api.remagica.com/api/v1/openapi.json. # app_run.succeeded (/docs/api-reference/webhook-events/app-run-succeeded) Webhook event `app_run.succeeded`: Remagica POSTs it to your endpoint (see /docs/webhooks). A app run succeeded. Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["app_run.succeeded"]` in https://api.remagica.com/api/v1/openapi.json. # clip_export.failed (/docs/api-reference/webhook-events/clip-export-failed) Webhook event `clip_export.failed`: Remagica POSTs it to your endpoint (see /docs/webhooks). A clip export failed. Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["clip_export.failed"]` in https://api.remagica.com/api/v1/openapi.json. # clip_export.succeeded (/docs/api-reference/webhook-events/clip-export-succeeded) Webhook event `clip_export.succeeded`: Remagica POSTs it to your endpoint (see /docs/webhooks). A clip export succeeded. Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["clip_export.succeeded"]` in https://api.remagica.com/api/v1/openapi.json. # clip_job.failed (/docs/api-reference/webhook-events/clip-job-failed) Webhook event `clip_job.failed`: Remagica POSTs it to your endpoint (see /docs/webhooks). A clip job failed. Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["clip_job.failed"]` in https://api.remagica.com/api/v1/openapi.json. # clip_job.succeeded (/docs/api-reference/webhook-events/clip-job-succeeded) Webhook event `clip_job.succeeded`: Remagica POSTs it to your endpoint (see /docs/webhooks). A clip job succeeded. Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["clip_job.succeeded"]` in https://api.remagica.com/api/v1/openapi.json. # generation.canceled (/docs/api-reference/webhook-events/generation-canceled) Webhook event `generation.canceled`: Remagica POSTs it to your endpoint (see /docs/webhooks). A generation was cancelled (or stopped). Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["generation.canceled"]` in https://api.remagica.com/api/v1/openapi.json. # generation.failed (/docs/api-reference/webhook-events/generation-failed) Webhook event `generation.failed`: Remagica POSTs it to your endpoint (see /docs/webhooks). A generation failed. Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["generation.failed"]` in https://api.remagica.com/api/v1/openapi.json. # generation.succeeded (/docs/api-reference/webhook-events/generation-succeeded) Webhook event `generation.succeeded`: Remagica POSTs it to your endpoint (see /docs/webhooks). A generation succeeded. Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["generation.succeeded"]` in https://api.remagica.com/api/v1/openapi.json. # webhook.test (/docs/api-reference/webhook-events/webhook-test) Webhook event `webhook.test`: Remagica POSTs it to your endpoint (see /docs/webhooks). A test event, sent by Send test event. Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["webhook.test"]` in https://api.remagica.com/api/v1/openapi.json. # workflow_run.canceled (/docs/api-reference/webhook-events/workflow-run-canceled) Webhook event `workflow_run.canceled`: Remagica POSTs it to your endpoint (see /docs/webhooks). A workflow run was cancelled (or stopped). Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["workflow_run.canceled"]` in https://api.remagica.com/api/v1/openapi.json. # workflow_run.failed (/docs/api-reference/webhook-events/workflow-run-failed) Webhook event `workflow_run.failed`: Remagica POSTs it to your endpoint (see /docs/webhooks). A workflow run failed. Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["workflow_run.failed"]` in https://api.remagica.com/api/v1/openapi.json. # workflow_run.succeeded (/docs/api-reference/webhook-events/workflow-run-succeeded) Webhook event `workflow_run.succeeded`: Remagica POSTs it to your endpoint (see /docs/webhooks). A workflow run succeeded. Answer 2xx within 10 seconds; anything else is retried for about a day. Payload schema: `webhooks["workflow_run.succeeded"]` in https://api.remagica.com/api/v1/openapi.json. # Create a webhook endpoint (/docs/api-reference/webhooks/create-webhook-endpoint) `POST https://api.remagica.com/api/v1/webhook-endpoints` Adds an endpoint that receives the events you pick, POSTed as JSON and signed with its secret (`Remagica-Signature`). The secret is in this response only: store it. A workspace has at most 20 endpoints. Requires scope `webhooks:write`. Request and response schemas: the operation at `/webhook-endpoints` in https://api.remagica.com/api/v1/openapi.json. # Delete a webhook endpoint (/docs/api-reference/webhooks/delete-webhook-endpoint) `DELETE https://api.remagica.com/api/v1/webhook-endpoints/{endpointId}` Deletes an endpoint and its delivery log. Nothing more is sent to it, retries included. Requires scope `webhooks:write`. Request and response schemas: the operation at `/webhook-endpoints/{endpointId}` in https://api.remagica.com/api/v1/openapi.json. # Get a webhook endpoint (/docs/api-reference/webhooks/get-webhook-endpoint) `GET https://api.remagica.com/api/v1/webhook-endpoints/{endpointId}` Returns one endpoint (without its secret). Requires scope `webhooks:read`. Request and response schemas: the operation at `/webhook-endpoints/{endpointId}` in https://api.remagica.com/api/v1/openapi.json. # List an endpoint's deliveries (/docs/api-reference/webhooks/list-webhook-deliveries) `GET https://api.remagica.com/api/v1/webhook-endpoints/{endpointId}/deliveries` An endpoint's deliveries, newest first: each event sent to it, how many attempts it took and what the last one got back. Requires scope `webhooks:read`. Request and response schemas: the operation at `/webhook-endpoints/{endpointId}/deliveries` in https://api.remagica.com/api/v1/openapi.json. # List webhook endpoints (/docs/api-reference/webhooks/list-webhook-endpoints) `GET https://api.remagica.com/api/v1/webhook-endpoints` The workspace's webhook endpoints, oldest first. Secrets are never listed. Requires scope `webhooks:read`. Request and response schemas: the operation at `/webhook-endpoints` in https://api.remagica.com/api/v1/openapi.json. # Redeliver a webhook (/docs/api-reference/webhooks/redeliver-webhook) `POST https://api.remagica.com/api/v1/webhook-deliveries/{deliveryId}/redeliver` Sends a delivery again, with the same event id and body, now and then with the usual retries if it fails. Requires scope `webhooks:write`. Request and response schemas: the operation at `/webhook-deliveries/{deliveryId}/redeliver` in https://api.remagica.com/api/v1/openapi.json. # Rotate a webhook secret (/docs/api-reference/webhooks/rotate-webhook-secret) `POST https://api.remagica.com/api/v1/webhook-endpoints/{endpointId}/secret` Gives an endpoint a new signing secret, in this response only. Deliveries are signed with it from now on; the old one stops working at once. Requires scope `webhooks:write`. Request and response schemas: the operation at `/webhook-endpoints/{endpointId}/secret` in https://api.remagica.com/api/v1/openapi.json. # Send a test event (/docs/api-reference/webhooks/send-webhook-test-event) `POST https://api.remagica.com/api/v1/webhook-endpoints/{endpointId}/test` Sends the endpoint a `webhook.test` event, signed like any other, whatever events it receives. Follow it in the endpoint's deliveries. Requires scope `webhooks:write`. Request and response schemas: the operation at `/webhook-endpoints/{endpointId}/test` in https://api.remagica.com/api/v1/openapi.json. # Update a webhook endpoint (/docs/api-reference/webhooks/update-webhook-endpoint) `PATCH https://api.remagica.com/api/v1/webhook-endpoints/{endpointId}` Changes an endpoint's URL, description or events, or switches it on or off. Its secret stays. Requires scope `webhooks:write`. Request and response schemas: the operation at `/webhook-endpoints/{endpointId}` in https://api.remagica.com/api/v1/openapi.json. # Cancel a result (/docs/api-reference/workflows/cancel-workflow-result) `POST https://api.remagica.com/api/v1/workflows/{workflowId}/results/{resultId}/cancel` Stops one result still being made (`pending` or `processing`). Its provider is asked where it is now: one not yet rendering is cancelled there and ends as an `error` saying it was cancelled, and its credits come back (nothing it may still deliver is kept). One already rendering where the provider can't stop it is kept instead (`stop: kept`): it finishes, is charged, and says so. `POST …/results/stop-preview` says which first. Requires scope `workflows:cancel`. Request and response schemas: the operation at `/workflows/{workflowId}/results/{resultId}/cancel` in https://api.remagica.com/api/v1/openapi.json. # Cancel a run (/docs/api-reference/workflows/cancel-workflow-run) `POST https://api.remagica.com/api/v1/workflow-runs/{runId}/cancel` Stops a run: nothing new starts, and each open result's provider is asked where it is now. Results not yet rendering are cancelled and refunded. Results already rendering where the provider can't stop them are kept (`stop: kept`): they finish and are charged, and the run reads `stopped`, its `error` saying so ("Stopped — 1 result was already rendering and finished."). Otherwise it reads `cancelled`. Requires scope `workflows:cancel`. Request and response schemas: the operation at `/workflow-runs/{runId}/cancel` in https://api.remagica.com/api/v1/openapi.json. # Save a version (/docs/api-reference/workflows/create-workflow-revision) `POST https://api.remagica.com/api/v1/workflows/{workflowId}/revisions` Saves the workflow's document as it is now as a named version. Requires scope `workflows:write`. Request and response schemas: the operation at `/workflows/{workflowId}/revisions` in https://api.remagica.com/api/v1/openapi.json. # Create a workflow (/docs/api-reference/workflows/create-workflow) `POST https://api.remagica.com/api/v1/workflows` Creates a workflow, empty (one page) or from a document. Requires scope `workflows:write`. Request and response schemas: the operation at `/workflows` in https://api.remagica.com/api/v1/openapi.json. # Delete a result (/docs/api-reference/workflows/delete-workflow-result) `DELETE https://api.remagica.com/api/v1/workflows/{workflowId}/results/{resultId}` Deletes one of a node's results from its history. One still being made can't be: cancel it first. For 30 days `POST /workflows/{workflowId}/results/{resultId}/restore` brings it back (undo). Its files stay in storage (an asset filed from it keeps them). Requires scope `workflows:delete`. Request and response schemas: the operation at `/workflows/{workflowId}/results/{resultId}` in https://api.remagica.com/api/v1/openapi.json. # Delete a version (/docs/api-reference/workflows/delete-workflow-revision) `DELETE https://api.remagica.com/api/v1/workflow-revisions/{revisionId}` Deletes a saved version. The workflow itself is unchanged. Requires scope `workflows:delete`. Request and response schemas: the operation at `/workflow-revisions/{revisionId}` in https://api.remagica.com/api/v1/openapi.json. # Delete a workflow (/docs/api-reference/workflows/delete-workflow) `DELETE https://api.remagica.com/api/v1/workflows/{workflowId}` Deletes a workflow with its runs and results. Runs still going are cancelled first. Generated files stay in storage. Requires scope `workflows:delete`. Request and response schemas: the operation at `/workflows/{workflowId}` in https://api.remagica.com/api/v1/openapi.json. # Get a version (/docs/api-reference/workflows/get-workflow-revision) `GET https://api.remagica.com/api/v1/workflow-revisions/{revisionId}` Reads a version: the workflow as it was then, each node with the results it had by then, to look at read-only. Requires scope `workflows:read`. Request and response schemas: the operation at `/workflow-revisions/{revisionId}` in https://api.remagica.com/api/v1/openapi.json. # Get a run (/docs/api-reference/workflows/get-workflow-run) `GET https://api.remagica.com/api/v1/workflow-runs/{runId}` Returns a run with its results so far. Requires scope `workflows:read`. Request and response schemas: the operation at `/workflow-runs/{runId}` in https://api.remagica.com/api/v1/openapi.json. # Get a workflow (/docs/api-reference/workflows/get-workflow) `GET https://api.remagica.com/api/v1/workflows/{workflowId}` Returns a workflow: its document with every node's `results` (oldest first, files with download URLs) and `status`, its active runs and its spend. Read it when you connect to `GET /workflows/{workflowId}/events`, and again whenever you reconnect. Requires scope `workflows:read`. Request and response schemas: the operation at `/workflows/{workflowId}` in https://api.remagica.com/api/v1/openapi.json. # List node types (/docs/api-reference/workflows/list-node-types) `GET https://api.remagica.com/api/v1/node-types` Every node type: its handles, its settings (`data.settings`, as JSON Schema) and how it behaves in a run. Request and response schemas: the operation at `/node-types` in https://api.remagica.com/api/v1/openapi.json. # List videos (/docs/api-reference/workflows/list-videos) `GET https://api.remagica.com/api/v1/videos` Your workspace's finished videos, newest first: what workflows' Export steps (or the last step of a chain) made, video generations made outside workflows, and the Editor's renders. Requires scope `workflows:read`. Request and response schemas: the operation at `/videos` in https://api.remagica.com/api/v1/openapi.json. # List versions (/docs/api-reference/workflows/list-workflow-revisions) `GET https://api.remagica.com/api/v1/workflows/{workflowId}/revisions` A workflow's 100 most recent versions, newest first. Requires scope `workflows:read`. Request and response schemas: the operation at `/workflows/{workflowId}/revisions` in https://api.remagica.com/api/v1/openapi.json. # List runs (/docs/api-reference/workflows/list-workflow-runs) `GET https://api.remagica.com/api/v1/workflows/{workflowId}/runs` A workflow's 100 most recent runs, newest first. Requires scope `workflows:read`. Request and response schemas: the operation at `/workflows/{workflowId}/runs` in https://api.remagica.com/api/v1/openapi.json. # List workflows (/docs/api-reference/workflows/list-workflows) `GET https://api.remagica.com/api/v1/workflows` Your workspace's 100 most recently edited workflows. Requires scope `workflows:read`. Request and response schemas: the operation at `/workflows` in https://api.remagica.com/api/v1/openapi.json. # Preview a stop (/docs/api-reference/workflows/preview-workflow-stop) `POST https://api.remagica.com/api/v1/workflows/{workflowId}/results/stop-preview` What Stop on these open results (`resultIds`, or a run's: `runId`) would still charge, asked of their providers now without changing anything: a result already rendering where its provider can't stop it finishes and is charged. `warning` is what to confirm ("Already rendering — it will finish and be charged (180 credits)."), or null when Stop cancels them all for free. Requires scope `workflows:cancel`. Request and response schemas: the operation at `/workflows/{workflowId}/results/stop-preview` in https://api.remagica.com/api/v1/openapi.json. # Restore a deleted result (/docs/api-reference/workflows/restore-workflow-result) `POST https://api.remagica.com/api/v1/workflows/{workflowId}/results/{resultId}/restore` Brings back a result deleted in the last 30 days (undoes `DELETE /workflows/{workflowId}/results/{resultId}`): it's in its node's history again, in its place. Restoring one that isn't deleted changes nothing. Requires scope `workflows:write`. Request and response schemas: the operation at `/workflows/{workflowId}/results/{resultId}/restore` in https://api.remagica.com/api/v1/openapi.json. # Restore a version (/docs/api-reference/workflows/restore-workflow-revision) `POST https://api.remagica.com/api/v1/workflow-revisions/{revisionId}/restore` Brings a version back: the workflow's document becomes the version's, saved as a new `restore` version (what it was just before is saved as an `auto` one). Send the workflow `version` you last read; if someone saved since, you get `409`. Results aren't touched. Requires scope `workflows:write`. Request and response schemas: the operation at `/workflow-revisions/{revisionId}/restore` in https://api.remagica.com/api/v1/openapi.json. # Set a project's cover (/docs/api-reference/workflows/set-workflow-cover) `PUT https://api.remagica.com/api/v1/workflows/{workflowId}/cover` Sets the image a project's card shows (Set as Cover): one of the workspace's images, by storage key. `null` goes back to the canvas preview. Not an edit of the document: its `version` stays. Requires scope `workflows:write`. Request and response schemas: the operation at `/workflows/{workflowId}/cover` in https://api.remagica.com/api/v1/openapi.json. # Run nodes (/docs/api-reference/workflows/start-workflow-run) `POST https://api.remagica.com/api/v1/workflows/{workflowId}/runs` Runs nodes of a workflow in the background. Each node runs `count` times (per item, when an iterator or a splitter feeds it) and adds that many results to the ones it has; its results show up `pending` at once. Only the nodes asked for run: what's upstream (one hop, and one more past a Router) is read as the result it shows and never run again. Nodes of the run that feed each other run in dependency order. A run is refused with `409 RUN_REFUSED` when a node asked for is already running, a required input isn't connected, or something upstream is still processing, has failed or has nothing to give (`data.code` says which, `data.nodeIds` names the nodes). An `auto` version of the workflow is saved with every run. The response is `202 Accepted` with the run. Follow it with `GET /workflows/{workflowId}/events`, or poll `GET /workflow-runs/{runId}`. Requires scope `workflows:run`. Request and response schemas: the operation at `/workflows/{workflowId}/runs` in https://api.remagica.com/api/v1/openapi.json. # Name a version (/docs/api-reference/workflows/update-workflow-revision) `PATCH https://api.remagica.com/api/v1/workflow-revisions/{revisionId}` Names a version (or clears its name with an empty title). Requires scope `workflows:write`. Request and response schemas: the operation at `/workflow-revisions/{revisionId}` in https://api.remagica.com/api/v1/openapi.json. # Save a workflow (/docs/api-reference/workflows/update-workflow) `PUT https://api.remagica.com/api/v1/workflows/{workflowId}` Saves a workflow's document and/or name. Send the `version` you last read; if someone saved since, you get `409` and should reload (or merge). Nodes' `results` and `status` in what you send are ignored. The response is the workflow's summary with its new `version`. Requires scope `workflows:write`. Request and response schemas: the operation at `/workflows/{workflowId}` in https://api.remagica.com/api/v1/openapi.json. # Follow a workflow (/docs/api-reference/workflows/watch-workflow) `GET https://api.remagica.com/api/v1/workflows/{workflowId}/events` Streams a workflow's changes as server-sent events: a `result` event whenever a node's result changes (`{ type, nodeId, result }`, the result as `GET /workflows/{workflowId}` shows it) and a `run` event when a run ends. Nothing is replayed: read the workflow when you connect and again whenever you reconnect. The stream ends after 15 minutes; reconnect to keep following. Requires scope `workflows:read`. Request and response schemas: the operation at `/workflows/{workflowId}/events` in https://api.remagica.com/api/v1/openapi.json. # Authentication and scopes (/docs/authentication) Every request sends an API key in the `x-api-key` header: macOS / Linux PowerShell cmd ```sh curl https://api.remagica.com/api/v1/models -H "x-api-key: rmg_..." ``` ```powershell curl.exe https://api.remagica.com/api/v1/models -H "x-api-key: rmg_..." ``` ```bat curl https://api.remagica.com/api/v1/models -H "x-api-key: rmg_..." ``` The [MCP server](/docs/connect-claude) that Claude connects to doesn't use API keys. You sign in with your Remagica account instead. ## API keys [#api-keys] * **Create keys in the app**, in **Settings** under **API keys**. Any member of a workspace can create one. The key starts with `rmg_` and is shown once, so copy it then. * **A key belongs to the workspace, not to you.** It spends the workspace's credits, what it makes belongs to the workspace, and it keeps working if the person who made it leaves. * **Nothing a key makes is personal.** Projects, Library items and other things a key creates have workspace (team) visibility, because a key doesn't act as a person. * **Edit or revoke a key** from the same list. You can change your own keys; owners and admins can change anyone's. ## Expiry and rotation [#expiry-and-rotation] * **Expiry:** when you create a key, pick never, 30, 90 or 365 days. The list shows how long a key has left. Once it expires, its calls get `401 UNAUTHORIZED` with "This API key has expired. Create or rotate a key in Settings → API keys." * **Rotation:** open a key's **⋯** menu and pick **Rotate**. This creates a new key with the same name, scopes, allowlist and lifetime, and shows it once. The old key keeps working for 24 hours, or until it expires if that's sooner, so you have time to deploy the new one. A key can only be rotated once, and an expired key can't be rotated. ## IP allowlists [#ip-allowlists] You can limit a key to the addresses your servers call from. When you create or edit the key, list them one per line. Each line is an IPv4 or IPv6 address, or a CIDR range such as `203.0.113.0/24`. A request from any other address gets `401 UNAUTHORIZED`. Leave the list empty to allow any address. ## API activity [#api-activity] **Settings → API activity** lists every request made with your workspace's keys: the time, key, method and path, status and IP. Request bodies and keys are never stored. You can filter by key, status and date, and export the list as CSV. The list also records changes to keys and webhook endpoints. Owners and admins see everything; members see their own keys and their own changes. Events are kept for 90 days. Each key's row in Settings also shows when it was last used, and from which IP. ## What a key can reach [#what-a-key-can-reach] A key only reaches the public API: the endpoints in the [API reference](/docs/api-reference). It can never manage the workspace (members, groups, credit limits), billing, comments, the agent chat or the editor, whatever its scopes. Within the public API, each endpoint needs one scope, shown on its reference page. A key holding that scope can call it. * An endpoint a key can't reach at all answers `404 NOT_FOUND`, as if it didn't exist. * An endpoint the key's scopes don't cover answers `403 FORBIDDEN`, naming the scope it needs: `This key needs workflows:run.` A few read-only endpoints need no key at all: `GET /pricing`, `GET /capabilities` and `GET /node-types`. ## Presets [#presets] When you create a key, start from a preset, then add or remove scopes if you need to. **API** is the one to start with. **Full access** can delete things, so give it only to code you trust with that. | Preset | What it's for | Scopes | | --------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **API** (recommended) | Generate, upload, make clips, run workflows and apps, and read the Library, templates and usage. | `models:list` `generations:cancel` `generations:read` `generations:submit` `uploads:write` `clips:read` `clips:submit` `workflows:read` `workflows:run` `workflows:cancel` `apps:read` `apps:run` `library:read` `templates:read` `usage:read` | | **Builder** | API, plus building: edit projects, workflows, templates, apps and the Library. | `models:list` `generations:cancel` `generations:read` `generations:submit` `uploads:write` `clips:read` `clips:submit` `workflows:read` `workflows:run` `workflows:cancel` `apps:read` `apps:run` `library:read` `templates:read` `usage:read` `projects:write` `workflows:write` `templates:write` `templates:use` `apps:write` `library:write` | | **Generate only** | Models, generations and uploads only. | `models:list` `generations:cancel` `generations:read` `generations:submit` `uploads:write` | | **Read-only** | Read everything a key can read, change nothing. | `apps:read` `brand:read` `clips:read` `generations:read` `library:read` `models:list` `projects:read` `references:read` `sprites:read` `templates:read` `usage:read` `webhooks:read` `workflows:read` | | **Usage** | The credit balance, history and usage, and the price list. | `usage:read` `models:list` | | **Full access** (sensitive) | Every scope of the public API, deletes included. Never workspace admin or billing. | `apps:publish` `apps:read` `apps:run` `apps:write` `brand:delete` `brand:read` `brand:write` `clips:read` `clips:submit` `generations:cancel` `generations:read` `generations:submit` `library:delete` `library:read` `library:share` `library:write` `models:list` `projects:delete` `projects:read` `projects:share` `projects:write` `references:delete` `references:read` `references:write` `sprites:read` `sprites:write` `templates:delete` `templates:read` `templates:use` `templates:write` `uploads:write` `usage:read` `webhooks:read` `webhooks:write` `workflows:cancel` `workflows:delete` `workflows:read` `workflows:run` `workflows:write` | ## Scopes [#scopes] A scope is a resource and an action, like `generations:submit`. These are all the scopes, by resource. ### Apps [#apps] | Scope | Allows | | -------------- | ------------------------------------------------ | | `apps:publish` | Publish apps for the workspace or the community. | | `apps:read` | List and read apps and their runs. | | `apps:run` | Run apps. | | `apps:write` | Create, edit, remix and delete apps. | ### Brand [#brand] | Scope | Allows | | -------------- | ------------------------------------------ | | `brand:delete` | Delete brand kits and moodboards. | | `brand:read` | List and read brand kits and moodboards. | | `brand:write` | Create and edit brand kits and moodboards. | ### Clips [#clips] | Scope | Allows | | -------------- | ------------------------------------------------- | | `clips:read` | List and read clip jobs, their clips and exports. | | `clips:submit` | Start clip jobs and re-export clips. | ### Generations [#generations] | Scope | Allows | | -------------------- | ---------------------------------------------- | | `generations:cancel` | Stop generations in progress. | | `generations:read` | List and read generations and characters. | | `generations:submit` | Generate images, videos, audio and characters. | ### Library [#library] | Scope | Allows | | ---------------- | ---------------------------------------------------- | | `library:delete` | Trash, restore and permanently delete Library items. | | `library:read` | List and read Library items, folders and labels. | | `library:share` | Read and change files' share links. | | `library:write` | Add, edit, move and label Library items and folders. | ### Models [#models] | Scope | Allows | | ------------- | ------------------------------------------------------- | | `models:list` | List models, their capabilities, node types and prices. | ### Projects [#projects] | Scope | Allows | | ----------------- | -------------------------------------------------------- | | `projects:delete` | Delete project folders. | | `projects:read` | List projects and their folders. | | `projects:share` | Share projects by link and copy shared ones. | | `projects:write` | Create, rename, duplicate and move projects and folders. | ### References [#references] | Scope | Allows | | ------------------- | ----------------------------------------------------------------------------------- | | `references:delete` | Delete references. | | `references:read` | List references, their previews and bookmarks, and the thumbnail reference library. | | `references:write` | Add references and bookmark them. | ### Sprites [#sprites] | Scope | Allows | | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `sprites:read` | List and read Sprite Studio games, characters, Sprite DNA, outfits, actions, takes, master candidates, presets, drift reports and exports, estimate runs and follow the live feed. | | `sprites:write` | Create and edit Sprite Studio games, characters, outfits, actions and presets, draw masters, views and takes (spending credits), approve takes, edit, redraw, add and remove frames, pin storyboard sketches, fix drift and export. | ### Templates [#templates] | Scope | Allows | | ------------------ | --------------------------------------------------------- | | `templates:delete` | Delete templates. | | `templates:read` | List and read templates and presets. | | `templates:use` | Start projects from templates and keep presets' examples. | | `templates:write` | Save projects as templates. | ### Uploads [#uploads] | Scope | Allows | | --------------- | --------------------------------------------------------- | | `uploads:write` | Upload files, import them from links and sign their URLs. | ### Usage [#usage] | Scope | Allows | | ------------ | ------------------------------------------- | | `usage:read` | Read the credit balance, history and usage. | ### Webhooks [#webhooks] | Scope | Allows | | ---------------- | -------------------------------------------- | | `webhooks:read` | List webhook endpoints and their deliveries. | | `webhooks:write` | Add, change and test webhook endpoints. | ### Workflows [#workflows] | Scope | Allows | | ------------------ | ------------------------------------------------ | | `workflows:cancel` | Stop workflow runs and results. | | `workflows:delete` | Delete workflows, revisions and results. | | `workflows:read` | Read workflows, revisions, runs and their files. | | `workflows:run` | Run workflows. | | `workflows:write` | Create and edit workflows and their revisions. | ## Keep keys safe [#keep-keys-safe] * Keep keys on your server. Never ship one in a web page or a mobile app. * Give each integration its own key with the fewest scopes it needs, so you can revoke one without breaking the rest. * If a key leaks, revoke it in Settings straight away and create a new one. # Connect to Claude (/docs/connect-claude) Remagica has an MCP server at: ```txt https://api.remagica.com/mcp ``` Claude can use it to make sprites and clips in your workspace. You connect it once and sign in with your Remagica account in the browser. **You don't need an API key for this.** The MCP server signs you in with OAuth, so leave your `rmg_` key out of Claude's settings and out of your terminal. API keys are for calling the [REST API](/docs/quickstart) from your own code. ## Claude Code [#claude-code] Run this in your terminal. It is one line and works the same in macOS and Linux shells, Windows PowerShell and Command Prompt: ```sh claude mcp add --transport http remagica https://api.remagica.com/mcp ``` Then start Claude Code, type `/mcp`, choose **remagica** and sign in. Your browser opens on Remagica and shows the workspace Claude will use, which is the one you have open in the app. If it's the wrong one, switch workspace in Remagica first. Then select **Allow**. To sign in from the terminal instead, run `claude mcp login remagica`. Add `--scope user` after `add` to use Remagica in all your projects, not only the current folder. ## Claude Desktop and claude.ai [#claude-desktop-and-claudeai] Connectors you add on claude.ai also appear in Claude Desktop. 1. Open **Customize** and then **Connectors**. 2. Select **Add**, then **Add custom connector**. 3. Name it `Remagica` and enter `https://api.remagica.com/mcp` as the URL. 4. Leave **Request headers** empty and finish. Sign in with your Remagica account when Claude asks. To use it in a chat, select **+**, then **Connectors**, and turn on Remagica. On Team and Enterprise plans an owner adds the connector under **Organization settings**, and members then select **Connect**. ## What Claude can do [#what-claude-can-do] * **Sprites:** list games and characters, create a character, generate and pick masters, generate and approve takes, check and fix drift, and export. * **Clips:** create an upload URL, start a clip job, and check its progress. Everything Claude makes lands in the workspace you allowed when you signed in, and spends that workspace's [credits](/docs/credits). ## Troubleshooting [#troubleshooting] * **`CommandNotFoundException` or "is not recognized as a command" for an `rmg_…` string:** the API key was run as a command. This happens when a key or a multi-line `sh` snippet is pasted into PowerShell. The MCP connection doesn't need a key, so run only the `claude mcp add` line above. If you pasted your key into a terminal or chat, [rotate it](/docs/authentication#expiry-and-rotation). * **Remagica shows ✘ in `/mcp`:** select it and choose to authenticate again. If the browser can't get back to Claude Code after you sign in, paste the full address from the browser into Claude Code. * **"This access token is not bound to a workspace you belong to":** you were removed from the workspace you allowed. Clear authentication in `/mcp` and sign in again. # Credits and pricing (/docs/credits) Generations, workflow runs, app runs and clip jobs spend your workspace's credits, the same credits the app uses. API requests cost nothing extra. ## Prices [#prices] * `GET /pricing` returns the price book: what every model and action costs, in credits. It needs no key. * `GET /models` returns each model with its `pricing`. * Prices can change. The price book has a `priceVersion`. Send that `priceVersion` with a workflow or app run, and if prices have gone up since, the run is refused with `409 PRICE_CHANGED` and its new estimate, rather than charged more than you expected. ## Estimate before you generate [#estimate-before-you-generate] `POST /generations/estimate` prices a generation without starting it or charging anything. Send the body you'd send to create it, plus its `kind`: `image`, `video`, `music`, `speech`, `sound-effect` or `background-removal`. It needs `models:list`. ```sh curl https://api.remagica.com/api/v1/generations/estimate \ -H "x-api-key: $REMAGICA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "kind": "video", "model": "bytedance/seedance-2.0", "prompt": "A paper boat drifting down a rainy street", "duration": 5 }' ``` ```json { "credits": 120, "breakdown": { "model": "bytedance/seedance-2.0", "priceVersion": 14, "meters": [ { "credits": 120, "rate": "video", "tier": "720p", "unit": "second", "units": 5 } ] } } ``` The values above are examples. Each meter is one part of the price: what it counts (`unit`), how many (`units`) and what that part costs. The estimate validates the body the way creating it would, so a `400` here means the create would fail too. The credits it returns are what the generation charges at today's prices. Workflow and app runs come with their own estimates: `GET /apps/{appId}` includes what a run costs, and a run reports `creditsEstimated` and `creditsSpent`. ## Balance and history [#balance-and-history] These need `usage:read`. * `GET /credits`: the `balance` you can spend now, credits `expiringSoon`, and any `debt`. * `GET /credits/history`: the ledger of grants, charges and refunds. Filter by `apiKeyId` to see what one key spent. * `GET /credits/api-keys`: every key that has spent credits, including deleted ones. * `GET /credit-usage`: usage by model, project and day. ## Failures and cancels [#failures-and-cancels] A generation that fails or is cancelled gives its credits back (`creditsRefunded: true`) when its provider didn't bill anything: it was refused before it ran, failed in a way its provider doesn't charge for, or was cancelled before it started. When the provider did bill it, or may still, the credits stay and the generation's `error` says why: * you cancelled it while the provider was already rendering it (`stopRequested: true`): it finishes and is charged; * the provider charges for the failure, as fal may for a request its safety filter blocked after it ran; * the provider didn't finish in time and may still charge for it, or the answer to our request was lost after it was sent (we never send it twice); * the model finished but saving what it made kept failing. Clip jobs are held and charged for the length we measure from the upload itself, never for more than was held. Tools priced by the length of a video or audio you give them measure it first, and refuse one that is longer than the tool's priced maximum or whose length can't be read. ## Running out [#running-out] When the workspace can't pay for a request, it's refused with `402 OUT_OF_CREDITS` (`data.code` is `1101`) and nothing runs. A workspace owner or admin can add credits in **Settings → Billing**. Members can also hit a per-member credit limit an admin has set. # Downloads and exports (/docs/downloads) Everything you make is a file in your workspace's storage. The API hands you signed download URLs for them, and each comes with the read scope of its resource. ## Signed URLs [#signed-urls] | What | Where the URL is | Scope | | ---------------------- | ----------------------------------------------------------------------------------------- | ------------------ | | A generation's files | `outputs[].url` on `GET /generations/{generationId}` | `generations:read` | | A Library item's files | `versions[].files[].url` on `GET /library/items/{itemId}` | `library:read` | | A clip | `videoUrl`, `posterUrl` and `wordsUrl` on `GET /clip-jobs/{jobId}` | `clips:read` | | A clip export | `videoUrl` on `GET /clips/{clipId}/exports/{exportId}` | `clips:read` | | A workflow result | `outputs` of each result on `GET /workflows/{workflowId}` or `GET /workflow-runs/{runId}` | `workflows:read` | | Any file by key | `POST /files/urls` with its `keys` | `uploads:write` | Signed URLs expire (clip links after an hour). Don't store them: store the storage `key` or the object's id, and fetch a fresh URL when you need one. ## Workflow zips [#workflow-zips] A workflow's files download as zips, streamed, with `workflows:read`: * `GET /api/v1/workflows/{workflowId}/groups/{groupId}/download`: every file of a Section (group). * `GET /api/v1/workflows/{workflowId}/nodes/{nodeId}/download`: every result one node has made. ```sh curl -L https://api.remagica.com/api/v1/workflows/WORKFLOW_ID/nodes/NODE_ID/download \ -H "x-api-key: $REMAGICA_API_KEY" \ -o results.zip ``` ## Clip exports [#clip-exports] A clip job's clips are finished files you can download straight away. To get a different version of a clip, with another caption style, hook or corrected words, [re-export it](/docs/make-clips#4-re-export-a-clip): that renders a new file in seconds, and the original stays as it was. ## Share links [#share-links] To share a file with someone outside your workspace, `PUT /asset-shares` makes a public share link for it, and `GET /asset-shares` reads it back. Both need `library:share`. # Errors and rate limits (/docs/errors) ## Error format [#error-format] Errors are JSON with a stable, machine-readable `code` and a `message` you can show to people: ```json { "defined": true, "code": "FORBIDDEN", "status": 403, "message": "This key needs workflows:run." } ``` * `400 BAD_REQUEST` adds `data.issues`: one entry per failed check, with its `path` and `message`. * Some errors add `data` with details, such as `RUN_REFUSED` and `PRICE_CHANGED`. Each endpoint's reference page lists the errors it can return. * `defined` is `true` for documented errors and `false` for unexpected ones. ## Status codes [#status-codes] | Status | Code | What it means for a key | | ------ | ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `400` | `BAD_REQUEST` | The input failed validation. Fix the fields in `data.issues`. | | `401` | `UNAUTHORIZED` | No key, an unknown, revoked or expired key, a call from outside the key's IP allowlist, or a key over its rate limit. | | `402` | `OUT_OF_CREDITS` | The workspace can't pay for this. Nothing ran. See [Credits](/docs/credits). | | `403` | `FORBIDDEN` | The key is valid but lacks the scope this endpoint needs. The message names it: `This key needs generations:submit.` | | `404` | `NOT_FOUND` | The thing doesn't exist or belongs to another workspace, or the route isn't one keys can call (workspace admin, billing and the like). | | `409` | `CONFLICT`, `RUN_REFUSED`, `PRICE_CHANGED` | The request clashes with the current state: a reused [idempotency key](/docs/idempotency), a run that can't start (`data.code` says why), or prices that rose since your estimate. | | `500` | `INTERNAL_SERVER_ERROR` | Something broke on our side. Safe to retry. | ### 403 or 404? [#403-or-404] A key gets `403` when the endpoint is part of the public API but the key's scopes don't cover it. Add the scope (Settings → API keys → Edit) or use another key. A key gets `404` for routes outside the public API, whatever its scopes, the same answer as for a route that doesn't exist. Those routes are only for people signed in to the app. ## Rate limits [#rate-limits] Each key can make **600 requests per 60 seconds**. Past that, its requests are refused until the window moves on. Today that refusal is `401 UNAUTHORIZED`, the same as an invalid key, so if a key that just worked gets a `401`, wait a few seconds before retrying. To stay under the limit: * Poll every few seconds, not in a tight loop. Clip jobs suggest about 5 seconds. * Stream progress where you can (`GET /clip-jobs/{jobId}/events`, `GET /workflows/{workflowId}/events`), or use [webhooks](/docs/webhooks). * Use separate keys for separate integrations. Each key has its own limit. ## Retrying [#retrying] * Retry `500`s and network errors with backoff, and send an [`Idempotency-Key`](/docs/idempotency) on `POST`s so a retry never runs twice. * Don't retry `400`, `402`, `403` or `404` unchanged: they'll fail the same way. # Generate images (/docs/generate-images) Needs `generations:submit` to create and `generations:read` to poll. `GET /models` needs `models:list`. ## Pick a model [#pick-a-model] `GET /models` lists every model. Image models have `kind: "image"`. Each one's `capabilities` say what it accepts (aspect ratios, resolutions, how many reference images) and `pricing` says what it costs. ```sh curl https://api.remagica.com/api/v1/models -H "x-api-key: $REMAGICA_API_KEY" ``` Models are named by what they are, like `google/nano-banana-pro`. Remagica picks which provider serves each request. ## Generate from a prompt [#generate-from-a-prompt] ```sh curl https://api.remagica.com/api/v1/generations/images \ -H "x-api-key: $REMAGICA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "google/nano-banana-pro", "prompt": "Product photo of a ceramic mug on oak, soft window light", "aspectRatio": "4:5", "count": 2 }' ``` Only `model` and `prompt` are required. `count` makes several images in one request. The other fields (`aspectRatio`, `resolution`, `quality`, `seed`, ...) depend on the model; its `capabilities` list what it takes, and the [reference](/docs/api-reference/generations/create-image-generation) lists every field. ## Edit or compose from images [#edit-or-compose-from-images] Pass reference images by storage key. Use an [upload](/docs/uploads)'s `key`, or an output `key` of an earlier generation: ```json { "model": "google/nano-banana-pro", "prompt": "Put this mug on a marble kitchen counter", "references": [{ "key": "uploads/…/mug.png" }] } ``` With references, the model edits or combines them as the prompt says. ## Get the result [#get-the-result] The request answers `202 Accepted` with the generation. Its `status` goes `queued` → `running` → `completed`, or ends `failed` (`error` says why) or `cancelled`. Images take seconds. Poll `GET /generations/{generationId}` every couple of seconds, or listen for the `generation.succeeded` [webhook](/docs/webhooks). When it's `completed`, `outputs` lists the files: ```json { "id": "7a1c9e42-…", "status": "completed", "credits": 8, "outputs": [ { "kind": "image", "role": "output", "contentType": "image/png", "width": 1024, "height": 1280, "key": "generations/…/0.png", "url": "https://…" } ] } ``` `url` downloads the file; it expires, so fetch the generation again for a fresh one. `key` feeds the file into another generation. ## Other kinds [#other-kinds] The same pattern works for every kind of generation: * `POST /generations/background-removals`: a cutout of an `image`. * `POST /generations/speech`: `text` read by a `voice`. * `POST /generations/sound-effects`: a sound from a `prompt`. * `POST /generations/music`: a track from a `prompt`, with or without `lyrics`. Stop one that's still going with `POST /generations/{generationId}/cancel` (`generations:cancel`). One that hasn't started yet, here or in its provider's queue, ends `cancelled` and its credits come back. One the provider is already rendering can't be stopped without being billed, so it's kept: the response has `stopRequested: true`, and it finishes and is charged. # Generate videos (/docs/generate-videos) Needs `generations:submit` to create and `generations:read` to poll. ## From a prompt [#from-a-prompt] ```sh curl https://api.remagica.com/api/v1/generations/videos \ -H "x-api-key: $REMAGICA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "bytedance/seedance-2.0", "prompt": "Slow dolly in on a neon-lit ramen stall in the rain", "aspectRatio": "9:16", "duration": 5 }' ``` Only `model` and `prompt` are required. `duration` is in seconds, or `"auto"` to let the model choose. Video models have `kind: "video"` in `GET /models`, and their `capabilities` list the durations, resolutions and aspect ratios each one takes. Check the price first with [`POST /generations/estimate`](/docs/credits#estimate-before-you-generate): video costs more than images and scales with length and resolution. ## From frames and references [#from-frames-and-references] * `firstFrame` and `lastFrame` pin the opening and closing frames. Each is `{ "key": "…" }`, a file in your storage. * `referenceImages`, `referenceVideos` and `referenceAudios` guide the look, motion or sound, if the model supports them. * A registered character works as a frame or reference too: `{ "asset": "" }` from `GET /characters`. ```json { "model": "bytedance/seedance-2.0", "prompt": "She turns to the camera and smiles", "firstFrame": { "key": "uploads/…/portrait.png" }, "duration": 5 } ``` ## Chain shots [#chain-shots] A finished video's `outputs` include its final frame, with `role: "last_frame"`. Pass that output's `key` as the next video's `firstFrame` and the two shots join up. ## Get the result [#get-the-result] Video takes minutes. Poll `GET /generations/{generationId}` every 5–10 seconds, or listen for the `generation.succeeded` [webhook](/docs/webhooks). The finished video is the output with `role: "output"`; its `durationSeconds`, `width` and `height` describe it, and `url` downloads it. # Idempotency (/docs/idempotency) A request can time out after the server got it. If you retry a generation blindly, you might start it twice and pay twice. Send an `Idempotency-Key` header and retries are safe. ```sh curl https://api.remagica.com/api/v1/generations/images \ -H "x-api-key: $REMAGICA_API_KEY" \ -H "Idempotency-Key: 5f0c7e1a-2b8d-4c3e-9a61-7d2f4b8e0c19" \ -H "Content-Type: application/json" \ -d '{ "model": "google/nano-banana-pro", "prompt": "A red kite over the sea" }' ``` ## Where it works [#where-it-works] Every `POST` that spends credits or starts work takes the header: * Generations: `POST /generations/images`, `/videos`, `/music`, `/speech`, `/sound-effects`, `/background-removals`, and `POST /characters`. * Clips: `POST /clip-jobs` and `POST /clips/{clipId}/exports`. * Runs: `POST /workflows/{workflowId}/runs` and `POST /apps/{appId}/runs`. * Uploads: `POST /uploads` and `POST /uploads/from-url`. * Brand kits: `POST /brand-kits/from-website` and `POST /brand-kits/from-file`. ## How it behaves [#how-it-behaves] | You send | You get | | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------- | | No header | A normal request. | | A new key | A normal request. The key and its response are kept for 24 hours. | | The same key and the same body again | The first response, replayed. Nothing new runs and nothing is charged. | | The same key with a different body or endpoint | `409 CONFLICT`: "This Idempotency-Key was already used with a different request". | | The same key while the first request is still being handled | `409 CONFLICT`: "A request with this Idempotency-Key is still in progress". Wait, then retry. | | A key that isn't 1–255 printable ASCII characters | `400 BAD_REQUEST`. | * Keys belong to your workspace. Two workspaces can use the same key without clashing. * If a request fails with an error, its key is freed, so you can retry with the same key. * After 24 hours a key can be used again for a new request. ## Choosing keys [#choosing-keys] Use a new random value, such as a UUID, for each thing you mean to do, and reuse it only when retrying that same thing: ```ts const key = crypto.randomUUID(); async function createImage(body: object) { for (let attempt = 0; attempt < 3; attempt++) { const response = await fetch( "https://api.remagica.com/api/v1/generations/images", { body: JSON.stringify(body), headers: { "Content-Type": "application/json", "Idempotency-Key": key, "x-api-key": process.env.REMAGICA_API_KEY, }, method: "POST", } ); if (response.status !== 409 && response.status < 500) { return response.json(); } await new Promise((resolve) => setTimeout(resolve, 1000 * 2 ** attempt)); } throw new Error("Couldn't create the image"); } ``` The generation and workflow run bodies also take an `idempotencyKey` field. It still works, but prefer the header, which covers every endpoint above. # Introduction (/docs) The Remagica API gives your code the same tools as the canvas. You can generate images, video, speech and music with the models in the app, run workflows and apps your team built, and turn long videos into short vertical clips. Everything you make lands in your workspace, next to what your team makes in the app. ## How it works [#how-it-works] * **One base URL:** `https://api.remagica.com/api/v1`. Requests and responses are JSON. * **API keys:** every request sends a key in the `x-api-key` header. A key belongs to one workspace and can only do what its [scopes](/docs/authentication) allow. * **Credits:** anything that generates spends your workspace's credits, at the prices in the app. See [Credits and pricing](/docs/credits). * **Jobs run in the background:** a request that makes something answers `202 Accepted` straight away. You then poll for the result, or get a [webhook](/docs/webhooks) when it's done. * **Files:** you [upload](/docs/uploads) inputs to storage first and pass them around by storage `key`. Results come back with signed download URLs. ## Where to start [#where-to-start] Create a key and make your first image. Presets, scopes and what a key can reach. Every endpoint, with a playground. Get told when work finishes. Use Remagica from Claude Code, Desktop or claude.ai. ## For tools and agents [#for-tools-and-agents] * The OpenAPI document is at [`/api/v1/openapi.json`](https://api.remagica.com/api/v1/openapi.json). Use it to generate a client. * These docs are available as plain text for LLMs at [`/llms.txt`](/llms.txt) and [`/llms-full.txt`](/llms-full.txt). Add `.md` to any page's URL for its Markdown. # Make clips (/docs/make-clips) A clip job finds the strongest moments of a long video, reframes them (9:16 by default), and adds word-by-word captions and a hook card. Needs `uploads:write` to upload, `clips:submit` to start jobs and exports, and `clips:read` to follow them. ## 1. Upload the video [#1-upload-the-video] Upload it as in [Uploading files](/docs/uploads) and keep its `key`. ## 2. Start a job [#2-start-a-job] ```sh curl https://api.remagica.com/api/v1/clip-jobs \ -H "x-api-key: $REMAGICA_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "sourceKey": "uploads/…/keynote.mp4", "aspectRatio": "9:16", "clipLength": "s30_59", "hookStyle": "pill" }' ``` Only `sourceKey` is required. The options you'll use most: * `aspectRatio`: `9:16` (default), `1:1`, `16:9` or `4:5`. * `clipLength`: `auto` (15 s to 3 min), or a range such as `lt30` or `s30_59`. * `captions`, `captionStyle`: burn captions in (on by default) and how they look. * `hook`, `hookStyle`: the headline card over each clip's first seconds. * `maxMinutes`: only process the start of the video. * `sourceSeconds`: the video's length, if you know it, so the right credits are set aside up front. The [reference](/docs/api-reference/clip-jobs/create-clip-job) lists them all. You get `202 Accepted` with the job's `jobId`. ## 3. Wait for it [#3-wait-for-it] A job takes minutes, depending on the video's length. * **Stream:** `GET /clip-jobs/{jobId}/events` sends server-sent events: the current state, then a `message` each time the stage or percent changes, then `done` when it finishes. * **Poll:** `GET /clip-jobs/{jobId}` about every 5 seconds. `status` goes `queued` → `processing` → `completed` or `failed`. While it runs, `progress` says which stage it's in (`preparing`, `transcribing`, `selecting`, `rendering`, `finalizing`) with a `percent`. * **Webhooks:** `clip_job.succeeded` and `clip_job.failed`. When it's `completed`, `clips` lists each clip with its `title`, `score`, `startSeconds` and `endSeconds`, the finished `videoUrl`, a `posterUrl`, and `wordsUrl` (the transcript with word timings). ## 4. Re-export a clip [#4-re-export-a-clip] To change a clip without cutting again, export it with new options: another caption style, a different hook, or corrected words. ```sh curl https://api.remagica.com/api/v1/clips/CLIP_ID/exports \ -H "x-api-key: $REMAGICA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "hook": { "text": "The one tip nobody tells you" } }' ``` An export takes seconds. Poll `GET /clips/{clipId}/exports/{exportId}` until it's done, then download its `videoUrl`. Clip download URLs expire after an hour. Fetch the job or export again for fresh ones. # Quickstart (/docs/quickstart) This takes about five minutes. You need a Remagica account with some credits. ## 1. Create a key [#1-create-a-key] 1. Open [Remagica](https://remagica.com/login), go to **Settings**, and find **API keys**. 2. Select **Create API key**, give it a name, and keep the **API** preset. It can generate, upload, make clips and run workflows and apps. 3. Copy the key. It starts with `rmg_` and is shown only once. Keep the key secret. Anyone who has it can spend your workspace's credits. Store it in an environment variable, not in your code. Pick the tab for your terminal, since each shell sets variables differently: macOS / Linux PowerShell cmd ```sh export REMAGICA_API_KEY="rmg_..." ``` ```powershell $env:REMAGICA_API_KEY = "rmg_..." ``` ```bat set REMAGICA_API_KEY=rmg_... ``` The variable lasts until you close the terminal. Never paste the key on a line by itself: the shell runs it as a command and fails, and the key ends up in your shell history. Claude Code, Claude Desktop and claude.ai connect through the MCP server and sign you in with your Remagica account, so they don't need a key. See [Connect to Claude](/docs/connect-claude). ## 2. Check the key works [#2-check-the-key-works] List the models you can use: macOS / Linux PowerShell cmd ```sh curl https://api.remagica.com/api/v1/models \ -H "x-api-key: $REMAGICA_API_KEY" ``` ```powershell curl.exe https://api.remagica.com/api/v1/models ` -H "x-api-key: $env:REMAGICA_API_KEY" ``` ```bat curl https://api.remagica.com/api/v1/models ^ -H "x-api-key: %REMAGICA_API_KEY%" ``` In Windows PowerShell, `curl` on its own is a different command, so type `curl.exe`. Each shell also ends a continued line differently: `\` in macOS and Linux, a backtick in PowerShell and `^` in cmd (Command Prompt). Each model has an `id`, the `kind` of thing it makes, what it accepts (`capabilities`) and what it costs in credits (`pricing`). ## 3. Generate an image [#3-generate-an-image] macOS / Linux PowerShell cmd ```sh curl https://api.remagica.com/api/v1/generations/images \ -H "x-api-key: $REMAGICA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "google/nano-banana-pro", "prompt": "A lighthouse on a cliff at dusk, cinematic, 35mm" }' ``` ```powershell Invoke-RestMethod https://api.remagica.com/api/v1/generations/images ` -Method Post ` -Headers @{ "x-api-key" = $env:REMAGICA_API_KEY } ` -ContentType "application/json" ` -Body (@{ model = "google/nano-banana-pro" prompt = "A lighthouse on a cliff at dusk, cinematic, 35mm" } | ConvertTo-Json) ``` ```bat curl https://api.remagica.com/api/v1/generations/images ^ -H "x-api-key: %REMAGICA_API_KEY%" ^ -H "Content-Type: application/json" ^ -d "{\"model\": \"google/nano-banana-pro\", \"prompt\": \"A lighthouse on a cliff at dusk, cinematic, 35mm\"}" ``` You get `202 Accepted` with the new generation. Note its `id` and `status` (`queued`). ## 4. Wait for it [#4-wait-for-it] Poll the generation until `status` is `completed` or `failed`. Images take a few seconds. macOS / Linux PowerShell cmd ```sh curl https://api.remagica.com/api/v1/generations/GENERATION_ID \ -H "x-api-key: $REMAGICA_API_KEY" ``` ```powershell curl.exe https://api.remagica.com/api/v1/generations/GENERATION_ID ` -H "x-api-key: $env:REMAGICA_API_KEY" ``` ```bat curl https://api.remagica.com/api/v1/generations/GENERATION_ID ^ -H "x-api-key: %REMAGICA_API_KEY%" ``` The other guides show `sh` commands. On Windows, change them the same way: `$REMAGICA_API_KEY` becomes `$env:REMAGICA_API_KEY` in PowerShell or `%REMAGICA_API_KEY%` in Command Prompt, and the line endings change as above. The same steps in JavaScript: ```ts const API = "https://api.remagica.com/api/v1"; const headers = { "Content-Type": "application/json", "x-api-key": process.env.REMAGICA_API_KEY, }; const created = await fetch(`${API}/generations/images`, { body: JSON.stringify({ model: "google/nano-banana-pro", prompt: "A lighthouse on a cliff at dusk, cinematic, 35mm", }), headers, method: "POST", }).then((response) => response.json()); let generation = created; while (generation.status === "queued" || generation.status === "running") { await new Promise((resolve) => setTimeout(resolve, 2000)); generation = await fetch(`${API}/generations/${created.id}`, { headers, }).then((response) => response.json()); } console.log(generation.status, generation.outputs[0]?.url); ``` ## 5. Download the result [#5-download-the-result] A completed generation lists its files in `outputs`. Each has a `url` you can download, and a storage `key` you can pass to another generation. Download URLs expire, so fetch the generation again for a fresh one. ## Next [#next] * [Authentication and scopes](/docs/authentication): choose what a key can do. * [Generate videos](/docs/generate-videos), [run a workflow](/docs/run-a-workflow) or [make clips](/docs/make-clips). * [Webhooks](/docs/webhooks): stop polling. * [Connect to Claude](/docs/connect-claude): use Remagica from Claude Code, Claude Desktop or claude.ai. # Run a workflow (/docs/run-a-workflow) A workflow is a canvas: pages of nodes (Prompt, Image, Video, Voice, Music, iterators and more) joined by edges. Your code can run any of its nodes, the same way the canvas's Run button does. Needs `workflows:read` to read and follow, `workflows:run` to run and `workflows:cancel` to stop. Building or editing workflows needs `workflows:write`, which the **Builder** preset includes. ## Find the workflow and its nodes [#find-the-workflow-and-its-nodes] `GET /workflows` lists your workspace's workflows. `GET /workflows/{workflowId}` returns one, with its `document`: every page, node and edge, and each node's `results`. The workflow's id is also in its URL when you open it in the app. Node ids are in the `document`, on each node. ## Run nodes [#run-nodes] ```sh curl https://api.remagica.com/api/v1/workflows/WORKFLOW_ID/runs \ -H "x-api-key: $REMAGICA_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "nodeIds": ["node_video_1"], "count": 2 }' ``` * `nodeIds` are the nodes to run. Each makes `count` results (1–20), or `count` per item when an iterator or splitter feeds it. * Nodes upstream aren't run again. Each node reads the result its inputs currently show. * The run's estimate is set aside from your credits when it starts. Send `priceVersion` from `GET /pricing` to be refused with `409 PRICE_CHANGED`, not charged more, if prices rose. * A run that can't start is refused with `409 RUN_REFUSED`. Its `data.code` says why (`missing_input`, `already_running`, `out_of_credits`, ...) and `data.nodeIds` says which nodes. ## Follow it [#follow-it] * **Stream:** `GET /workflows/{workflowId}/events` sends server-sent events: a `result` event each time a node's result changes, and a `run` event when a run ends. Nothing is replayed, so read the workflow when you connect. The stream ends after 15 minutes; reconnect to keep following. * **Poll:** `GET /workflow-runs/{runId}` returns the run's `status` (`running`, then `completed`, `failed`, `cancelled` or `stopped`), its `results`, `creditsEstimated` and `creditsSpent`. * **Webhooks:** `workflow_run.succeeded` and `workflow_run.failed`. See [Webhooks](/docs/webhooks). Each result's `outputs` hold its files, with download URLs. ## Stop it [#stop-it] `POST /workflow-runs/{runId}/cancel` stops a run, and `POST /workflows/{workflowId}/results/{resultId}/cancel` stops one result. Results that already finished are kept. ## Download its files [#download-its-files] A Section (group) of the canvas downloads as one zip, and so does everything one node has made. See [Downloads and exports](/docs/downloads). # Run an app (/docs/run-an-app) An app is one page of a workflow packaged as a form: a few inputs (a prompt, an image, a setting) and the outputs they make. It's the simplest way to run a team's workflow from code, because you only fill in the form. Needs `apps:read` to read apps and `apps:run` to run them. ## Find the app and its inputs [#find-the-app-and-its-inputs] `GET /apps` lists the apps you can run: your workspace's, and community ones. `GET /apps/{appId}` returns one, with: * `form`: its inputs. Each has a `nodeId`, a `key`, a `label` and a `type` (`text`, `image`, `video`, `audio` or `parameter`). * `outputs`: the nodes whose results the app returns. * `creditsEstimate`: what a run with the app's own values costs. An input's id is `nodeId:key`. ## Run it [#run-it] ```sh curl https://api.remagica.com/api/v1/apps/APP_ID/runs \ -H "x-api-key: $REMAGICA_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "values": { "node_prompt_1:text": "A cozy cabin in the snow, golden hour", "node_image_1:file": "uploads/…/reference.jpg" }, "count": 1 }' ``` * `values` are by input id (the ids above are examples; read yours from `form`). Text and parameters take their value; media inputs take a storage `key` of your workspace's file (see [Uploading files](/docs/uploads)). * Inputs you leave out keep the app's own value. * `count` (1–20) is how many results each output makes. The run happens in a copy of the app's page in a workflow of your workspace, which pays for it. You get `202 Accepted` with the app run; its `run` is a workflow run, and its results show up as `pending` at once. ## Get the outputs [#get-the-outputs] Follow the run as you would [a workflow run](/docs/run-a-workflow#follow-it): stream `GET /workflows/{workflowId}/events` with the run's `workflowId`, poll `GET /workflow-runs/{runId}`, or listen for the `app_run.succeeded` [webhook](/docs/webhooks). `GET /apps/{appId}/runs` lists your past runs of an app. A run that can't start is refused with `409 RUN_REFUSED`, as a workflow run is. # Uploading files (/docs/uploads) The API never takes file bytes in a JSON body. You upload a file to storage first, then pass its storage `key` to whatever needs it: a generation's references, a video's first frame, a clip job's source, an app's media input. Uploading needs `uploads:write`. ## Upload a file [#upload-a-file] 1. **Ask for an upload URL** with the file's name, MIME type and size: ```sh curl https://api.remagica.com/api/v1/uploads \ -H "x-api-key: $REMAGICA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "filename": "keynote.mp4", "contentType": "video/mp4", "size": 734003200 }' ``` The response has a presigned `uploadUrl`, the `headers` to send with it, when it expires (`expiresAt`, 15 minutes) and the file's storage `key`. 2. **`PUT` the raw bytes to `uploadUrl`**, with exactly the returned headers. The bytes go straight to storage, not through the API. ```sh curl -X PUT "$UPLOAD_URL" \ -H "Content-Type: video/mp4" \ --data-binary @keynote.mp4 ``` 3. **Use the `key`** once the `PUT` has finished. In JavaScript: ```ts import { readFile, stat } from "node:fs/promises"; async function upload(path: string, contentType: string): Promise { const { size } = await stat(path); const ticket = await fetch("https://api.remagica.com/api/v1/uploads", { body: JSON.stringify({ contentType, filename: path.split("/").pop(), size, }), headers: { "Content-Type": "application/json", "x-api-key": process.env.REMAGICA_API_KEY, }, method: "POST", }).then((response) => response.json()); const put = await fetch(ticket.uploadUrl, { body: await readFile(path), headers: ticket.headers, method: "PUT", }); if (!put.ok) { throw new Error(`Upload failed: ${put.status}`); } return ticket.key; } ``` ## Import from a link [#import-from-a-link] If an image, video or audio file is already online, `POST /uploads/from-url` with its `url` copies it into your storage (up to 200 MB) and returns its `key`, `kind` and `contentType`. Links to private addresses are refused. ## Signed URLs for your files [#signed-urls-for-your-files] `POST /files/urls` with a list of `keys` returns `files`: a short-lived download URL for each key, by key. Keys that aren't your workspace's files are left out. ## Limits [#limits] * One file can be up to 5 GiB minus 5 MiB (5,363,466,240 bytes). * Accepted types are any `video/*`, `audio/*` or `image/*`, plus PDF and Word (`.docx`) files for brand kits. * Upload URLs expire after 15 minutes. Ask for a new one if yours runs out. # Webhooks (/docs/webhooks) Instead of polling, give Remagica an HTTPS URL and pick the events you care about. When one happens, Remagica sends a signed `POST` to that URL. ## Add an endpoint [#add-an-endpoint] * **In the app:** go to **Settings → Webhooks**, add your URL and tick its events. **Send test event** checks it works, and the delivery log shows every attempt. * **With the API:** `POST /webhook-endpoints` with `url` and `events` (`webhooks:write`). The [Webhooks section of the API reference](/docs/api-reference/webhooks/list-webhook-endpoints) covers listing, changing, testing and deleting endpoints, reading deliveries (`webhooks:read`) and redelivering them. The URL must be `https://` on the public internet. Private, loopback and link-local addresses are refused, and redirects aren't followed. When you create an endpoint you get its **signing secret**, which starts with `whsec_`. It's shown once, so store it on your server. You can rotate it (`POST /webhook-endpoints/{endpointId}/secret`); the old secret stops working straight away. ## Events [#events] | Event | When | | ------------------------------------------------------------------------ | ----------------------------------------------------------------------------- | | `generation.succeeded`, `generation.failed`, `generation.canceled` | A generation finished, failed or was canceled. | | `workflow_run.succeeded`, `workflow_run.failed`, `workflow_run.canceled` | A workflow run finished, failed or was stopped. | | `app_run.succeeded`, `app_run.failed`, `app_run.canceled` | An app run finished, failed or was stopped. | | `clip_job.succeeded`, `clip_job.failed` | A clip job finished or failed. | | `clip_export.succeeded`, `clip_export.failed` | A clip re-export finished or failed. | | `webhook.test` | You sent a test event. It goes to the endpoint whatever events it has picked. | The API reference lists each event's payload under **Webhook events**. ## What a delivery looks like [#what-a-delivery-looks-like] Each delivery is a JSON `POST` with these headers: | Header | Value | | --------------------- | ---------------------------------------------------------------------- | | `Content-Type` | `application/json` | | `Remagica-Signature` | `t=,v1=` | | `Remagica-Event-Id` | The event's id (`evt_…`). It's the same in every retry and redelivery. | | `Remagica-Event-Type` | The event's type, as in the body. | The body names the event and carries the resource exactly as its `GET` returns it. For example, `GET /generations/{generationId}` for a generation, or `GET /workflow-runs/{runId}` for a workflow run: ```json { "id": "evt_…", "type": "generation.succeeded", "createdAt": "2026-10-21T12:00:00.000Z", "organizationId": "…", "data": { "id": "7a1c9e42-…", "kind": "image", "status": "completed", "outputs": [{ "key": "…", "url": "https://…", "contentType": "image/png" }] } } ``` A webhook never shows more than an API key could read with `GET`. ## Verify signatures [#verify-signatures] Check every delivery before you trust it. `v1` is the hex HMAC-SHA256 of `.`, keyed with your endpoint's `whsec_` secret. Compute it from the **raw** request body before you parse it, compare in constant time, and refuse old timestamps: ```ts import { createHmac, timingSafeEqual } from "node:crypto"; /** How old a delivery may be, against replays. */ const TOLERANCE_SECONDS = 300; export function verifyRemagicaSignature( rawBody: string, header: string, secret: string ): boolean { const fields = header.split(",").map((part) => part.trim().split("=")); const timestamp = Number(fields.find(([name]) => name === "t")?.[1]); const signatures = fields .filter(([name]) => name === "v1") .map(([, value]) => value ?? ""); if ( !Number.isInteger(timestamp) || Math.abs(Date.now() / 1000 - timestamp) > TOLERANCE_SECONDS ) { return false; } const expected = createHmac("sha256", secret) .update(`${timestamp}.${rawBody}`) .digest("hex"); return signatures.some( (signature) => signature.length === expected.length && timingSafeEqual(Buffer.from(signature), Buffer.from(expected)) ); } ``` For example, with Express: ```ts import express from "express"; const app = express(); app.post( "/webhooks/remagica", express.raw({ type: "application/json" }), (request, response) => { const body = request.body.toString("utf8"); const header = request.get("Remagica-Signature") ?? ""; if (!verifyRemagicaSignature(body, header, process.env.REMAGICA_WEBHOOK_SECRET)) { return response.status(400).send("Bad signature"); } const event = JSON.parse(body); // Answer quickly; do slow work after. response.sendStatus(200); handle(event); } ); ``` ## Retries [#retries] * Answer with any `2xx` status within 10 seconds. Anything else, or no answer, counts as a failed attempt. * A failed delivery is retried with backoff, from 30 seconds up to 12 hours between attempts. That's 8 attempts over about 22 hours. After the last one, the delivery is marked failed. * An endpoint is switched off after 20 failed deliveries in a row, or after 3 days of failing. Settings shows why. Fix your endpoint, then turn it back on. * Deliveries can arrive more than once, and out of order. Use `Remagica-Event-Id` to skip events you've already handled. If you need the latest state, read the resource again with the API. * To send one again, use the delivery log in **Settings → Webhooks** or `POST /webhook-deliveries/{deliveryId}/redeliver`.