# skills/api

Use the assets.dev REST API and MCP surface to create branded renders from agents.

## Auth

- Get an API key with `POST https://app.assets.dev/api/v1/agent/register`, approve the device flow, then poll `POST https://app.assets.dev/api/v1/agent/token`.
- Send the key as `Authorization: Bearer <apiKey>`.
- Read the live OpenAPI document at `https://app.assets.dev/api/v1/openapi.json`.
- Connected MCP hosts should use `https://app.assets.dev/api/mcp`; headless agents can use the same API key as a bearer token.

## Render Loop

1. List templates with `GET /api/v1/templates`.
2. Fetch a template schema with `GET /api/v1/templates/{id}`.
3. Create or select a brand with `POST /api/v1/extractions`, `GET /api/v1/extractions/{id}`, and `POST /api/v1/brands`.
4. Submit one or more variants with `POST /api/v1/renders`.
5. Poll `GET /api/v1/renders/{id}`; when done, fetch `GET /api/v1/renders/{id}/file`.
6. Publish with `POST /api/v1/renders/{id}/publish` only when the output should be public.

## Credits

- Check `GET /api/v1/credits` before expensive batches.
- Image and video variants both debit credits; videos cost more as duration and scale increase.
- Failed renders are refunded and emit `render.failed` webhooks with `refunded: true`.

## Webhooks

- Register endpoints with `POST /api/v1/webhooks`.
- Verify `X-Studio-Signature` as HMAC-SHA256 over `<timestamp>.<body>`.
- Store event IDs and ignore duplicates.

## Endpoint List

- `DELETE /api/v1/webhooks/{id}`
- `GET /api/v1/brands/{id}/extractions/{extractionId}/diff`
- `GET /api/v1/brands/{id}/versions`
- `GET /api/v1/brands/{id}`
- `GET /api/v1/brands`
- `GET /api/v1/credits`
- `GET /api/v1/extractions/{id}`
- `GET /api/v1/renders/{id}`
- `GET /api/v1/skills/{name}`
- `GET /api/v1/skills`
- `GET /api/v1/templates/{id}`
- `GET /api/v1/templates`
- `GET /api/v1/webhooks`
- `PATCH /api/v1/brands/{id}`
- `POST /api/v1/agent/register`
- `POST /api/v1/agent/token`
- `POST /api/v1/brands/{id}/extractions/{extractionId}/apply`
- `POST /api/v1/brands/{id}/extractions`
- `POST /api/v1/brands/{id}/versions/{versionId}/restore`
- `POST /api/v1/brands/{id}/versions`
- `POST /api/v1/brands`
- `POST /api/v1/claims`
- `POST /api/v1/extractions`
- `POST /api/v1/renders`
- `POST /api/v1/webhooks`
- `PUT /api/v1/brands/{id}`
