> ## 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.

# Mettre à jour un prix

> Mettre à jour une configuration de prix existante

Met à jour un prix existant avec des données partielles (sémantique PATCH). Seuls les champs fournis sont mis à jour. Les champs réservés à la création ne peuvent pas être modifiés.

## Authentification

<ParamField header="Authorization" type="string" required>
  Jeton Bearer pour l'authentification
</ParamField>

## Paramètres de chemin

<ParamField path="id" type="uuid" required>
  L'identifiant unique du prix à mettre à jour
</ParamField>

## Corps de la requête

Tous les champs sont facultatifs. N'incluez que les champs que vous souhaitez mettre à jour.

<ParamField body="pricing_model" type="string">
  Modèle de tarification : `flat`, `volume`, `graduated`, `percent`, `cost_based` ou
  `none`
</ParamField>

<ParamField body="amount" type="number">
  Montant du prix fixe (pour la tarification forfaitaire)
</ParamField>

<ParamField body="volume_tiers" type="array">
  Tableau d'objets de paliers de volume
</ParamField>

<ParamField body="is_volume_grid_displayed" type="boolean">
  Indique si les paliers de volume sont affichés aux clients
</ParamField>

<ParamField body="graduated_tiers" type="array">
  Tableau d'objets de paliers progressifs
</ParamField>

<ParamField body="is_graduated_grid_displayed" type="boolean">
  Indique si les paliers progressifs sont affichés aux clients
</ParamField>

<ParamField body="percent" type="number">
  Valeur en pourcentage de 0 à 100
</ParamField>

<ParamField body="price_percentage_type" type="string">
  Portée : `all`, `product_type` ou `product`
</ParamField>

<ParamField body="cost_multiplier" type="number">
  Multiplicateur pour la tarification basée sur le coût
</ParamField>

<ParamField body="cost" type="number">
  Prix de revient de base
</ParamField>

<ParamField body="floor_price" type="number">
  Prix minimum acceptable
</ParamField>

<ParamField body="is_setup" type="boolean">
  Indique s'il s'agit de frais d'installation
</ParamField>

<ParamField body="is_pay_as_you_go" type="boolean">
  Indique si cette facturation est à l'usage
</ParamField>

<ParamField body="default_tax_id" type="uuid">
  Identifiant de la taxe de vente par défaut
</ParamField>

<ParamField body="billing_frequency_id" type="uuid">
  Identifiant de la fréquence de facturation
</ParamField>

<ParamField body="engagement_type" type="string">
  `forever` ou `fixed_period`
</ParamField>

<ParamField body="period_duration" type="number">
  Nombre de périodes de facturation
</ParamField>

<ParamField body="parent_price_id" type="uuid">
  Identifiant du prix parent pour les grilles tarifaires dynamiques
</ParamField>

<ParamField body="identifiers[crm]" type="string">
  Identifiant CRM externe
</ParamField>

<ParamField body="identifiers[erp]" type="string">
  Identifiant ERP externe
</ParamField>

<ParamField body="identifiers[accounting]" type="string">
  Identifiant comptable externe
</ParamField>

## Champs immuables

Les champs suivants ne peuvent pas être modifiés après la création :

* `product_variant_id`
* `pricebook_id`
* `currency_id`

## Réponse

<ResponseField name="success" type="boolean">
  Indique si la requête a réussi
</ResponseField>

<ResponseField name="data" type="object">
  L'objet prix mis à jour avec tous les champs et les données enrichies
</ResponseField>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "data": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "product_variant_id": "660e8400-e29b-41d4-a716-446655440001",
      "product_variant_name": "Premium Widget",
      "product_id": "770e8400-e29b-41d4-a716-446655440002",
      "pricebook_id": "880e8400-e29b-41d4-a716-446655440003",
      "pricebook_name": "Standard Pricebook",
      "pricebook_type": "fixed",
      "currency_id": "990e8400-e29b-41d4-a716-446655440004",
      "currency_name": "Euro",
      "currency_api_name": "EUR",
      "pricing_model": "flat",
      "amount": 129.99,
      "volume_tiers": null,
      "is_volume_grid_displayed": false,
      "graduated_tiers": null,
      "is_graduated_grid_displayed": false,
      "percent": null,
      "price_percentage_type": null,
      "cost_multiplier": null,
      "cost": 50.0,
      "floor_price": 99.99,
      "is_setup": false,
      "is_pay_as_you_go": false,
      "default_tax_id": "aa0e8400-e29b-41d4-a716-446655440005",
      "default_tax_name": "VAT 20%",
      "default_tax_rate": 20.0,
      "default_tax_amount": null,
      "default_tax_is_percentage": true,
      "billing_frequency_id": null,
      "billing_frequency_period": null,
      "billing_frequency_unit": null,
      "engagement_type": null,
      "period_duration": null,
      "parent_price_id": null,
      "identifiers": {
        "crm": "crm_price_updated",
        "erp": "erp_price_updated",
        "accounting": "acc_price_updated"
      },
      "workspace_id": "cc0e8400-e29b-41d4-a716-446655440007",
      "created_at": "2024-12-21T10:30:00Z",
      "updated_at": "2024-12-21T15:20:00Z"
    }
  }
  ```

  ```json Not Found Error theme={null}
  {
    "success": false,
    "error": "Price not found"
  }
  ```

  ```json Validation Error theme={null}
  {
    "success": false,
    "error": "Validation error",
    "details": ["Field 'amount' must be a positive number"]
  }
  ```
</ResponseExample>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH https://qwoty.app/api/prices/550e8400-e29b-41d4-a716-446655440000 \
    -H "Authorization: Bearer qwoty_your_token" \
    -H "Content-Type: application/json" \
    -d '{
      "amount": 129.99,
      "floor_price": 99.99,
      "identifiers[crm]": "crm_price_updated",
      "identifiers[erp]": "erp_price_updated",
      "identifiers[accounting]": "acc_price_updated"
    }'
  ```

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

  price_id = '550e8400-e29b-41d4-a716-446655440000'

  response = requests.patch(
      f'https://qwoty.app/api/prices/{price_id}',
      headers={
          'Authorization': 'Bearer qwoty_your_token',
          'Content-Type': 'application/json'
      },
      json={
          'amount': 129.99,
          'floor_price': 99.99,
          'identifiers[crm]': 'crm_price_updated',
          'identifiers[erp]': 'erp_price_updated',
          'identifiers[accounting]': 'acc_price_updated'
      }
  )

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