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

# Quickstart

> Effectuez votre premier appel à l'API Paps en quelques minutes

Ce guide vous montre comment calculer votre premier tarif de livraison avec l'API Paps, puis vous oriente vers la création d'une mission.

<Steps>
  <Step title="Récupérez votre clé API">
    Connectez-vous à votre espace personnel Paps et copiez votre clé API. Elle s'utilise dans l'en-tête `x-api-key` sur chaque requête.

    <Info>
      Pas encore de compte ? Contactez [Paps Support](mailto:souaibou@paps-app.com).
    </Info>
  </Step>

  <Step title="Configurez votre environnement">
    Choisissez l'environnement sandbox ou production. Voir la page [Environnements](/environments) pour l'URL de base à utiliser.

    ```bash theme={null}
    export PAPS_API_KEY="{{PAPS_API_KEY}}"
    export BASE_URL="{{BASE_URL}}"
    ```
  </Step>

  <Step title="Calculez un premier tarif">
    Appelez `POST /marketplace` avec une origine, une destination et le poids du colis.

    <CodeGroup>
      ```bash cURL theme={null}
      curl https://$BASE_URL/marketplace \
        -H "x-api-key: $PAPS_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "origin": "Cité Keur Gorgui, Dakar",
          "destination": "Plateau, Dakar",
          "weight": 2,
          "height": 10,
          "length": 20,
          "width": 15,
          "deliveryType": "STANDARD"
        }'
      ```

      ```javascript JavaScript theme={null}
      const response = await fetch(`https://${process.env.BASE_URL}/marketplace`, {
        method: "POST",
        headers: {
          "x-api-key": process.env.PAPS_API_KEY,
          "Content-Type": "application/json"
        },
        body: JSON.stringify({
          origin: "Cité Keur Gorgui, Dakar",
          destination: "Plateau, Dakar",
          weight: 2,
          height: 10,
          length: 20,
          width: 15,
          deliveryType: "STANDARD"
        })
      });

      const data = await response.json();
      console.log(data);
      ```

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

      response = requests.post(
          f"https://{os.environ['BASE_URL']}/marketplace",
          headers={"x-api-key": os.environ["PAPS_API_KEY"]},
          json={
              "origin": "Cité Keur Gorgui, Dakar",
              "destination": "Plateau, Dakar",
              "weight": 2,
              "height": 10,
              "length": 20,
              "width": 15,
              "deliveryType": "STANDARD"
          }
      )

      print(response.json())
      ```

      ```php PHP theme={null}
      <?php

      $baseUrl = getenv("BASE_URL");
      $apiKey = getenv("PAPS_API_KEY");

      $ch = curl_init("https://{$baseUrl}/marketplace");

      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_HTTPHEADER, [
          "x-api-key: {$apiKey}",
          "Content-Type: application/json"
      ]);
      curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
          "origin" => "Cité Keur Gorgui, Dakar",
          "destination" => "Plateau, Dakar",
          "weight" => 2,
          "height" => 10,
          "length" => 20,
          "width" => 15,
          "deliveryType" => "STANDARD"
      ]));
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

      $response = json_decode(curl_exec($ch), true);
      curl_close($ch);

      print_r($response);
      ```
    </CodeGroup>
  </Step>

  <Step title="Lisez la réponse">
    La réponse suit l'enveloppe standard de l'API. Le tarif estimé se trouve dans `data.price`.

    ```json theme={null}
    {
      "code": 200,
      "message": "Success",
      "error": null,
      "data": {
        "distance": 3435,
        "price": 12000,
        "packageSize": "XL",
        "size": 20
      }
    }
    ```

    Voir [Format des réponses](/api-responses) pour le détail de chaque champ.
  </Step>

  <Step title="Passez à la création d'une mission">
    Une fois le tarif validé, créez une mission avec `POST /tasks` pour déclencher la livraison. Suivez le guide [Créer une mission](/guides/create-task) pour le parcours complet.
  </Step>
</Steps>

<Tip>
  Besoin d'aide ? Contactez [Paps Support](mailto:souaibou@paps-app.com).
</Tip>
