API Reference

Integrate OWNLAY with your applications using our REST API.

Base URL

https://api.ownlay.io/v1

Authentication

All API requests require authentication using an API key. Include your API key in the Authorization header:

curl -X GET "https://api.ownlay.io/v1/campaigns" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Endpoints

Authentication

POST /auth/login

Authenticate user and get access token

{
  "email": "user@example.com",
  "password": "your_password"
}
POST /auth/sso/saml

Initiate SAML SSO authentication flow

Connectors

GET /connectors

List all connected integrations

Response:

{
  "success": true,
  "data": [
    {
      "id": "conn_google_ads",
      "name": "Google Ads",
      "type": "google_ads",
      "status": "connected",
      "last_sync": "2024-12-12T14:25:00Z"
    }
  ]
}
POST /connectors/:type/connect

Initiate OAuth flow for a connector

Campaigns

GET /campaigns

List all campaigns with metrics

POST /campaigns

Create a new campaign

{
  "name": "Q4 Holiday Campaign",
  "objective": "conversions",
  "channels": ["google_ads", "meta_ads"],
  "budget": {
    "daily": 500,
    "total": 15000
  }
}
POST /campaigns/:id/launch

Launch a campaign

Events Ingestion

POST /events

Send a single event

{
  "event_type": "page_view",
  "timestamp": "2024-12-12T14:30:00Z",
  "user_id": "user_123",
  "session_id": "sess_456",
  "properties": {
    "page_url": "https://example.com/products",
    "utm_source": "google",
    "utm_campaign": "q4_holiday"
  }
}
POST /events/batch

Send multiple events in a single request (up to 100)

AI Insights

GET /ai/insights

Get AI-generated insights and recommendations

POST /ai/query

Ask natural language questions about your data

{
  "query": "Why did my CPA increase last week?"
}

Rate Limits

  • Starter: 1,000 requests/hour
  • Growth: 10,000 requests/hour
  • Enterprise: Unlimited

Rate limit headers are included in every response:

X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 9985
X-RateLimit-Reset: 1702400000