Authentication
YnoAds uses three public authentication methods. Send JSON as Content-Type: application/json.
1. Dashboard session
Most /v1/* routes require a logged-in dashboard user.
- Register:
POST /v1/auth/register - Login:
POST /v1/auth/login(sets a session cookie) - Or use Better Auth handlers under
/api/auth/*
From browsers, send the cookie with credentials: 'include'. From scripts, persist the Set-Cookie value from login.
Organization scope
Users can belong to more than one organization. For analytics and other org-scoped reads, send:
| Mechanism | Name |
|---|---|
| Header (preferred) | X-Organization-Id: <uuid> |
| Query fallback | ?organizationId=<uuid> |
| Default | The user’s primary organization |
Nested routes under /v1/organizations/:orgId/... also require membership in that organization.
2. WordPress plugin
Authorization: Bearer ynwp_<token>
Used only on /v1/integrations/wp/*. Generate the token in the dashboard; it is shown once.
3. Partner API
Authorization: Bearer ynpk_<key>
Used on /v1/partner/*. Keys are scoped (for example inventory:read) and rate-limited. Create and revoke keys under organization settings.
Example: login then list websites
POST /v1/auth/login
Content-Type: application/json
{
"email": "you@example.com",
"password": "your-password"
}
GET /v1/organizations/{orgId}/projects
Cookie: <session>