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

# Integration Guide

> Step-by-step API integration for Day-Ahead Trading

# Integration Guide

This guide covers the three-step API integration process. All steps must be completed before the day-ahead market closes (typically 12:00 CET).

***

## Step 1: Upload Price Forecasts

**Timing:** \~09:00

Send your price forecasts to Podero to trigger the optimization calculation.

### Endpoint

**POST** `/api/partners/v2.0/organizations/trading/dayahead/prices`

[View API documentation →](https://developers.podero.com)

### Requirements

* 15-minute intervals (96 intervals per day)
* EUR/MWh pricing
* No gaps in data
* Future dates only

### Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    'https://app.podero.com/api/partners/v2.0/organizations/trading/dayahead/prices' \
    -H 'Authorization: Bearer {auth_token}' \
    -H 'Content-Type: application/json' \
    -d '{
      "date": "2024-02-17",
      "prices": [
        {"timestamp": "2024-02-17T00:00:00Z", "price_eur_mwh": 45.50},
        {"timestamp": "2024-02-17T00:15:00Z", "price_eur_mwh": 43.20}
        // ... 94 more intervals
      ]
    }'
  ```

  ```python Python theme={null}
  response = requests.post(
      'https://app.podero.com/api/partners/v2.0/organizations/trading/dayahead/prices',
      headers={'Authorization': f'Bearer {auth_token}'},
      json={'date': '2024-02-17', 'prices': price_data}
  )

  result = response.json()
  # Wait until result['next_calculation_ready_at'] before Step 2
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "state": "accepted",
  "next_calculation_ready_at": "2024-02-16T10:30:00Z"
}
```

<Tip>
  Wait until `next_calculation_ready_at` before fetching load curves in Step 2.
</Tip>

***

## Step 2: Fetch Load Curves

**Timing:** After `next_calculation_ready_at` (\~10:30)

Fetch the optimized and unoptimized load curves to inform your market bids.

### Endpoints

<CardGroup cols={2}>
  <Card title="Single Price Zone">
    **GET** `/organizations/trading/dayahead/load-curves`

    [API docs →](https://developers.podero.com)
  </Card>

  <Card title="Multiple Price Zones">
    **GET** `/organizations/trading/dayahead/load-curves/by-price-zone`

    [API docs →](https://developers.podero.com)
  </Card>
</CardGroup>

### Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    'https://app.podero.com/api/partners/v2.0/organizations/trading/dayahead/load-curves?date=2024-02-17' \
    -H 'Authorization: Bearer {auth_token}'
  ```

  ```python Python theme={null}
  response = requests.get(
      'https://app.podero.com/api/partners/v2.0/organizations/trading/dayahead/load-curves',
      headers={'Authorization': f'Bearer {auth_token}'},
      params={'date': '2024-02-17'}
  )

  curves = response.json()
  trade_id = curves['trade_id']  # Save for Step 3!
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "trade_id": "550e8400-e29b-41d4-a716-446655440000",
  "date": "2024-02-17",
  "expiration": "2024-02-16T23:59:59Z",
  "curves": {
    "optimized": [
      {"timestamp": "2024-02-17T00:00:00Z", "energy_wh": 125000}
      // ... 95 more intervals
    ],
    "unoptimized": [
      {"timestamp": "2024-02-17T00:00:00Z", "energy_wh": 150000}
      // ... 95 more intervals
    ]
  }
}
```

<Warning>
  Store the `trade_id` - you'll need it for Step 3 confirmation.
</Warning>

***

## Step 3: Confirm Trade

**Timing:** Before 14:30 (if trading intraday) or before 23:30 (if not trading intraday)

Confirm to Podero that you have purchased the optimized volume to activate the optimization.

The confirmation deadline depends on your trading strategy:

* **Trading intraday:** Confirm by **14:30** (30-minute buffer before intraday trading starts at 15:00)
* **Not trading intraday:** Confirm by **23:30** (30-minute buffer before optimization schedule starts at midnight)

### Endpoint

**POST** `/api/partners/v2.0/organizations/trading/dayahead/load-curve-confirmation`

[View API documentation →](https://developers.podero.com)

### Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    'https://app.podero.com/api/partners/v2.0/organizations/trading/dayahead/load-curve-confirmation' \
    -H 'Authorization: Bearer {auth_token}' \
    -H 'Content-Type: application/json' \
    -d '{
      "trade_id": "550e8400-e29b-41d4-a716-446655440000",
      "accepted": true
    }'
  ```

  ```python Python theme={null}
  response = requests.post(
      'https://app.podero.com/api/partners/v2.0/organizations/trading/dayahead/load-curve-confirmation',
      headers={'Authorization': f'Bearer {auth_token}'},
      json={'trade_id': trade_id, 'accepted': True}
  )

  # Optimization will begin at 00:00 on delivery day
  ```
</CodeGroup>

<Tabs>
  <Tab title="Accept (true)">
    Confirm that you purchased the optimized volume. Devices will be steered according to the optimized curve on Day 2.
  </Tab>

  <Tab title="Reject (false)">
    Confirm that you did not purchase the optimized volume. Devices will operate according to baseline behavior.
  </Tab>
</Tabs>

<Warning>
  Confirmation must be submitted before intraday trading starts (15:00) or before optimization begins (midnight). **Recommended deadlines:** 14:30 for intraday traders, 23:30 for non-intraday traders. These buffers allow for contingencies and system processing time.
</Warning>

***

## Common Issues

<AccordionGroup>
  <Accordion title="Price Upload Validation Errors">
    **Issue:** Missing intervals or invalid timestamps

    **Solution:** Ensure exactly 96 intervals with no gaps, aligned to :00, :15, :30, :45
  </Accordion>

  <Accordion title="Load Curve Not Ready">
    **Issue:** Calling Step 2 too early

    **Solution:** Wait until the `next_calculation_ready_at` timestamp from Step 1
  </Accordion>

  <Accordion title="Confirmation Expired">
    **Issue:** Trade confirmation submitted after deadline

    **Solution:** Submit confirmation with sufficient buffer:

    * **Intraday traders:** Complete by 14:30 (before intraday trading at 15:00)
    * **Non-intraday traders:** Complete by 23:30 (before optimization starts at midnight)

    These 30-minute buffers allow for contingencies and system processing time.
  </Accordion>
</AccordionGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Data Reference" icon="table" href="/deep-dives/day-ahead-trading/data-reference">
    View detailed data specifications
  </Card>

  <Card title="Overview" icon="arrow-left" href="/deep-dives/day-ahead-trading/overview">
    Back to overview
  </Card>
</CardGroup>
