Aurinko Python API Docs | dltHub
Build a Aurinko-to-database pipeline in Python using dlt with AI Workbench support for Claude Code, Cursor, and Codex.
Last updated:
Aurinko is a unified mailbox API platform that provides a single REST interface to access and sync email, calendar, contacts, tasks and booking data across multiple providers (Google, Office365, Exchange, IMAP, etc.). The REST API base URL is https://api.aurinko.io/v1 and All API requests require an account access token provided as an HTTP Bearer token..
dlt is an open-source Python library that handles authentication, pagination, and schema evolution automatically. dlthub provides AI context files that enable code assistants to generate production-ready pipelines. Install with uv pip install "dlt[workspace]" and start loading Aurinko data in under 10 minutes.
What data can I load from Aurinko?
Here are some of the endpoints you can load from Aurinko:
| Resource | Endpoint | Method | Data selector | Description |
|---|---|---|---|---|
| calendars | /calendars | GET | records | List calendars available to the account. Response sample includes nextPageToken, length and records array. |
| calendar | /calendars/{calendarId} | GET | Get a single calendar object (top-level object). | |
| calendar_events | /calendars/{calendarId}/events | GET | records | List events in a calendar; response uses records array and supports paging tokens. |
| calendar_sync_updated | /calendars/{calendarId}/sync/updated | GET | records | Delta sync updated records for a calendar; response includes records, nextPageToken and nextDeltaToken. |
| calendars_sync_start | /calendars/{calendarId}/sync | POST | Start/initiate calendar sync (returns tokens/ready flag). Included because part of sync flow. | |
| email_messages | /email/messages | GET | records | List email messages for an account; response samples show length and records array. |
| email_message | /email/messages/{messageId} | GET | Get a single message object (top-level object). | |
| subscriptions | /subscriptions | GET | records | List webhook/push event subscriptions (response returns array under records for list endpoints). |
| freebusy | /calendars/{calendarId}/freebusy | GET | records | Free/busy query returns records array of availability items. |
| available_times | /calendars/{calendarId}/availableTimes | GET | records | Get available time slots for calendar; response contains records array. |
How do I authenticate with the Aurinko API?
Aurinko uses OAuth2 account tokens for account-scoped calls; supply the account access token in the Authorization header as: Authorization: Bearer <access_token>. Developer/app credentials are created in the Aurinko portal to provision OAuth flows and app-level keys.
1. Get your credentials
- Sign in to https://app.aurinko.io/ and create an application (Developer App) in your Aurinko dashboard. 2) In the app settings, record your app clientId/clientSecret and configure allowed returnUrl / redirect URIs. 3) Use the authorization endpoint (GET /v1/auth/authorize or /v1/auth/authorizeUser) to start the OAuth flow (responseType=code) and have users consent. 4) Exchange the authorization code by POST to /v1/auth/token/{code} to receive an account access token. 5) Store the returned access token and supply it as Authorization: Bearer for subsequent API calls. For service integrations see docs for service accounts in the Authentication section.
2. Add them to .dlt/secrets.toml
[sources.aurinko_webhooks_source] token = "your_account_access_token_here"
dlt reads this automatically at runtime — never hardcode tokens in your pipeline script. For production environments, see setting up credentials with dlt for environment variable and vault-based options.
How do I set up and run the pipeline?
Set up a virtual environment and install dlt:
uv venv && source .venv/bin/activate uv pip install "dlt[workspace]"
1. Install the dlt AI Workbench:
dlt ai init --agent <your-agent> # <agent>: claude | cursor | codex
This installs project rules, a secrets management skill, appropriate ignore files, and configures the dlt MCP server for your agent. Learn more →
2. Install the rest-api-pipeline toolkit:
dlt ai toolkit rest-api-pipeline install
This loads the skills and context about dlt the agent uses to build the pipeline iteratively, efficiently, and safely. The agent uses MCP tools to inspect credentials — it never needs to read your secrets.toml directly. Learn more →
3. Start LLM-assisted coding:
Use /find-source to load data from the Aurinko API into DuckDB.
The rest-api-pipeline toolkit takes over from here — it reads relevant API documentation, presents you with options for which endpoints to load, and follows a structured workflow to scaffold, debug, and validate the pipeline step by step.
4. Run the pipeline:
python aurinko_webhooks_pipeline.py
If everything is configured correctly, you'll see output like this:
Pipeline aurinko_webhooks_pipeline load step completed in 0.26 seconds 1 load package(s) were loaded to destination duckdb and into dataset aurinko_webhooks_data The duckdb destination used duckdb:/aurinko_webhooks.duckdb location to store data Load package 1749667187.541553 is LOADED and contains no failed jobs
Inspect your pipeline and data:
dlt pipeline aurinko_webhooks_pipeline show
This opens the Pipeline Dashboard where you can verify pipeline state, load metrics, schema (tables, columns, types), and query the loaded data directly.
Python pipeline example
This example loads calendars and email_messages from the Aurinko API into DuckDB. It mirrors the endpoint and data selector configuration from the table above:
import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def aurinko_webhooks_source(access_token=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://api.aurinko.io/v1", "auth": { "type": "bearer", "token": access_token, }, }, "resources": [ {"name": "calendars", "endpoint": {"path": "calendars", "data_selector": "records"}}, {"name": "email_messages", "endpoint": {"path": "email/messages", "data_selector": "records"}} ], } yield from rest_api_resources(config) def get_data() -> None: pipeline = dlt.pipeline( pipeline_name="aurinko_webhooks_pipeline", destination="duckdb", dataset_name="aurinko_webhooks_data", ) load_info = pipeline.run(aurinko_webhooks_source()) print(load_info)
To add more endpoints, append entries from the resource table to the "resources" list using the same name, path, and data_selector pattern.
How do I query the loaded data?
Once the pipeline runs, dlt creates one table per resource. You can query with Python or SQL.
Python (pandas DataFrame):
import dlt data = dlt.pipeline("aurinko_webhooks_pipeline").dataset() sessions_df = data.calendars.df() print(sessions_df.head())
SQL (DuckDB example):
SELECT * FROM aurinko_webhooks_data.calendars LIMIT 10;
In a marimo or Jupyter notebook:
import dlt data = dlt.pipeline("aurinko_webhooks_pipeline").dataset() data.calendars.df().head()
See how to explore your data in marimo Notebooks and how to query your data in Python with dataset.
What destinations can I load Aurinko data to?
dlt supports loading into any of these destinations — only the destination parameter changes:
| Destination | Example value |
|---|---|
| DuckDB (local, default) | "duckdb" |
| PostgreSQL | "postgres" |
| BigQuery | "bigquery" |
| Snowflake | "snowflake" |
| Redshift | "redshift" |
| Databricks | "databricks" |
| Filesystem (S3, GCS, Azure) | "filesystem" |
Change the destination in dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. See the full destinations list.
Troubleshooting
Authentication failures
If you receive 401/unauthorized responses: verify you provide an account access token in the Authorization header (Authorization: Bearer ). Use the OAuth flow (/auth/authorizeUser or /auth/authorize) to obtain account tokens or exchange authorization code via POST to /auth/token/{code}.
Paging and delta sync quirks
Many list and sync endpoints return paging tokens and delta tokens. List responses include 'records' plus 'nextPageToken' or 'nextDeltaToken' — pass these tokens back on subsequent GETs (pageToken or deltaToken) to continue fetching. For calendar sync start call POST /calendars/{id}/sync and wait for ready=true before requesting /sync/updated.
Rate limits and error format
Aurinko returns standard HTTP status codes. Common error response body example: {"code":"unauthorized","message":"unauthorized","requestId":""}. Handle 401 (missing/invalid token), 403 (forbidden), 429 (rate limited) by retry/backoff; on 5xx implement exponential backoff and retries.
Webhooks validation
Webhook POST notifications include a signing secret header — validate signature using the shared secret from your dashboard. The notification payload for subscriptions contains subscription, resource, accountId, payloads (array). Respond with 200 to acknowledge.
Ensure that the API key is valid to avoid 401 Unauthorized errors. Also, verify endpoint paths and parameters to avoid 404 Not Found errors.
Next steps
Continue your data engineering journey with the other toolkits of the dltHub AI Workbench:
data-exploration— Build custom notebooks, charts, and dashboards for deeper analysis with marimo notebooks.dlthub-runtime— Deploy, schedule, and monitor your pipeline in production.
dlt ai toolkit data-exploration install dlt ai toolkit dlthub-runtime install
Was this page helpful?
Community Hub
Need more dlt context for Aurinko?
Request dlt skills, commands, AGENT.md files, and AI-native context.