> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lomadee.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Get all Brands

> Returns all brands from the system that the user has access to

## Get all Brands

Retrieve a comprehensive list of all affiliate brands available in the Lomadee network. This endpoint provides detailed brand information including logos, commission rates, and available channels.

### HTTP Request

```http theme={null}
GET https://api-beta.lomadee.com.br/affiliate/brands
```

### Query Parameters

<ParamField query="search" type="string">
  Search by brand name (full-text search)
</ParamField>

<ParamField query="page" type="integer" default="1">
  Page number (default: 1)
</ParamField>

<ParamField query="limit" type="integer" default="20">
  Items per page (default: 20, max: 20)
</ParamField>

<ParamField query="categories" type="string">
  Categories separated by comma
</ParamField>

<ParamField query="isExclusive" type="boolean">
  Filter only exclusive brands
</ParamField>

<ParamField query="isFavorite" type="boolean">
  Filter only favorite brands
</ParamField>

<ParamField query="isHighlight" type="boolean">
  Filter only highlighted brands
</ParamField>

<ParamField query="isPublic" type="boolean">
  Filter by public visibility (true = public, false = private)
</ParamField>

<ParamField query="startAt" type="string">
  Start date to filter by creation date (ISO 8601)
</ParamField>

<ParamField query="endAt" type="string">
  End date to filter by creation date (ISO 8601)
</ParamField>

### Example Requests

#### Basic Request

```bash theme={null}
curl -X GET "https://api-beta.lomadee.com.br/affiliate/brands" \
  -H "x-api-key: your-api-key"
```

#### With Pagination

```bash theme={null}
curl -X GET "https://api-beta.lomadee.com.br/affiliate/brands?page=1&limit=20" \
  -H "x-api-key: your-api-key"
```

### Response Format

<ResponseField name="data" type="array">
  Array of brand objects
</ResponseField>

<ResponseField name="pagination" type="object">
  Pagination metadata

  <Expandable title="properties">
    <ResponseField name="total" type="integer">
      Total number of brands
    </ResponseField>

    <ResponseField name="page" type="integer">
      Current page number
    </ResponseField>

    <ResponseField name="limit" type="integer">
      Number of items per page
    </ResponseField>

    <ResponseField name="totalPages" type="integer">
      Total number of pages
    </ResponseField>
  </Expandable>
</ResponseField>

### Brand Object Structure

<ResponseField name="id" type="string">
  The unique identifier of the brand
</ResponseField>

<ResponseField name="logo" type="string">
  The logo URL of the brand
</ResponseField>

<ResponseField name="name" type="string">
  The name of the brand
</ResponseField>

<ResponseField name="slug" type="string">
  The URL-friendly slug of the brand
</ResponseField>

<ResponseField name="site" type="string">
  The website URL of the brand
</ResponseField>

<ResponseField name="segment" type="string">
  Brand segment/category
</ResponseField>

<ResponseField name="network" type="object" nullable>
  Network information for the brand

  <Expandable title="properties">
    <ResponseField name="active" type="boolean">
      Whether the network is active
    </ResponseField>

    <ResponseField name="isPublic" type="boolean">
      Whether the network is public
    </ResponseField>

    <ResponseField name="trait" type="object" nullable>
      Brand traits

      <Expandable title="properties">
        <ResponseField name="isExclusive" type="boolean">
          Whether the brand is exclusive
        </ResponseField>

        <ResponseField name="isHighlight" type="boolean">
          Whether the brand is highlighted
        </ResponseField>

        <ResponseField name="isFavorite" type="boolean">
          Whether the brand is favorite
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="rating" type="object" nullable>
      Brand rating information

      <Expandable title="properties">
        <ResponseField name="approval" type="number">
          Approval rate (0-5)
        </ResponseField>

        <ResponseField name="commission" type="number">
          Commission rate (%)
        </ResponseField>

        <ResponseField name="conversion" type="number">
          Conversion rate (%)
        </ResponseField>

        <ResponseField name="popularity" type="number">
          Popularity index (0-100)
        </ResponseField>

        <ResponseField name="validation" type="number">
          Validation rate (0-5)
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="createdAt" type="string">
  Creation date (ISO 8601)
</ResponseField>

<ResponseField name="commission" type="object">
  Commission information for the brand

  <Expandable title="properties">
    <ResponseField name="value" type="number">
      Commission value calculated for the affiliate (%)
    </ResponseField>

    <ResponseField name="transfer" type="string">
      Commission payment model (e.g., `cpa` - Cost Per Action). Currently, the
      system primarily uses CPA model for all organizations.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="channels" type="array">
  Available affiliate channels for the brand

  <Expandable title="properties">
    <ResponseField name="id" type="string">
      Channel identifier
    </ResponseField>

    <ResponseField name="name" type="string">
      Channel name
    </ResponseField>

    <ResponseField name="availableChannel" type="object">
      Available channel information

      <Expandable title="properties">
        <ResponseField name="id" type="string">
          Available channel identifier
        </ResponseField>

        <ResponseField name="name" type="string">
          Available channel name
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="shortUrls" type="array">
      Shortened URLs for the channel
    </ResponseField>

    <ResponseField name="message" type="string">
      Restriction message if channel has limitations
    </ResponseField>
  </Expandable>
