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

# Créer un catalogue

> Créer un nouveau catalogue dans votre espace de travail

## Autorisation

<ParamField header="Authorization" type="string" required>
  Jeton Bearer pour l'authentification. Format : `Bearer qwoty_your_token`
</ParamField>

## Corps de la requête

<ParamField body="name" type="string" required>
  Nom du catalogue
</ParamField>

<ParamField body="api_name" type="string">
  Identifiant API (généré automatiquement si non fourni)
</ParamField>

<ParamField body="reference" type="string">
  Référence interne
</ParamField>

<ParamField body="description" type="string">
  Description du catalogue
</ParamField>

<ParamField body="is_active" type="boolean" default="true">
  Statut actif
</ParamField>

<ParamField body="id_crm" type="string">
  ID CRM externe
</ParamField>

<ParamField body="id_erp" type="string">
  ID ERP externe
</ParamField>

<ParamField body="id_accounting" type="string">
  ID comptabilité externe
</ParamField>

## Exemples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://qwoty.app/api/catalogs \
    -H "Authorization: Bearer qwoty_your_token" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Premium Products",
      "description": "Catalog for premium tier products",
      "reference": "CAT-002",
      "is_active": true
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://qwoty.app/api/catalogs', {
    method: 'POST',
    headers: {
      Authorization: 'Bearer qwoty_your_token',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      name: 'Premium Products',
      description: 'Catalog for premium tier products',
      reference: 'CAT-002',
      is_active: true,
    }),
  })

  const data = await response.json()
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://qwoty.app/api/catalogs',
      headers={
          'Authorization': 'Bearer qwoty_your_token',
          'Content-Type': 'application/json'
      },
      json={
          'name': 'Premium Products',
          'description': 'Catalog for premium tier products',
          'reference': 'CAT-002',
          'is_active': True
      }
  )

  data = response.json()
  ```
</CodeGroup>

## Réponse

<ResponseField name="success" type="boolean">
  Indique si la requête a été traitée avec succès
</ResponseField>

<ResponseField name="data" type="object">
  L'objet catalogue créé avec tous les champs
</ResponseField>

<ResponseExample>
  ```json Réponse en cas de succès theme={null}
  {
    "success": true,
    "data": {
      "id": "660e8400-e29b-41d4-a716-446655440001",
      "name": "Premium Products",
      "api_name": "premium_products",
      "reference": "CAT-002",
      "description": "Catalog for premium tier products",
      "is_active": true,
      "id_crm": null,
      "id_erp": null,
      "id_accounting": null,
      "created_at": "2024-12-21T10:30:00Z",
      "updated_at": "2024-12-21T10:30:00Z"
    }
  }
  ```
</ResponseExample>

## Réponses d'erreur

<ResponseExample>
  ```json Erreur de validation theme={null}
  {
    "success": false,
    "error": "Validation error",
    "details": {
      "name": "Name is required"
    }
  }
  ```

  ```json Non autorisé theme={null}
  {
    "success": false,
    "error": "Invalid API token"
  }
  ```
</ResponseExample>
