> ## 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 a Brand

> Returns a single brand based on the ID supplied

## Get a Brand

Retrieve detailed information about a specific affiliate brand by its ID. This endpoint provides comprehensive brand data including commission rates, available channels, and brand details.

### HTTP Request

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

### Path Parameters

<ParamField path="id" type="string">
  The unique identifier of the brand to retrieve
</ParamField>

### Example Requests

#### Basic Request

```bash theme={null}
curl -X GET "https://api-beta.lomadee.com.br/affiliate/brands/e36f5bbb-3e5f-42e2-be4c-6c32dac101c2" \
  -H "x-api-key: your-api-key"
```

### Response Format

<ResponseField name="data" type="object">
  Brand object with detailed information
</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
      },
      {
        "id": "channel-2",
        "name": "Secondary Channel",
        "availableChannel": {
          "id": "available-2",
          "name": "Secondary Available Channel"
        },
        "shortUrls": ["https://lomadee.com/short-url-2"],
        "message": null
      }
    ]
  }
}
```

### Error Responses

#### 404 Not Found

```json theme={null}
{
  "message": "Brand not found",
  "error": "NotFound",
  "statusCode": 404
}
```

#### 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 getBrand(brandId) {
  try {
    const response = await axios.get(
      `https://api-beta.lomadee.com.br/affiliate/brands/${brandId}`,
      {
        headers: {
          "x-api-key": "your-api-key",
        },
      }
    );

    console.log("Brand:", response.data.data);
    console.log("Commission:", response.data.data.commission);
    console.log("Channels:", response.data.data.channels);
  } catch (error) {
    console.error("Error:", error.response.data);
  }
}

// Usage
getBrand("e36f5bbb-3e5f-42e2-be4c-6c32dac101c2");
```

#### Python

```python theme={null}
import requests

def get_brand(brand_id):
    url = f'https://api-beta.lomadee.com.br/affiliate/brands/{brand_id}'
    headers = {'x-api-key': 'your-api-key'}

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

    if response.status_code == 200:
        data = response.json()
        brand = data['data']
        print('Brand:', brand['name'])
        print('Commission:', brand['commission'])
        print('Channels:', brand['channels'])
    else:
        print('Error:', response.json())

# Usage
get_brand("e36f5bbb-3e5f-42e2-be4c-6c32dac101c2")
```

#### PHP

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

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    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);
        $brand = $data['data'];
        echo 'Brand: ' . $brand['name'] . "\n";
        echo 'Commission: ' . print_r($brand['commission'], true) . "\n";
        echo 'Channels: ' . print_r($brand['channels'], true) . "\n";
    } else {
        echo 'Error: ' . $response;
    }
}

// Usage
getBrand("e36f5bbb-3e5f-42e2-be4c-6c32dac101c2");
?>
```

### Best Practices

1. **Error Handling**: Always handle 404 errors for invalid brand IDs
2. **Caching**: Cache brand data when appropriate (TTL: 60 seconds)
3. **Commission Calculation**: Use commission data to calculate potential earnings
4. **Channel Validation**: Check channel availability before generating links
5. **Rate Limiting**: Respect the 60 requests per 60 seconds limit

### Common Use Cases

* **Brand Details**: Display detailed information about a specific brand
* **Commission Analysis**: Analyze commission rates for specific brands
* **Channel Management**: Check available channels for a specific brand
* **Link Generation**: Generate affiliate links for a specific brand
* **Performance Tracking**: Monitor performance metrics for individual brands


## OpenAPI

````yaml GET /affiliate/brands/{id}
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/{id}:
    get:
      description: Returns a single brand based on the ID supplied
      parameters:
        - name: id
          in: path
          description: ID of brand to return (organizationId)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Brand response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/AffiliateBrandData'
          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'
        '404':
          description: Brand not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 404
                message: Brand with ID {brandId} not found or not available
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    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
    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
    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

````