</ResponseField>

### Example Response

```json theme={null}
{
  "data": [
    {
      "id": "e36f5bbb-3e5f-42e2-be4c-6c32dac101c2",
      "logo": "https://example.com/logo.png",
      "name": "Example Brand",
      "slug": "example-brand",
      "site": "https://example.com",
      "segment": "Electronics",
      "network": {
        "active": true,
        "isPublic": true,
        "trait": {
          "isExclusive": false,
          "isHighlight": true,
          "isFavorite": false
        },
        "rating": {
          "approval": 4.5,
          "commission": 4.2,
          "conversion": 3.8,
          "popularity": 85,
          "validation": 4.8
        }
      },
      "createdAt": "2024-01-15T10:30:00Z",
      "commission": {
        "value": 4.2,
        "transfer": "cpa"
      },
      "channels": [
        {
          "id": "channel-1",
          "name": "Main Channel",
          "availableChannel": {
            "id": "available-1",
            "name": "Available Channel"
          },
          "shortUrls": ["https://lomadee.com/short-url-1"],
          "message": null
        }
      ]
    }
  ],
  "pagination": {
    "total": 150,
    "page": 1,
    "limit": 10,
    "totalPages": 15
  }
}
```

### Error Responses

#### 401 Unauthorized

```json theme={null}
{
  "message": "API key is required",
  "error": "Unauthorized",
  "statusCode": 401
}
```

#### 500 Internal Server Error

```json theme={null}
{
  "message": "Internal server error",
  "error": "InternalServerError",
  "statusCode": 500
}
```

### Usage Examples

#### JavaScript/Node.js

```javascript theme={null}
const axios = require("axios");

async function getBrands() {
  try {
    const response = await axios.get(
      "https://api-beta.lomadee.com.br/affiliate/brands",
      {
        headers: {
          "x-api-key": "your-api-key",
        },
        params: {
          page: 1,
          limit: 20,
        },
      }
    );

    console.log("Brands:", response.data.data);
    console.log("Pagination:", response.data.pagination);
  } catch (error) {
    console.error("Error:", error.response.data);
  }
}
```

#### Python

```python theme={null}
import requests

def get_brands():
    url = 'https://api-beta.lomadee.com.br/affiliate/brands'
    headers = {'x-api-key': 'your-api-key'}
    params = {
        'page': 1,
        'limit': 20
    }

    response = requests.get(url, headers=headers, params=params)

    if response.status_code == 200:
        data = response.json()
        print('Brands:', data['data'])
        print('Pagination:', data['pagination'])
    else:
        print('Error:', response.json())
```

#### PHP

```php theme={null}
<?php
$url = 'https://api-beta.lomadee.com.br/affiliate/brands';
$headers = ['x-api-key: your-api-key'];

$params = [
    'page' => 1,
    'limit' => 20
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url . '?' . http_build_query($params));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
    $data = json_decode($response, true);
    echo 'Brands: ' . print_r($data['data'], true);
    echo 'Pagination: ' . print_r($data['pagination'], true);
} else {
    echo 'Error: ' . $response;
}
?>
```

### Best Practices

1. **Pagination**: Always implement pagination for large datasets
2. **Caching**: Cache brand data when appropriate (TTL: 60 seconds)
3. **Commission Tracking**: Use commission information to calculate earnings
4. **Channel Management**: Check channel availability before generating links
5. **Error Handling**: Implement proper error handling for all responses
6. **Rate Limiting**: Respect the 60 requests per 60 seconds limit

### Common Use Cases

* **Brand Directory**: Display available affiliate brands
* **Commission Analysis**: Compare commission rates across brands
* **Channel Management**: Check available channels for each brand
* **Link Generation**: Generate affiliate links for specific brands
* **Performance Tracking**: Monitor brand performance and earnings


## OpenAPI

````yaml GET /affiliate/brands
openapi: 3.1.0
info:
  title: Lomadee Public API
  description: >-
    REST API for affiliate brands, channels, campaigns, orders, products, and
    link shortener. Authenticate with x-api-key. Rate limit: 60 req/60s per key
    and IP.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.lomadee.com.br/
    description: Production — target URL for all integrations
  - url: https://api-beta.lomadee.com.br/
    description: Beta (legacy) — available during transition; will be retired soon
security:
  - x-api-key: []
