Skip to Content

Create a brand

Creates a brand. The CSS must parse as a brand theme; a rejected theme answers 422 with located findings under `fields.css`.

POST
/v1/brands

Creates a brand. The CSS must parse as a brand theme; a rejected theme answers 422 with located findings under fields.css. With isDefault, the new brand becomes the default. An organization holds at most 12 brands; creating one more answers 409 with a ConflictError.

Authorization

apiKey
headerx-api-key<token>

Request Body

application/json
  1. body
slug*string
Match^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$
name*string
Length1 <= length <= 120
css?|null
assets?|null
footer?|null
isDefault?boolean|null

Response Body

Success

application/json
  1. response
id*BrandId
Match^brand_[0-9a-hjkmnp-tv-z]{16,24}$
slug*string

The brand's handle, unique in the organization; samva:brand/<slug> names it.

Match^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$
name*string
isDefault*boolean

Whether bare samva:brand and domains without a brand resolve to this brand.

css*string

Brand theme CSS: @theme variables, one dark-mode @theme of colors, and @font-face rules with https WOFF2 sources.

assets*
footer*
digest*string

SHA-256 of the brand's css, assets and footer. A publication built against a different digest predates the brand's current content.

createdAt*string
updatedAt*string
Example Request
import { createClient } from "samva";

const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });

const result = await samva.brands.create({
  "slug": "example",
  "name": "example"
});
Example Response
{
  "id": "string",
  "slug": "string",
  "name": "string",
  "isDefault": true,
  "css": "string",
  "assets": {
    "logoUrl": "string",
    "logoDarkUrl": "string",
    "iconUrl": "string"
  },
  "footer": {
    "companyName": "string",
    "websiteUrl": "string",
    "address": {
      "street1": "string",
      "street2": "string",
      "city": "string",
      "region": "string",
      "postalCode": "string",
      "country": "string"
    },
    "socialLinks": [
      {
        "label": "string",
        "url": "string"
      }
    ]
  },
  "digest": "string",
  "createdAt": "string",
  "updatedAt": "string"
}

Related documentation