Skip to main content

Overview

The Brands API allows you to manage brand information for your products. Brands can be associated with products to help organize and categorize your catalog.

Create Brand

Creates a new brand. Brand names must be unique.

Request Body

name
string
required
Brand name (must be unique)

Response

id
integer
Unique brand identifier
name
string
Brand name

Example

curl -X POST "https://api.example.com/brands/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Dell"
  }'

Response Example

{
  "id": 1,
  "name": "Dell"
}

List Brands

Returns all brands, ordered alphabetically by name.

Response

Returns an array of brand objects.
id
integer
Brand identifier
name
string
Brand name

Example

curl -X GET "https://api.example.com/brands/" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response Example

[
  {
    "id": 1,
    "name": "Dell"
  },
  {
    "id": 2,
    "name": "Nike"
  },
  {
    "id": 3,
    "name": "Samsung"
  }
]

Update Brand

Updates an existing brand. The new name must not conflict with existing brands.

Path Parameters

brand_id
integer
required
The brand ID to update

Request Body

name
string
New brand name (must be unique if changing)

Response

Returns the updated brand object.
id
integer
Brand identifier
name
string
Updated brand name

Example

curl -X PUT "https://api.example.com/brands/1" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Dell Technologies"
  }'

Response Example

{
  "id": 1,
  "name": "Dell Technologies"
}

Delete Brand

Deletes a brand. If the brand is associated with products, the operation may fail depending on database constraints.

Path Parameters

brand_id
integer
required
The brand ID to delete

Response

Returns 204 No Content on success.

Example

curl -X DELETE "https://api.example.com/brands/1" \
  -H "Authorization: Bearer YOUR_TOKEN"

Error Handling

409 Conflict

Returned when attempting to create or update a brand with a name that already exists:
{
  "detail": "Ya existe una marca con nombre 'Dell'"
}

404 Not Found

Returned when the specified brand ID doesn’t exist:
{
  "detail": "Marca con ID 999 no encontrada"
}

Build docs developers (and LLMs) love