paths:
  /affiliate/brands:
    get:
      description: Returns all brands from the system that the user has access to
      parameters:
        - name: search
          in: query
          description: Search by brand name (full-text search)
          schema:
            type: string
        - name: page
          in: query
          description: 'Page number (default: 1)'
          schema:
            type: integer
            format: int32
            default: 1
        - name: limit
          in: query
          description: 'Items per page (default: 20, max: 20)'
          schema:
            type: integer
            format: int32
            default: 20
            maximum: 20
        - name: categories
          in: query
          description: Categories separated by comma
          schema:
            type: string
        - name: isExclusive
          in: query
          description: Filter only exclusive brands
          schema:
            type: boolean
        - name: isFavorite
          in: query
          description: Filter only favorite brands
          schema:
            type: boolean
        - name: isHighlight
          in: query
          description: Filter only highlighted brands
          schema:
            type: boolean
        - name: isPublic
          in: query
          description: Filter by public visibility (true = public, false = private)
          schema:
            type: boolean
        - name: startAt
          in: query
          description: Start date to filter by creation date (ISO 8601)
          schema:
            type: string
            format: date-time
        - name: endAt
          in: query
          description: End date to filter by creation date (ISO 8601)
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: Brand response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AffiliateBrand'
          headers:
            X-RateLimit-Limit:
              description: Max requests per window
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Remaining requests in window
              schema:
                type: integer
            X-RateLimit-Reset:
              description: Unix timestamp when window resets
              schema:
                type: integer
        '400':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    AffiliateBrand:
      required: []
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/AffiliateBrandData'
        pagination:
          $ref: '#/components/schemas/Meta'
      description: Brand response structure with data array and pagination
    Error:
      required:
        - message
        - error
        - statusCode
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message
        error:
          type: string
          description: Error type/category
        statusCode:
          type: integer
          format: int32
          description: HTTP status code
    AffiliateBrandData:
      type: object
      properties:
        id:
          type: string
          description: Unique brand/organization ID
        name:
          type: string
          description: Brand name
        logo:
          type: string
          description: Brand logo URL
        slug:
          type: string
          description: Brand slug
        site:
          type: string
          description: Brand website
        segment:
          type: string
          description: Brand segment
        network:
          $ref: '#/components/schemas/Network'
        createdAt:
          type: string
          format: date-time
          description: Creation date (ISO 8601)
        channels:
          $ref: '#/components/schemas/Channels'
        commission:
          type: object
          properties:
            value:
              type: number
              format: float
              description: Commission value calculated for the affiliate (%)
            transfer:
              type: string
              description: >-
                Commission payment model (e.g., 'cpa' - Cost Per Action).
                Currently, the system primarily uses CPA model for all
                organizations. This field is prepared to support other
                commission models in the future (such as CPL - Cost Per Lead,
                CPC - Cost Per Click, etc.).
          description: Commission information for the brand
    Meta:
      type: object
      properties:
        total:
          type: integer
        page:
          type: integer
        limit:
          type: integer
        totalPages:
          type: integer
    Network:
      type: object
      nullable: true
      properties:
        active:
          type: boolean
          description: Whether the network is active
        isPublic:
          type: boolean
          description: Whether the network is public
        trait:
          type: object
          nullable: true
          properties:
            isExclusive:
              type: boolean
              description: Whether the brand is exclusive
            isHighlight:
              type: boolean
              description: Whether the brand is highlighted
            isFavorite:
              type: boolean
              description: Whether the brand is favorite
        rating:
          type: object
          nullable: true
          properties:
            approval:
              type: number
              description: Approval rate (0-5)
            commission:
              type: number
              description: Commission rate (%)
            conversion:
              type: number
              description: Conversion rate (%)
            popularity:
              type: number
              description: Popularity index (0-100)
            validation:
              type: number
              description: Validation rate (0-5)
      description: Network information for the brand
    Channels:
      description: >-
        List of all your channels. Each channel generates a URL with its
        specific parameters. If a channel has any brand restrictions, the link
        will not be generated and the message field will be filled with the
        restriction type.
      type: array
      items:
        type: object
        properties:
          id:
            type: string
            description: Channel identifier
          name:
            type: string
            description: Channel name
          availableChannel:
            type: object
            properties:
              id:
                type: string
                description: Available channel identifier
              name:
                type: string
                description: Available channel name
          shortUrls:
            type: array
            items:
              type: string
              description: Shortened URLs for the channel
          message:
            type: string
            description: >-
              If the channel has any brand restrictions, the link will not be
              generated and this field will contain the restriction type.
              Possible values: 

               `This channel is not allowed by the organization.` 
               
               `Organization approval is required to generate links.`
  responses:
    Unauthorized:
      description: API key missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              message:
                type: string
              code:
                type: string
    Forbidden:
      description: Valid key without required scope
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              message:
                type: string
              code:
                type: string
    TooManyRequests:
      description: Rate limit exceeded (60 req/60s per key + IP)
      headers:
        X-RateLimit-Limit:
          description: Max requests per window
          schema:
            type: integer
        X-RateLimit-Remaining:
          description: Remaining requests in window
          schema:
            type: integer
        X-RateLimit-Reset:
          description: Unix timestamp when window resets
          schema:
            type: integer
        Retry-After:
          description: Seconds until retry
          schema:
            type: integer
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              message:
                type: string
              code:
                type: string
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key

````