---
title: "Add to a Brand Library"
method: POST
path: "/brands/{id}/library"
tags: ["Library"]
---

# Add to a Brand Library

`POST /brands/{id}/library`

## Request

- Base URL: `https://www.rainbrand.com/api/v1`
- URL: `https://www.rainbrand.com/api/v1/brands/{id}/library`
- Auth: one of:
  - API key in header `x-api-key`
  - HTTP bearer
  - OAuth 2
    - Authorization code: `https://www.rainbrand.com/api/auth/oauth2/authorize`
    - Token URL: `https://www.rainbrand.com/api/auth/oauth2/token`

Save a file in the brand's asset collection. Identical file contents return the existing item. Images are up to 10 MiB; video and audio (beta) up to 100 MiB.

## Path parameters

- `id` string, uuid, required: Brand ID

## Request body

- object
  - `source` union, required: Where the file comes from.
    - object
      - `type` 'upload', required
      - `uploadId` string, uuid, required: Completed temporary upload from `POST /uploads`.
    - object
      - `type` 'media', required
      - `mediaId` string, uuid, required: Image, video, or audio ID, such as a generation output. Media from another brand is copied into this one.
    - object
      - `type` 'url', required
      - `url` string, uri, required: Public HTTPS URL of the file. Rainbrand stores a copy.

## Response `200`

OK

- object
  - `data` object, required
    - `id` string, uuid, required: Media ID.
    - `type` string, required: Media family: image, video, or audio. More values may be added.
    - `source` string, required: How the file entered Rainbrand: uploaded, scraped (collected from a brand source), or generated. More values may be added.
    - `brandSessionId` string, uuid, required: Brand that owns the file.
    - `workspaceId` string, nullable, required: Workspace that owns the brand. Null for a personal workspace.
    - `mimeType` string, required: The file's MIME type.
    - `url` string, uri, required: Stable link to the file. Stops working when the file is deleted.
    - `fileSize` integer, required: Size in bytes.
    - `durationMs` integer, nullable, required: Duration in milliseconds, when known.
    - `width` integer, nullable, required: Width in pixels, when known.
    - `height` integer, nullable, required: Height in pixels, when known.
    - `description` string, nullable, required: Description of the file's contents, when Rainbrand has one.
    - `inLibrary` boolean, required: Whether the file is in its brand's Library.
    - `addedToLibraryAt` string, date-time, nullable, required: When the file was added to the Library, or null.
    - `generationId` string, uuid, nullable, required: Generation that produced the file, or null.
    - `createdAt` string, date-time, required: When the file was stored.
    - `existing` boolean, required: True when the brand already held this file; no new copy was stored.

## Other responses

- `400`: 400
- `401`: 401
- `403`: 403
- `404`: 404
- `429`: 429
- `503`: 503

---

[API](https://skmtc.dev/rainbrand/apis/rainbrand-api.md) - [All operations](https://skmtc.dev/rainbrand/apis/rainbrand-api/llms.txt) - [OpenAPI document](https://skmtc.dev/rainbrand/apis/rainbrand-api/revisions/012b8e9da4df?raw)
