Linkit

Brands

Managing product brands and their catalog associations

Brands

Brands group products by manufacturer or label. Each brand has a unique code and bilingual names. Products reference brands by ID.


The Brand Object

{
  "id": "brand_abc123",
  "brand_code": "GSK",
  "organization_id": "org_abc123",
  "name_en": "GlaxoSmithKline",
  "name_ar": "جلاكسو سميث كلاين",
  "product_count": 250,
  "created": "2024-01-15T10:30:00Z",
  "updated": "2024-01-16T14:22:00Z"
}

Fields

FieldTypeDescription
idstringInternal Linkit ID
brand_codestringYour unique identifier
name_enstringBrand name in English
name_arstringBrand name in Arabic
product_countintegerNumber of products with this brand

List Brands

GET /api/v1/brands

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number
limitinteger20Items per page (max 100)
searchstring-Search in brand names
has_productsboolean-Filter brands with/without products

Example Request

curl -X GET "https://linkit.works/api/v1/brands?search=glaxo&limit=25" \
  -H "Authorization: Bearer your_token_here"
const response = await fetch(
  'https://linkit.works/api/v1/brands?search=glaxo&limit=25',
  { headers: { 'Authorization': 'Bearer your_token_here' } }
);
const brands = await response.json();
import requests

response = requests.get(
    'https://linkit.works/api/v1/brands',
    params={'search': 'glaxo', 'limit': 25},
    headers={'Authorization': 'Bearer your_token_here'}
)
brands = response.json()

Get Single Brand

GET /api/v1/brands/code/{brandCode}

Returns the full brand object.


Create Brand

POST /api/v1/brands

Request Body

{
  "brand_code": "PFIZER",
  "name_en": "Pfizer",
  "name_ar": "فايزر"
}

Required Fields

FieldTypeConstraints
brand_codestringMax 50 chars, unique per organization

Optional Fields

FieldTypeConstraints
name_enstringMax 255 chars
name_arstringMax 255 chars

Response (201 Created)

{
  "success": true,
  "message": "Brand created successfully",
  "data": { "id": "brand_new123", "brand_code": "PFIZER" },
  "timestamp": "2024-01-15T10:30:00Z"
}

Update Brand

PUT /api/v1/brands/code/{brandCode}

Full replacement. Include all fields you want to keep.


Delete Brand

DELETE /api/v1/brands/code/{brandCode}
ParameterTypeDefaultDescription
forcebooleanfalseDelete even if the brand has associated products

Deletion behavior

By default, brands with associated products cannot be deleted. With force=true, products are unassigned from the brand (not deleted).


Bulk Operations

POST /api/v1/brands/bulk

Request Body

{
  "mode": "upsert",
  "brands": [
    { "brand_code": "GSK", "name_en": "GlaxoSmithKline" },
    { "brand_code": "PFIZER", "name_en": "Pfizer" }
  ]
}

Modes: create, update, upsert.


Error Responses

409 Conflict (Duplicate Code)

{
  "code": 409,
  "error": "Brand with this code already exists",
  "details": { "brand_code": "GSK" }
}

409 Conflict (Has Products)

{
  "code": 409,
  "error": "Brand has associated products",
  "details": { "product_count": 250, "hint": "Use force=true to delete anyway" }
}