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

# Sales Affilliate

> Start selling as an API integrated RABOT Sales Affilliate now!

### Prerequisites:

* A contractual relationship must exist between RABOT and your organisation before you will receive credentials to access the API.

### Let's dive in!

<Steps>
  <Step title="Request your API Credentials">
    Contact your Account Manager at RABOT or our [Integration Management Team](mailto:j.ohara@rabot-charge.de) to get your API client details.

    <Warning>
      Make sure to always keep your client credentials safe. Do not include client credentials in client side code (smartphone app, web application), as they could easily be extracted and misused. If you think your credentials have been compromised, contact RABOT to invalidate the credentials and get a new secret.
    </Warning>
  </Step>

  <Step title="Authenticate using the OAuth 2.0 flow">
    See our guide for reference. Ensure you have the correct scopes!

    <Card title="Authentication" icon="key" href="/guides/authentication">
      API authentication & Scopes
    </Card>
  </Step>

  <Step title="Query your available Tariffs">
    As a Sales Affiliate partner using our API, you must first query the tariffs available to your API client in order to generate price quotes and submit orders.

    ```curl theme={null}
     curl --request GET \
          --url https://api.rabot-charge.de/partner/v1/tariffs \
          --header 'Authorization: Bearer <token>'
    ```
  </Step>

  <Step title="Handle the Response">
    Parse the GET response by deserializing the returned collection of tariff objects and mapping the relevant pricing and tariff attributes to your internal quote or order model.

    <Tip>
      Store the `tariffKey` for usage in further API calls, it is a key parameter for generating a quote and submitting an order
    </Tip>
  </Step>

  <Step title="Calculate a price quote">
    Using your `tariffKey`, the lead's postcode and estimated consumption, make a POST call to generate a price quote

    ```curl theme={null}
        curl --request POST \
      --url https://api.rabot-charge.de/partner/v1/tariffs/{tariffKey}/calculation \
      --header 'Authorization: Bearer <token>' \
      --header 'Content-Type: application/json' \
      --data '
    {
      "yearlyConsumptionKwh": 123,
      "zipCode": "<string>",
      "hasSmartMeter": true,
      "hasElectricVehicle": true,
      "campaignCode": "null"
    }
    ```
  </Step>

  <Step title="Submit an Order">
    Once your lead has accepted the offer and you've collected, validated and stored all order data required for order submission, you are ready to submit the order via the POST /orders endpoint!

    <Accordion title="cURL Request">
      ```curl theme={null}
      curl --request POST \
      --url https://api.rabot-charge.de/partner/v1/orders \
      --header 'Authorization: Bearer <token>' \
      --header 'Content-Type: application/json' \
      --data '
      {
      "tariffKey": "rabot.smart",
      "offerDate": "2025-12-25",
      "userAccount": {
        "emailAddress": "j.doe@example.tld",
        "phoneNumber": "+491234567890",
        "password": "SomeExamplePassword987.",
        "firstName": "Bart",
        "lastName": "Simpson",
        "businessName": "<string>",
        "gender": "Male",
        "dateOfBirth": "2023-12-25"
      },
      "contract": {
        "externalId": "urn:acme:contract:ffa98ecb-f28c-442d-b52e-7ffdc97ba676",
        "type": "Personal",
        "deliveryAddress": {
          "title": "Dr.",
          "firstName": "Bart",
          "lastName": "Simpson",
          "businessName": null,
          "gender": "Male",
          "extension": null,
          "streetName": "Grüner Weg",
          "houseNumber": "42",
          "city": "Berlin",
          "postCode": "14109",
          "countryCode": "DE"
        },
        "billingAddress": null,
        "bankDetails": {
          "accountHolder": "Thomas Heinrich Mustermann",
          "iban": "DE89370400440532013000",
          "bic": "DEUTDEFF",
          "bankName": "Deutsche Bank",
          "hasAcceptedDirectDebit": true
        },
        "contractReason": "NewDeliveryLocation",
        "deliveryDetails": {
          "previousAnnualConsumptionKwh": 2600,
          "meterNumber": "123456789",
          "maLoIdentifier": "99987999749",
          "meLoIdentifier": "DE99911149565001246597500M01ID018",
          "desiredTransitionDate": "2024-05-01",
          "moveInDate": null,
          "previousSelfCancelledDate": "2024-04-22",
          "previousSupplierCode": "9979250000006",
          "capabilities": {
            "hasElectricVehicle": false,
            "hasSmartMeter": true,
            "hasHeatPump": true
          }
        },
        "agreements": {
          "termsAndConditions": true,
          "privacyPolicy": true,
          "revocationPolicy": true
        },
        "transactionDateTime": "2024-04-01 00:00:00"
      },
      "campaignCode": "<string>"
      }
      '
      ```
    </Accordion>
  </Step>

  <Step title="Handle the Response">
    Parse the response by deserializing the returned `customerNumber` and `contractNumber` and persisting these identifiers in your internal order and customer management systems

    <Tip>
      Store the `customerNumber` and `contractNumber` for usage in further API calls, it is a key parameter for calls the customers, contracts, metrics and documents endpoints
    </Tip>
  </Step>

  <Step title="Query the Order Status">
    Your order has been submitted and is now undergoing validation by RABOT's platform. Once validated, the order will enter the change process, where communication between energy market partners takes place to locate and process the energy supply request.

    You can poll our API to track your submitted orders' status.

    ```curl theme={null}
      
    curl --request GET \
      --url https://api.rabot-charge.de/partner/v1/orders \
      --header 'Authorization: Bearer <token>
    ```

    <Tip>
      Use the [Last Updated At Filter](/api-reference/orders/list_orders#parameter-filter-from-updated-at) to query the most recently updated orders.
    </Tip>
  </Step>
</Steps>

### Next Steps

Congratulations! You've made your submitted and queried the status of your first order as an official RABOT Sales Affilliate Partner.

Browse our API endpoints

* [Query Tariffs](/api-reference/tariffs/list_tariffs)
* [Calculate Price Quote](/api-reference/tariffs/calculate_price)
* [Submit Order](/api-reference/orders/create_order)
* [Query Order Status](/api-reference/orders/list_orders)

Check out our comprehensive guides for Sales Affilliate partners to ensure a swift and effortless onboarding experience

* [Build Your Own Funnel](/guides/orders)
* [Change Process Detailed](/guides/order_states)

## Questions or Concerns?

Feel free to speak with our [Integration Management Team](mailto:j.ohara@rabot.energy) or alternatively, ask our built-in AI assistant, Rabotini 🤖 (several languages supported).
