Skip to main content

Quickstart

This quickstart uses the current DalyAPI auth flow:
  1. Exchange workspace + user API keys for a JWT.
  2. Use the JWT in Authorization: Bearer ... for protected routes.
  3. Run an energy model sync (default) or async (?async=true) and track status.

1. Set Your API Base URL

Use your deployed API host. In local development, the default is:

2. Exchange API Keys for a JWT

Call POST /auth/token with your workspace and user API keys.
Example response:

3. Call Protected Endpoints

4. Run an Energy Model (Sync Default)

By default, POST /energymodels runs synchronously. Use ?async=true when you want queued background execution. Current output-shaping controls live in the request body under output:
  • output.timeSeries=true adds plant-level timeSeries data to sync completed responses.
  • output.blockResults=true adds block-level blockTimeSeries data.
  • output.blockIndex filters the returned blockTimeSeries map to one zero-based block but does not reduce execution scope.
  • output.lossBreakdownTimestamps=true implies block-level results and nests timestamped loss detail under blockTimeSeries[<blockIndex>].lossBreakdown.
  • output.fullTimeSeries=true cannot be combined with output.blockResults=true.
Example async call:
Example response:
If you need immediate sync time-series output, set the output flags explicitly on the request body and inspect timeSeries and blockTimeSeries in the completed response. blockTimeSeries keys preserve the original zero-based block numbering, including filtered single-block responses. Each returned block result already represents the full configured numberOfInverters count for that block type, not a single inverter.

5. Poll Task Status

When complete, fetch results:
Task lifecycle is pending -> queued -> running -> completed|failed|cancelled.

6. Edit and Rerun a Saved Model In Place

Imported project variants from POST /projects/import and previously created energy models both use the same saved-row workflow:
  1. GET /energymodels/{id}?include=inputs
  2. edit the returned saved input JSON
  3. PUT /energymodels/{id}
  4. POST /energymodels/{id}/run
Example:
The rerun stays on energy model 56; it does not create a second row.

7. Response Contracts

For full sync-complete vs queued 200 envelopes, taskDetails fields, and include-token behavior, see:

Where to Learn Input Contracts

Prefer Python Integration?

See the SDK Overview for a resource-oriented client flow with built-in token handling.