{"openapi":"3.1.0","info":{"title":"Zaps API","version":"1.0.0","description":"REST API for Zaps link management platform. Provides endpoints for authentication, workspace management, custom domains, short links, and API keys.","contact":{"name":"API Support","email":"support@zaps.one"}},"servers":[{"url":"https://api.zaps.one","description":"Production"},{"url":"http://localhost:8787","description":"Local development"}],"tags":[{"name":"auth","description":"Authentication and authorization endpoints"},{"name":"workspaces","description":"Workspace management endpoints"},{"name":"domains","description":"Custom domain management endpoints"},{"name":"managed-domains","description":"Zaps-managed domain add-on endpoints"},{"name":"links","description":"Short link management endpoints"},{"name":"api-keys","description":"API key management endpoints"}],"components":{"schemas":{},"parameters":{},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT access token obtained from login or signup. Include in Authorization header as: Bearer <token>"},"apiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"API key for programmatic access. Format: zaps_sk_... Include in Authorization header as: Bearer <api_key>"},"cookieAuth":{"type":"apiKey","in":"cookie","name":"refresh_token","description":"HttpOnly refresh token cookie used for obtaining new access tokens. Automatically included by browser when credentials: \"include\" is set."}}},"paths":{"/api/v1/health":{"get":{"tags":["health"],"summary":"Health check","description":"Returns service health information including service name, version, environment, and timestamp. This endpoint is public and does not require authentication.","security":[],"responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"service":{"type":"string","description":"Service name"},"version":{"type":"string","description":"Service version"},"environment":{"type":"string","description":"Deployment environment (local, production)"},"timestamp":{"type":"string","format":"date-time","description":"Current server timestamp (ISO 8601)"}},"required":["service","version","environment","timestamp"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3M","data":{"service":"zaps-api","version":"1.0.0","environment":"production","timestamp":"2024-01-15T10:30:00Z"}}}}}}}},"/api/v1/report-abuse":{"post":{"tags":["abuse"],"summary":"Report abusive URL","security":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"reason":{"type":"string","minLength":1,"maxLength":1000},"email":{"type":"string","format":"email"}},"required":["url","reason"]}}}},"responses":{"201":{"description":"Abuse report created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/admin/search":{"get":{"tags":["admin"],"summary":"Admin search across workspaces/domains/links/users","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Search results returned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"401":{"description":"Invalid internal admin token","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Internal admin access not configured","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/admin/blocklist/hosts":{"get":{"tags":["admin"],"summary":"List blocked hostnames","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Blocked hostnames returned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"post":{"tags":["admin"],"summary":"Block a hostname","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"hostname":{"type":"string","minLength":1,"maxLength":253},"reason":{"type":"string","maxLength":500},"ttlHours":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":8760}},"required":["hostname"]}}}},"responses":{"201":{"description":"Hostname blocked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/admin/blocklist/hosts/:hostname":{"delete":{"tags":["admin"],"summary":"Unblock a hostname","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Hostname unblocked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/admin/blocklist/links":{"get":{"tags":["admin"],"summary":"List blocked link IDs","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Blocked links returned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"post":{"tags":["admin"],"summary":"Block a link ID","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"linkId":{"type":"string","minLength":1},"reason":{"type":"string","maxLength":500},"ttlHours":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":8760}},"required":["linkId"]}}}},"responses":{"201":{"description":"Link blocked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/admin/blocklist/links/:linkId":{"delete":{"tags":["admin"],"summary":"Unblock a link ID","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Link unblocked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/admin/abuse-reports":{"get":{"tags":["admin"],"summary":"List abuse reports","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Abuse reports returned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/public/page-assets/:assetId":{"get":{"tags":["public"],"summary":"Serve a published page asset","security":[],"responses":{"200":{"description":"Published page asset returned","content":{"application/octet-stream":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Asset not found or not published","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/public/conversions":{"post":{"tags":["public"],"summary":"Record a first-party Brand-Front conversion event","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"pageId":{"type":"string","minLength":1,"maxLength":128},"handle":{"type":"string","minLength":1,"maxLength":128},"blockId":{"type":"string","minLength":1,"maxLength":128},"blockType":{"type":"string","enum":["link"]},"targetUrl":{"type":"string","maxLength":2048,"format":"uri"}},"required":["pageId","handle","blockId","blockType","targetUrl"]}},"text/plain":{"schema":{"type":"object","properties":{"pageId":{"type":"string","minLength":1,"maxLength":128},"handle":{"type":"string","minLength":1,"maxLength":128},"blockId":{"type":"string","minLength":1,"maxLength":128},"blockType":{"type":"string","enum":["link"]},"targetUrl":{"type":"string","maxLength":2048,"format":"uri"}},"required":["pageId","handle","blockId","blockType","targetUrl"]}}}},"responses":{"202":{"description":"Conversion event accepted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/auth/signup":{"post":{"tags":["auth"],"summary":"Create a new user account","description":"Register a new user with email and password. Creates a default workspace and returns an access token. A refresh token is also set as an HttpOnly cookie.","security":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"User email address"},"password":{"type":"string","minLength":8,"description":"User password (minimum 8 characters)"},"name":{"type":"string","description":"Optional user display name"}},"required":["email","password"]},"example":{"email":"user@example.com","password":"SecurePass123!","name":"John Doe"}}}},"responses":{"201":{"description":"User created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"status":{"type":"string"},"emailVerifiedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","email","status","createdAt","updatedAt"],"description":"Created user information"},"accessToken":{"type":"string","description":"JWT access token for authentication (valid for 15 minutes)"},"memberships":{"type":"array","items":{"type":"object","properties":{"workspaceId":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"planTier":{"type":"string","enum":["free","starter","pro","business","enterprise"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","planTier","createdAt","updatedAt"]}},"required":["workspaceId","role","workspace"]},"description":"User workspace memberships (includes default workspace)"}},"required":["user","accessToken","memberships"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2H","data":{"user":{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2H","email":"user@example.com","name":"John Doe","status":"active","emailVerifiedAt":null,"createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T10:30:00Z"},"accessToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIwMUhRWlgzWTRaNUE2QjdDOEQ5RTBGMUcySCIsImVtYWlsIjoidXNlckBleGFtcGxlLmNvbSIsImlhdCI6MTcwNTMxNzAwMCwiZXhwIjoxNzA1MzE3OTAwfQ.signature","memberships":[{"workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","role":"owner","workspace":{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","name":"My Workspace","planTier":"free","createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T10:30:00Z"}}]}}}}},"400":{"description":"Validation error - invalid email format, password too short, or email already in use","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2H","error":{"code":"VALIDATION_ERROR","message":"Request validation failed","fieldErrors":{"email":["Invalid email format"],"password":["Password must be at least 8 characters"]}}}}}},"429":{"description":"Rate limit exceeded - too many signup attempts","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2L","error":{"code":"RATE_LIMITED","message":"Too many requests. Please try again later."}}}}}}}},"/api/v1/auth/login":{"post":{"tags":["auth"],"summary":"Authenticate user and obtain access token","description":"Authenticate with email and password. Returns an access token and sets a refresh token as an HttpOnly cookie. Implements incremental delay on failed login attempts.","security":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"User email address"},"password":{"type":"string","description":"User password"}},"required":["email","password"]},"example":{"email":"user@example.com","password":"SecurePass123!"}}}},"responses":{"200":{"description":"Login successful","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"status":{"type":"string"},"emailVerifiedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","email","status","createdAt","updatedAt"],"description":"Authenticated user information"},"accessToken":{"type":"string","description":"JWT access token for authentication (valid for 15 minutes)"},"memberships":{"type":"array","items":{"type":"object","properties":{"workspaceId":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"planTier":{"type":"string","enum":["free","starter","pro","business","enterprise"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","planTier","createdAt","updatedAt"]}},"required":["workspaceId","role","workspace"]},"description":"User workspace memberships"}},"required":["user","accessToken","memberships"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2J","data":{"user":{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2H","email":"user@example.com","name":"John Doe","status":"active","emailVerifiedAt":"2024-01-15T10:30:00Z","createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T10:30:00Z"},"accessToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIwMUhRWlgzWTRaNUE2QjdDOEQ5RTBGMUcySCIsImVtYWlsIjoidXNlckBleGFtcGxlLmNvbSIsImlhdCI6MTcwNTMxNzAwMCwiZXhwIjoxNzA1MzE3OTAwfQ.signature","memberships":[{"workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","role":"owner","workspace":{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","name":"My Workspace","planTier":"free","createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T10:30:00Z"}}]}}}}},"400":{"description":"Validation error - invalid email format or missing required fields","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2H","error":{"code":"VALIDATION_ERROR","message":"Request validation failed","fieldErrors":{"email":["Invalid email format"],"password":["Password is required"]}}}}}},"401":{"description":"Invalid credentials or user disabled","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2J","error":{"code":"INVALID_CREDENTIALS","message":"Invalid email or password"}}}}},"403":{"description":"Email verification required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2K","error":{"code":"EMAIL_NOT_VERIFIED","message":"Email verification required"}}}}},"429":{"description":"Rate limit exceeded - too many login attempts","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2L","error":{"code":"RATE_LIMITED","message":"Too many requests. Please try again later."}}}}}}}},"/api/v1/auth/refresh":{"post":{"tags":["auth"],"summary":"Refresh access token using refresh token cookie","description":"Exchange a refresh token (from HttpOnly cookie) for a new access token. Implements CSRF protection via Origin header validation. Returns a new access token and sets a new refresh token cookie.","security":[{"cookieAuth":[]}],"responses":{"200":{"description":"Token refresh successful","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"accessToken":{"type":"string","description":"New JWT access token for authentication (valid for 15 minutes)"}},"required":["accessToken"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2K","data":{"accessToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIwMUhRWlgzWTRaNUE2QjdDOEQ5RTBGMUcySCIsImVtYWlsIjoidXNlckBleGFtcGxlLmNvbSIsImlhdCI6MTcwNTMxNzAwMCwiZXhwIjoxNzA1MzE3OTAwfQ.signature"}}}}},"401":{"description":"No refresh token provided or session expired","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2M","error":{"code":"UNAUTHORIZED","message":"Session expired or invalid"}}}}},"403":{"description":"Invalid origin - CSRF protection","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2N","error":{"code":"FORBIDDEN","message":"Invalid origin"}}}}},"429":{"description":"Rate limit exceeded - too many refresh attempts","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2O","error":{"code":"RATE_LIMITED","message":"Too many requests. Please try again later."}}}}}}}},"/api/v1/auth/logout":{"post":{"tags":["auth"],"summary":"Logout and invalidate session","description":"Invalidate the current session and clear the refresh token cookie. Requires authentication via Bearer token or refresh token cookie. This operation is idempotent.","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"responses":{"200":{"description":"Logout successful","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"success":{"type":"boolean","enum":[true],"description":"Logout operation completed successfully"}},"required":["success"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2L","data":{"success":true}}}}},"401":{"description":"No session found or authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2M","error":{"code":"UNAUTHORIZED","message":"No session found"}}}}}}}},"/api/v1/auth/me":{"get":{"tags":["auth"],"summary":"Get current user","description":"Returns the authenticated user's information and workspace memberships.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"User information retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"status":{"type":"string"},"emailVerifiedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","email","status","createdAt","updatedAt"],"description":"Authenticated user information"},"memberships":{"type":"array","items":{"type":"object","properties":{"workspaceId":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"planTier":{"type":"string","enum":["free","starter","pro","business","enterprise"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","planTier","createdAt","updatedAt"]}},"required":["workspaceId","role","workspace"]},"description":"User workspace memberships"}},"required":["user","memberships"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3J","data":{"user":{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2H","email":"user@example.com","name":"John Doe","status":"active","emailVerifiedAt":"2024-01-15T10:30:00Z","createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T10:30:00Z"},"memberships":[{"workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","role":"owner","workspace":{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","name":"My Workspace","planTier":"free","createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T10:30:00Z"}}]}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4I","error":{"code":"UNAUTHORIZED","message":"No user found"}}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4J","error":{"code":"NOT_FOUND","message":"User not found"}}}}}}}},"/api/v1/auth/forgot-password":{"post":{"tags":["auth"],"summary":"Request password reset","description":"Sends a password reset email if the email exists. Always returns success to avoid leaking user existence.","security":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"User email address"}},"required":["email"]},"example":{"email":"user@example.com"}}}},"responses":{"200":{"description":"Password reset request processed (doesn't leak user existence)","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"success":{"type":"boolean","enum":[true],"description":"Request processed successfully"},"message":{"type":"string","description":"Confirmation message"}},"required":["success","message"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3K","data":{"success":true,"message":"If the email exists, a password reset link has been sent"}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4K","error":{"code":"VALIDATION_ERROR","message":"Invalid email format","fieldErrors":{"email":"Invalid email format"}}}}}}}}},"/api/v1/auth/reset-password":{"post":{"tags":["auth"],"summary":"Reset password","description":"Resets user password using a reset token from email.","security":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","description":"Password reset token from email"},"password":{"type":"string","minLength":8,"description":"New password (minimum 8 characters)"}},"required":["token","password"]},"example":{"token":"abc123def456ghi789jkl012","password":"NewSecurePass123!"}}}},"responses":{"200":{"description":"Password reset successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"success":{"type":"boolean","enum":[true],"description":"Password reset completed successfully"},"message":{"type":"string","description":"Confirmation message"}},"required":["success","message"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3L","data":{"success":true,"message":"Password has been reset successfully"}}}}},"400":{"description":"Validation error or invalid token","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4L","error":{"code":"VALIDATION_ERROR","message":"Invalid or expired reset token","fieldErrors":{"token":"Invalid or expired reset token"}}}}}},"403":{"description":"Email not verified","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4M","error":{"code":"EMAIL_NOT_VERIFIED","message":"Email verification required"}}}}}}}},"/api/v1/auth/verify-email/resend":{"post":{"tags":["auth"],"summary":"Resend email verification","description":"Requests a verification email without revealing account existence or verification state.","security":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"Email address to resend verification for"}}},"example":{"email":"user@example.com"}}}},"responses":{"200":{"description":"Verification resend request processed generically","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"success":{"type":"boolean","enum":[true],"description":"Request processed successfully"},"message":{"type":"string","description":"Generic confirmation message"}},"required":["success","message"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4K","data":{"success":true,"message":"If the email needs verification, a new verification email will be sent."}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]}}}}}}},"/api/v1/auth/profile":{"get":{"tags":["auth"],"summary":"Get account profile","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Profile returned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"patch":{"tags":["auth"],"summary":"Update account profile","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"avatarUrl":{"type":"string","nullable":true,"format":"uri"}}}}}},"responses":{"200":{"description":"Profile updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Invalid payload","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/auth/external/exchange":{"post":{"tags":["auth"],"summary":"Exchange a verified external identity for a Zaps session","description":"Provider-swappable login bridge. The API verifies the external provider token, provisions or links the internal Zaps user, returns a Zaps access token, and sets the Zaps refresh cookie.","security":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["auth0"]},"idToken":{"type":"string","minLength":20}},"required":["provider","idToken"]}}}},"responses":{"200":{"description":"External identity exchanged for Zaps session","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Invalid request or provider token","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"401":{"description":"External provider token rejected","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Email verification required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/billing/status":{"get":{"tags":["billing"],"summary":"Get billing status by workspace ID","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Billing status retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Missing workspaceId","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Forbidden for workspace","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Workspace not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/billing/webhook/stripe":{"post":{"tags":["billing"],"summary":"Stripe webhook receiver","security":[],"responses":{"200":{"description":"Webhook accepted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Invalid webhook payload/signature","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Webhook not configured","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"500":{"description":"Stripe API request failed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces":{"get":{"tags":["workspaces"],"summary":"List workspaces","description":"Lists all workspaces where the authenticated user is a member. Supports cursor-based pagination with optional cursor and limit query parameters.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"List of workspaces retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique workspace identifier (ULID)"},"name":{"type":"string","description":"Workspace name"},"planTier":{"type":"string","enum":["free","starter","pro","business","enterprise"],"description":"Current plan tier"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of workspace creation"},"updatedAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of last update"}},"required":["id","name","planTier","createdAt","updatedAt"]},"description":"Array of workspace objects"},"nextCursor":{"type":"string","description":"Cursor for fetching the next page of results (if available)"}},"required":["items"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2N","data":{"items":[{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","name":"My Workspace","planTier":"free","createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T10:30:00Z"},{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2P","name":"Another Workspace","planTier":"pro","createdAt":"2024-01-16T14:20:00Z","updatedAt":"2024-01-16T14:20:00Z"}],"nextCursor":"01HQZX3Y4Z5A6B7C8D9E0F1G2Q"}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","error":{"code":"UNAUTHORIZED","message":"Authentication required"}}}}}}},"post":{"tags":["workspaces"],"summary":"Create a new workspace","description":"Creates a new workspace with the authenticated user as the owner. The user is automatically added as a member with the owner role.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Workspace name (required, 1-100 characters)"}},"required":["name"]},"example":{"name":"My New Workspace"}}}},"responses":{"201":{"description":"Workspace created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"workspace":{"type":"object","properties":{"id":{"type":"string","description":"Unique workspace identifier (ULID)"},"name":{"type":"string","description":"Workspace name"},"planTier":{"type":"string","enum":["free","starter","pro","business","enterprise"],"description":"Current plan tier"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of workspace creation"},"updatedAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of last update"}},"required":["id","name","planTier","createdAt","updatedAt"],"description":"Created workspace information"}},"required":["workspace"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2M","data":{"workspace":{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","name":"My New Workspace","planTier":"free","createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T10:30:00Z"}}}}}},"400":{"description":"Validation error - invalid workspace name","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2H","error":{"code":"VALIDATION_ERROR","message":"Request validation failed","fieldErrors":{"name":["Workspace name is required"]}}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","error":{"code":"UNAUTHORIZED","message":"Authentication required"}}}}}}}},"/api/v1/workspaces/:workspaceId":{"get":{"tags":["workspaces"],"summary":"Get workspace details","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Workspace returned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Workspace not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"patch":{"tags":["workspaces"],"summary":"Update workspace details","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120}}}}}},"responses":{"200":{"description":"Workspace updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Workspace not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/dashboard":{"get":{"tags":["workspaces"],"summary":"Get workspace dashboard summary","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Workspace dashboard summary retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/usage":{"get":{"tags":["workspaces"],"summary":"Get workspace usage metrics","description":"Returns current usage metrics for a workspace including domains, links, members, and analytics retention period. Any workspace member can view usage stats.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Workspace usage metrics retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"usage":{"type":"object","properties":{"domains":{"type":"integer","minimum":0,"description":"Number of domains in the workspace"},"links":{"type":"integer","minimum":0,"description":"Number of links in the workspace"},"members":{"type":"integer","minimum":0,"description":"Number of members in the workspace"},"retentionDays":{"type":"integer","minimum":0,"description":"Analytics retention period in days"}},"required":["domains","links","members","retentionDays"],"description":"Workspace usage metrics"}},"required":["usage"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2O","data":{"usage":{"domains":5,"links":150,"members":3,"retentionDays":30}}}}}},"400":{"description":"Validation error - missing workspaceId","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2H","error":{"code":"VALIDATION_ERROR","message":"Missing workspaceId in route parameters"}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","error":{"code":"UNAUTHORIZED","message":"Authentication required"}}}}},"403":{"description":"Insufficient permissions - user is not a member of this workspace","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2J","error":{"code":"FORBIDDEN","message":"Insufficient permissions to access this resource"}}}}},"404":{"description":"Workspace not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2K","error":{"code":"NOT_FOUND","message":"Workspace not found"}}}}}}}},"/api/v1/workspaces/:workspaceId/analytics/overview":{"get":{"tags":["analytics"],"summary":"Get workspace analytics overview","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Workspace analytics overview retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/analytics/summary":{"get":{"tags":["analytics"],"summary":"Get workspace analytics summary","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Workspace analytics summary retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/analytics/links/:linkId":{"get":{"tags":["analytics"],"summary":"Get analytics for a link in workspace","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Link analytics retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Forbidden link access","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Link not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/analytics/export.csv":{"get":{"tags":["analytics"],"summary":"Export workspace analytics as CSV","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"CSV export completed","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Feature locked or forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Link not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/billing/status":{"get":{"tags":["billing"],"summary":"Get billing status for workspace","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Billing status retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Workspace not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"500":{"description":"Billing provider error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/billing/checkout":{"post":{"tags":["billing"],"summary":"Create billing checkout session","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"planTier":{"type":"string","enum":["free","starter","pro","business","enterprise"]},"successUrl":{"type":"string","format":"uri"},"cancelUrl":{"type":"string","format":"uri"}},"required":["planTier","successUrl","cancelUrl"]}}}},"responses":{"201":{"description":"Checkout session created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Workspace not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"500":{"description":"Billing provider error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/billing/portal":{"post":{"tags":["billing"],"summary":"Create billing portal session","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"returnUrl":{"type":"string","format":"uri"}},"required":["returnUrl"]}}}},"responses":{"200":{"description":"Portal session created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Workspace not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"500":{"description":"Billing provider error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/billing/invoices":{"get":{"tags":["billing"],"summary":"List workspace invoices","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Invoices fetched","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Workspace not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"500":{"description":"Billing provider error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/campaigns":{"get":{"tags":["campaigns"],"summary":"List workspace campaigns","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Campaigns listed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"post":{"tags":["campaigns"],"summary":"Create campaign","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"utm":{"type":"object","properties":{"source":{"type":"string","maxLength":120},"medium":{"type":"string","maxLength":120},"campaign":{"type":"string","maxLength":120},"term":{"type":"string","maxLength":120},"content":{"type":"string","maxLength":120}}}},"required":["name"]}}}},"responses":{"201":{"description":"Campaign created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/campaigns/:campaignId":{"get":{"tags":["campaigns"],"summary":"Get campaign detail","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Campaign fetched","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Campaign not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"patch":{"tags":["campaigns"],"summary":"Update campaign","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"utm":{"type":"object","properties":{"source":{"type":"string","maxLength":120},"medium":{"type":"string","maxLength":120},"campaign":{"type":"string","maxLength":120},"term":{"type":"string","maxLength":120},"content":{"type":"string","maxLength":120}}}}}}}},"responses":{"200":{"description":"Campaign updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Campaign not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"delete":{"tags":["campaigns"],"summary":"Delete campaign","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Campaign deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Campaign not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/campaigns/:campaignId/links/:linkId":{"put":{"tags":["campaigns"],"summary":"Assign link to campaign","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Link assigned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked or forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Campaign or link not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/campaigns/links/:linkId":{"delete":{"tags":["campaigns"],"summary":"Unassign link from campaign","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Link unassigned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"get":{"tags":["campaigns"],"summary":"Get campaign assigned to link","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Campaign assignment fetched","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/campaigns/:campaignId/append-utms":{"post":{"tags":["campaigns"],"summary":"Append campaign UTM params to URL","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"}},"required":["url"]}}}},"responses":{"200":{"description":"UTMs appended","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Campaign not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/webhooks":{"get":{"tags":["webhooks"],"summary":"List workspace webhooks","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Webhooks listed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"post":{"tags":["webhooks"],"summary":"Create webhook endpoint","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120},"minItems":1,"maxItems":30},"secret":{"type":"string","minLength":8,"maxLength":128}},"required":["url","events"]}}}},"responses":{"201":{"description":"Webhook created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/webhooks/:webhookId":{"delete":{"tags":["webhooks"],"summary":"Delete webhook endpoint","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Webhook deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Webhook not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/webhooks/:webhookId/test":{"post":{"tags":["webhooks"],"summary":"Send test webhook delivery","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"string","minLength":1,"maxLength":120}}}}}},"responses":{"200":{"description":"Test delivery attempted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Webhook not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/webhooks/dispatch":{"post":{"tags":["webhooks"],"summary":"Dispatch webhook event to subscribed endpoints","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"string","minLength":1,"maxLength":120},"payload":{"type":"object","additionalProperties":{"nullable":true},"default":{}}},"required":["event"]}}}},"responses":{"200":{"description":"Dispatch completed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/pages":{"get":{"tags":["pages"],"summary":"List workspace pages","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Pages listed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"post":{"tags":["pages"],"summary":"Create page","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"handle":{"type":"string"},"title":{"type":"string","maxLength":120},"bio":{"type":"string","maxLength":160},"domainId":{"type":"string"},"blocks":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["link"]},"version":{"type":"number","enum":[1]},"hidden":{"type":"boolean"},"props":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"url":{"type":"string","format":"uri"},"description":{"type":"string","maxLength":200},"emphasis":{"type":"string","enum":["normal","featured"]}},"required":["label","url"],"additionalProperties":false}},"required":["id","type","version","props"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["text"]},"version":{"type":"number","enum":[1]},"hidden":{"type":"boolean"},"props":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":500},"align":{"type":"string","enum":["left","center"]}},"required":["text"],"additionalProperties":false}},"required":["id","type","version","props"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["image"]},"version":{"type":"number","enum":[1]},"hidden":{"type":"boolean"},"props":{"type":"object","properties":{"assetId":{"type":"string","minLength":1},"src":{"type":"string","format":"uri"},"alt":{"type":"string","minLength":1,"maxLength":180},"href":{"type":"string","format":"uri"}},"required":["alt"],"additionalProperties":false}},"required":["id","type","version","props"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["socials"]},"version":{"type":"number","enum":[1]},"hidden":{"type":"boolean"},"props":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"platform":{"type":"string","minLength":1,"maxLength":40},"url":{"type":"string","format":"uri"}},"required":["platform","url"],"additionalProperties":false},"maxItems":20},"style":{"type":"string","enum":["minimal","filled","pills","filled-pills"]},"width":{"type":"string","enum":["compact","full"]},"alignment":{"type":"string","enum":["left","center","right"]},"position":{"type":"string","enum":["top","bottom"]},"outline":{"type":"boolean"}},"required":["items","style","width","alignment","position","outline"],"additionalProperties":false}},"required":["id","type","version","props"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["video"]},"version":{"type":"number","enum":[1]},"hidden":{"type":"boolean"},"props":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"title":{"type":"string","maxLength":120}},"required":["url"],"additionalProperties":false}},"required":["id","type","version","props"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["embed"]},"version":{"type":"number","enum":[1]},"hidden":{"type":"boolean"},"props":{"type":"object","properties":{"provider":{"type":"string","enum":["youtube","spotify","tiktok","instagram"]},"url":{"type":"string","format":"uri"},"title":{"type":"string","maxLength":120}},"required":["provider","url"],"additionalProperties":false}},"required":["id","type","version","props"],"additionalProperties":false}]}},"design":{"type":"object","properties":{"schemaVersion":{"type":"number","enum":[1]},"themePackId":{"type":"string","enum":["zaps-default","clean-bold","soft-creator","luxury-minimal","editorial-dark","neon-night","playful-coral","mono-grid"]},"templateId":{"type":"string","enum":["classic-stack","creator-card","link-grid","editorial","profile-hero"]},"mode":{"type":"string","enum":["light","dark","system"]},"background":{"type":"object","properties":{"type":{"type":"string","enum":["solid","gradient","image","video","pattern"]},"preset":{"type":"string","minLength":1},"assetId":{"type":"string","minLength":1}},"required":["type"]},"linkBlockStyle":{"type":"string","enum":["solid","outline","soft","glass","minimal"]},"fontPairingId":{"type":"string","enum":["modern","editorial","friendly","bold","mono"]},"overrides":{"type":"object","properties":{"brandColor":{"type":"string"},"background":{"type":"string"},"linkBlockBg":{"type":"string"}}}},"required":["schemaVersion","themePackId","templateId","mode","background","linkBlockStyle","fontPairingId"]},"socialLinks":{"type":"array","items":{"type":"object","properties":{"platform":{"type":"string","minLength":1,"maxLength":40},"url":{"type":"string","format":"uri"}},"required":["platform","url"]},"maxItems":20},"socialLinksPosition":{"type":"string","enum":["top","bottom"]},"socialLinksLayout":{"type":"object","properties":{"display":{"type":"string","enum":["icon-only","icon-label"]},"variant":{"type":"string","enum":["ghost","outline","solid"]},"radius":{"type":"string","enum":["full","sm","lg","square"]}},"required":["display","variant","radius"]},"status":{"type":"string","enum":["draft","published"]}},"required":["handle"]}}}},"responses":{"201":{"description":"Page created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier lock or forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Domain not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"409":{"description":"Handle already taken","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/pages/handles/:handle/availability":{"get":{"tags":["pages"],"summary":"Check page handle availability","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Handle availability returned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Invalid handle","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/pages/:pageId":{"get":{"tags":["pages"],"summary":"Get page by ID","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Page returned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Page not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"patch":{"tags":["pages"],"summary":"Update page","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"handle":{"type":"string"},"title":{"type":"string","maxLength":120},"bio":{"type":"string","maxLength":160},"domainId":{"type":"string"},"blocks":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["link"]},"version":{"type":"number","enum":[1]},"hidden":{"type":"boolean"},"props":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"url":{"type":"string","format":"uri"},"description":{"type":"string","maxLength":200},"emphasis":{"type":"string","enum":["normal","featured"]}},"required":["label","url"],"additionalProperties":false}},"required":["id","type","version","props"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["text"]},"version":{"type":"number","enum":[1]},"hidden":{"type":"boolean"},"props":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":500},"align":{"type":"string","enum":["left","center"]}},"required":["text"],"additionalProperties":false}},"required":["id","type","version","props"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["image"]},"version":{"type":"number","enum":[1]},"hidden":{"type":"boolean"},"props":{"type":"object","properties":{"assetId":{"type":"string","minLength":1},"src":{"type":"string","format":"uri"},"alt":{"type":"string","minLength":1,"maxLength":180},"href":{"type":"string","format":"uri"}},"required":["alt"],"additionalProperties":false}},"required":["id","type","version","props"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["socials"]},"version":{"type":"number","enum":[1]},"hidden":{"type":"boolean"},"props":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"platform":{"type":"string","minLength":1,"maxLength":40},"url":{"type":"string","format":"uri"}},"required":["platform","url"],"additionalProperties":false},"maxItems":20},"style":{"type":"string","enum":["minimal","filled","pills","filled-pills"]},"width":{"type":"string","enum":["compact","full"]},"alignment":{"type":"string","enum":["left","center","right"]},"position":{"type":"string","enum":["top","bottom"]},"outline":{"type":"boolean"}},"required":["items","style","width","alignment","position","outline"],"additionalProperties":false}},"required":["id","type","version","props"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["video"]},"version":{"type":"number","enum":[1]},"hidden":{"type":"boolean"},"props":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"title":{"type":"string","maxLength":120}},"required":["url"],"additionalProperties":false}},"required":["id","type","version","props"],"additionalProperties":false},{"type":"object","properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["embed"]},"version":{"type":"number","enum":[1]},"hidden":{"type":"boolean"},"props":{"type":"object","properties":{"provider":{"type":"string","enum":["youtube","spotify","tiktok","instagram"]},"url":{"type":"string","format":"uri"},"title":{"type":"string","maxLength":120}},"required":["provider","url"],"additionalProperties":false}},"required":["id","type","version","props"],"additionalProperties":false}]}},"design":{"type":"object","properties":{"schemaVersion":{"type":"number","enum":[1]},"themePackId":{"type":"string","enum":["zaps-default","clean-bold","soft-creator","luxury-minimal","editorial-dark","neon-night","playful-coral","mono-grid"]},"templateId":{"type":"string","enum":["classic-stack","creator-card","link-grid","editorial","profile-hero"]},"mode":{"type":"string","enum":["light","dark","system"]},"background":{"type":"object","properties":{"type":{"type":"string","enum":["solid","gradient","image","video","pattern"]},"preset":{"type":"string","minLength":1},"assetId":{"type":"string","minLength":1}},"required":["type"]},"linkBlockStyle":{"type":"string","enum":["solid","outline","soft","glass","minimal"]},"fontPairingId":{"type":"string","enum":["modern","editorial","friendly","bold","mono"]},"overrides":{"type":"object","properties":{"brandColor":{"type":"string"},"background":{"type":"string"},"linkBlockBg":{"type":"string"}}}},"required":["schemaVersion","themePackId","templateId","mode","background","linkBlockStyle","fontPairingId"]},"socialLinks":{"type":"array","items":{"type":"object","properties":{"platform":{"type":"string","minLength":1,"maxLength":40},"url":{"type":"string","format":"uri"}},"required":["platform","url"]},"maxItems":20},"socialLinksPosition":{"type":"string","enum":["top","bottom"]},"socialLinksLayout":{"type":"object","properties":{"display":{"type":"string","enum":["icon-only","icon-label"]},"variant":{"type":"string","enum":["ghost","outline","solid"]},"radius":{"type":"string","enum":["full","sm","lg","square"]}},"required":["display","variant","radius"]},"status":{"type":"string","enum":["draft","published"]}}}}}},"responses":{"200":{"description":"Page updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier lock or forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Page or domain not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"409":{"description":"Handle already taken","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"delete":{"tags":["pages"],"summary":"Delete page","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Page deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Page not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/pages/:pageId/analytics":{"get":{"tags":["pages"],"summary":"Get page analytics","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Page analytics returned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Page not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/pages/:pageId/assets":{"get":{"tags":["pages"],"summary":"List page assets","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Page assets listed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"post":{"tags":["pages"],"summary":"Upload page image asset","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"fileName":{"type":"string","maxLength":180},"mimeType":{"type":"string","enum":["image/jpeg","image/png","image/webp"]},"dataBase64":{"type":"string","minLength":1},"alt":{"type":"string","maxLength":180},"width":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":12000},"height":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":12000}},"required":["mimeType","dataBase64"],"additionalProperties":false}}}},"responses":{"201":{"description":"Page asset created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"503":{"description":"Media pipeline not configured","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/pages/:pageId/assets/:assetId":{"get":{"tags":["pages"],"summary":"Serve an authenticated page asset preview","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Page asset returned","content":{"application/octet-stream":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Page asset not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"503":{"description":"Media pipeline not configured","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/audit-logs":{"get":{"tags":["workspaces"],"summary":"List workspace audit logs","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Audit logs listed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/{workspaceId}/api-keys":{"get":{"tags":["api-keys"],"summary":"List API keys","description":"Lists all API keys for a workspace (without secrets). Requires admin or owner role.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"List of API keys retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique API key identifier (ULID)"},"workspaceId":{"type":"string","description":"Workspace that owns this API key"},"name":{"type":"string","description":"Human-readable name for the API key"},"prefix":{"type":"string","description":"API key prefix (e.g., zaps_sk_prod)"},"lastUsedAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of last use"},"revokedAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of revocation"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of API key creation"}},"required":["id","workspaceId","name","prefix","createdAt"]},"description":"Array of API key objects (secrets not included)"}},"required":["items"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3G","data":{"items":[{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G3E","workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","name":"Production API Key","prefix":"zaps_sk_prod","lastUsedAt":"2024-01-15T10:30:00Z","createdAt":"2024-01-15T10:30:00Z"},{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G3H","workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","name":"Development API Key","prefix":"zaps_sk_dev","createdAt":"2024-01-16T14:20:00Z"}]}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4Z","error":{"code":"VALIDATION_ERROR","message":"Workspace ID is required"}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4A","error":{"code":"UNAUTHORIZED","message":"Authentication required"}}}}},"403":{"description":"Insufficient permissions - admin or owner role required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4B","error":{"code":"FORBIDDEN","message":"Admin or owner role required to list API keys"}}}}}}},"post":{"tags":["api-keys"],"summary":"Create a new API key","description":"Creates a new API key for programmatic access. Returns the full secret once - it will not be retrievable again. Requires admin or owner role.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Human-readable name for the API key"}},"required":["name"]},"example":{"name":"Production API Key"}}}},"responses":{"201":{"description":"API key created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"apiKey":{"type":"object","properties":{"id":{"type":"string","description":"Unique API key identifier (ULID)"},"workspaceId":{"type":"string","description":"Workspace that owns this API key"},"name":{"type":"string","description":"Human-readable name for the API key"},"prefix":{"type":"string","description":"API key prefix (e.g., zaps_sk_prod)"},"lastUsedAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of last use"},"revokedAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of revocation"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of API key creation"}},"required":["id","workspaceId","name","prefix","createdAt"],"description":"Created API key information"},"secret":{"type":"string","description":"Full API key secret (only shown once, store securely)"}},"required":["apiKey","secret"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3F","data":{"apiKey":{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G3E","workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","name":"Production API Key","prefix":"zaps_sk_prod","createdAt":"2024-01-15T10:30:00Z"},"secret":"zaps_sk_prod_abc123def456ghi789jkl012mno345pqr678stu901"}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4C","error":{"code":"VALIDATION_ERROR","message":"Request validation failed"}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4D","error":{"code":"UNAUTHORIZED","message":"Authentication required"}}}}},"403":{"description":"Insufficient permissions or tier restrictions","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4E","error":{"code":"FORBIDDEN","message":"API keys are available on Pro and above plans"}}}}}}}},"/api/v1/workspaces/{workspaceId}/api-keys/:id":{"delete":{"tags":["api-keys"],"summary":"Delete (revoke) an API key","description":"Revokes an API key by setting revoked_at timestamp. Requires admin or owner role.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"API key revoked successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"success":{"type":"boolean","enum":[true],"description":"API key deletion completed successfully"}},"required":["success"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3I","data":{"success":true}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4I","error":{"code":"VALIDATION_ERROR","message":"Workspace ID and API key ID are required"}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4F","error":{"code":"UNAUTHORIZED","message":"Authentication required"}}}}},"403":{"description":"Insufficient permissions - admin or owner role required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4G","error":{"code":"FORBIDDEN","message":"Admin or owner role required to delete API keys"}}}}},"404":{"description":"API key not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G4H","error":{"code":"NOT_FOUND","message":"API key not found"}}}}}}}},"/api/v1/workspaces/:workspaceId/invites":{"get":{"tags":["workspaces"],"summary":"List workspace invites","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Invites listed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Admin or owner required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"post":{"tags":["workspaces"],"summary":"Create workspace invite","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["admin","member","viewer"],"default":"member"}},"required":["email"]}}}},"responses":{"201":{"description":"Invite created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Admin or owner required or tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/invites/accept":{"post":{"tags":["workspaces"],"summary":"Accept workspace invite","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":8}},"required":["token"]}}}},"responses":{"200":{"description":"Invite accepted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Invalid token or expired invite","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Forbidden invite access or tier lock","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"409":{"description":"Invite already accepted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/members":{"get":{"tags":["workspaces"],"summary":"List workspace members","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Members listed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/:workspaceId/members/:userId":{"patch":{"tags":["workspaces"],"summary":"Update workspace member role","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["admin","member","viewer"]}},"required":["role"]}}}},"responses":{"200":{"description":"Member role updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Forbidden role update","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Member not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/{workspaceId}/domains":{"get":{"tags":["domains"],"summary":"List domains","description":"Lists all domains for a workspace. Supports cursor-based pagination with optional cursor and limit query parameters.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"List of domains retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique domain identifier (ULID)"},"workspaceId":{"type":"string","description":"Workspace associated with this domain"},"hostname":{"type":"string","description":"Domain hostname (e.g., example.com or links.example.com)"},"status":{"type":"string","enum":["pending","verified","disabled"],"description":"Current domain status"},"type":{"type":"string","enum":["shortlinks","pages"],"description":"Domain type"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of domain creation"},"updatedAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of last update"}},"required":["id","workspaceId","hostname","status","type","createdAt","updatedAt"]},"description":"Array of domain objects"},"nextCursor":{"type":"string","description":"Cursor for fetching the next page of results (if available)"}},"required":["items"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2T","data":{"items":[{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2R","workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","hostname":"links.example.com","status":"verified","type":"shortlinks","createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T10:30:00Z"},{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2V","workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","hostname":"pages.example.com","status":"pending","type":"pages","createdAt":"2024-01-16T14:20:00Z","updatedAt":"2024-01-16T14:20:00Z"}],"nextCursor":"01HQZX3Y4Z5A6B7C8D9E0F1G2W"}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2X","error":{"code":"VALIDATION_ERROR","message":"Workspace ID is required"}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2Y","error":{"code":"UNAUTHORIZED","message":"Authentication required"}}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2Z","error":{"code":"FORBIDDEN","message":"Insufficient permissions to access this workspace"}}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G30","error":{"code":"RATE_LIMIT_EXCEEDED","message":"Too many requests"}}}}}}},"post":{"tags":["domains"],"summary":"Create domain","description":"Creates a new domain for a workspace with DNS verification challenge. Returns the domain and a TXT record to add to DNS for verification.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"hostname":{"type":"string","pattern":"^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$","description":"Domain hostname (e.g., example.com or links.example.com)"},"type":{"type":"string","enum":["shortlinks","pages"],"description":"Domain type (defaults to shortlinks)"}},"required":["hostname"]},"example":{"hostname":"links.example.com","type":"shortlinks"}}}},"responses":{"201":{"description":"Domain created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"domain":{"type":"object","properties":{"id":{"type":"string","description":"Unique domain identifier (ULID)"},"workspaceId":{"type":"string","description":"Workspace associated with this domain"},"hostname":{"type":"string","description":"Domain hostname (e.g., example.com or links.example.com)"},"status":{"type":"string","enum":["pending","verified","disabled"],"description":"Current domain status"},"type":{"type":"string","enum":["shortlinks","pages"],"description":"Domain type"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of domain creation"},"updatedAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of last update"}},"required":["id","workspaceId","hostname","status","type","createdAt","updatedAt"],"description":"Created domain information"},"verificationChallenge":{"type":"object","properties":{"type":{"type":"string","enum":["dns-txt"],"description":"Challenge type (always dns-txt)"},"name":{"type":"string","description":"DNS record name to create"},"value":{"type":"string","description":"DNS record value to set"}},"required":["type","name","value"],"description":"DNS verification challenge to prove domain control"}},"required":["domain","verificationChallenge"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2S","data":{"domain":{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2R","workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","hostname":"links.example.com","status":"pending","type":"shortlinks","createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T10:30:00Z"},"verificationChallenge":{"type":"dns-txt","name":"_zaps-verify.links.example.com","value":"zaps-verify=abc123def456ghi789jkl012mno345"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G31","error":{"code":"VALIDATION_ERROR","message":"Request validation failed","fieldErrors":{"hostname":"Invalid hostname format"}}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G32","error":{"code":"UNAUTHORIZED","message":"Authentication required"}}}}},"403":{"description":"Insufficient permissions or tier limit reached","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G33","error":{"code":"TIER_LOCKED","message":"Domain limit reached for current plan tier"}}}}},"409":{"description":"Hostname already taken","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G34","error":{"code":"HOSTNAME_TAKEN","message":"This hostname is already registered"}}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G35","error":{"code":"RATE_LIMIT_EXCEEDED","message":"Too many requests"}}}}}}}},"/api/v1/workspaces/{workspaceId}/domains/{domainId}/verify":{"post":{"tags":["domains"],"summary":"Verify domain","description":"Verifies DNS control by checking for the DNS TXT record. Updates domain status to verified if the record is found.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Domain verified successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"domain":{"type":"object","properties":{"id":{"type":"string","description":"Unique domain identifier (ULID)"},"workspaceId":{"type":"string","description":"Workspace associated with this domain"},"hostname":{"type":"string","description":"Domain hostname (e.g., example.com or links.example.com)"},"status":{"type":"string","enum":["pending","verified","disabled"],"description":"Current domain status"},"type":{"type":"string","enum":["shortlinks","pages"],"description":"Domain type"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of domain creation"},"updatedAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of last update"}},"required":["id","workspaceId","hostname","status","type","createdAt","updatedAt"],"description":"Verified domain information"}},"required":["domain"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2U","data":{"domain":{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2R","workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","hostname":"links.example.com","status":"verified","type":"shortlinks","createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T10:30:00Z"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G36","error":{"code":"VALIDATION_ERROR","message":"Domain ID is required"}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G37","error":{"code":"UNAUTHORIZED","message":"Authentication required"}}}}},"403":{"description":"Insufficient permissions or verification failed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G38","error":{"code":"FORBIDDEN","message":"DNS verification failed - TXT record not found"}}}}},"404":{"description":"Domain not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G39","error":{"code":"NOT_FOUND","message":"Domain not found"}}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G40","error":{"code":"RATE_LIMIT_EXCEEDED","message":"Too many requests"}}}}}}}},"/api/v1/workspaces/{workspaceId}/domains/default":{"get":{"tags":["domains"],"summary":"Get default domain for workspace","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Default domain fetched","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/{workspaceId}/domains/:domainId/default":{"post":{"tags":["domains"],"summary":"Set default domain for workspace","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Default domain updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Domain not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/{workspaceId}/domains/:domainId/preferences":{"get":{"tags":["domains"],"summary":"Get domain routing preferences","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Domain preferences fetched","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Domain not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"patch":{"tags":["domains"],"summary":"Update domain routing preferences","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"forceHttps":{"type":"boolean","default":true},"wwwPreference":{"type":"string","enum":["none","www","apex"],"default":"none"}}}}}},"responses":{"200":{"description":"Domain preferences updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Domain not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/{workspaceId}/links":{"get":{"tags":["links"],"summary":"List links","description":"Lists all links for a workspace with optional filters (status, domainId) and cursor-based pagination. Query parameters: cursor, limit, status (active|disabled|deleted), domainId.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"List of links retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique link identifier (ULID)"},"workspaceId":{"type":"string","description":"Workspace that owns this link"},"domainId":{"type":"string","description":"Custom domain ID (if using custom domain)"},"slug":{"type":"string","description":"Short URL slug"},"destination":{"type":"string","format":"uri","description":"Target URL where the link redirects"},"redirectType":{"anyOf":[{"type":"number","enum":[301]},{"type":"number","enum":[302]}],"description":"HTTP redirect type"},"status":{"type":"string","enum":["active","disabled","deleted"],"description":"Current link status"},"expiresAt":{"type":"string","format":"date-time","description":"Optional expiration timestamp"},"linkType":{"type":"string","enum":["short_link","direct_path"],"description":"Link model type"},"handle":{"type":"string","description":"Handle for direct-path links"},"path":{"type":"string","description":"Path segment for direct-path links"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of link creation"},"updatedAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of last update"}},"required":["id","workspaceId","slug","destination","redirectType","status","createdAt","updatedAt"]},"description":"Array of link objects"},"nextCursor":{"type":"string","description":"Cursor for fetching the next page of results (if available)"}},"required":["items"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3A","data":{"items":[{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2X","workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","domainId":"01HQZX3Y4Z5A6B7C8D9E0F1G2R","slug":"summer-sale","destination":"https://example.com/products/summer-sale","redirectType":302,"status":"active","linkType":"short_link","createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T10:30:00Z"},{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G3B","workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","slug":"winter-promo","destination":"https://example.com/products/winter-promo","redirectType":302,"status":"active","linkType":"short_link","createdAt":"2024-01-16T14:20:00Z","updatedAt":"2024-01-16T14:20:00Z"}],"nextCursor":"01HQZX3Y4Z5A6B7C8D9E0F1G3C"}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3N","error":{"code":"UNAUTHORIZED","message":"Authentication required"}}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3O","error":{"code":"FORBIDDEN","message":"Insufficient permissions to access this resource"}}}}}}},"post":{"tags":["links"],"summary":"Create a new short link","description":"Creates a new short link with slug validation and tier enforcement. Validates slug format, target URL protocol, and domain ownership.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[a-zA-Z0-9_-]+$","description":"Short URL slug (alphanumeric, hyphens, underscores). If omitted, one is auto-generated"},"destination":{"type":"string","format":"uri","description":"Target URL where the link redirects"},"domainId":{"type":"string","description":"Custom domain ID (optional, uses default domain if not provided)"},"redirectType":{"anyOf":[{"type":"number","enum":[301]},{"type":"number","enum":[302]}],"description":"HTTP redirect type (defaults to 302)"},"expiresAt":{"type":"string","format":"date-time","description":"Optional expiration timestamp"},"linkType":{"type":"string","enum":["short_link","direct_path"],"description":"Link model type"},"handle":{"type":"string","description":"Handle for direct-path links"},"path":{"type":"string","pattern":"^[a-z0-9-]{1,64}$","description":"Direct-path segment (single slug-safe segment)"}},"required":["destination"]},"example":{"slug":"summer-sale","destination":"https://example.com/products/summer-sale","domainId":"01HQZX3Y4Z5A6B7C8D9E0F1G2R","linkType":"short_link"}}}},"responses":{"201":{"description":"Link created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"link":{"type":"object","properties":{"id":{"type":"string","description":"Unique link identifier (ULID)"},"workspaceId":{"type":"string","description":"Workspace that owns this link"},"domainId":{"type":"string","description":"Custom domain ID (if using custom domain)"},"slug":{"type":"string","description":"Short URL slug"},"destination":{"type":"string","format":"uri","description":"Target URL where the link redirects"},"redirectType":{"anyOf":[{"type":"number","enum":[301]},{"type":"number","enum":[302]}],"description":"HTTP redirect type"},"status":{"type":"string","enum":["active","disabled","deleted"],"description":"Current link status"},"expiresAt":{"type":"string","format":"date-time","description":"Optional expiration timestamp"},"linkType":{"type":"string","enum":["short_link","direct_path"],"description":"Link model type"},"handle":{"type":"string","description":"Handle for direct-path links"},"path":{"type":"string","description":"Path segment for direct-path links"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of link creation"},"updatedAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of last update"}},"required":["id","workspaceId","slug","destination","redirectType","status","createdAt","updatedAt"],"description":"Created link information"}},"required":["link"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2Y","data":{"link":{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2X","workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","domainId":"01HQZX3Y4Z5A6B7C8D9E0F1G2R","slug":"summer-sale","destination":"https://example.com/products/summer-sale","redirectType":302,"status":"active","linkType":"short_link","createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T10:30:00Z"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3P","error":{"code":"VALIDATION_ERROR","message":"Request validation failed","fieldErrors":{"slug":["Invalid slug format"]}}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3Q","error":{"code":"UNAUTHORIZED","message":"Authentication required"}}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3R","error":{"code":"FORBIDDEN","message":"Insufficient permissions to access this resource"}}}}},"409":{"description":"Slug already exists","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3S","error":{"code":"CONFLICT","message":"Slug already exists"}}}}}}}},"/api/v1/workspaces/{workspaceId}/links/{linkId}":{"patch":{"tags":["links"],"summary":"Update a link","description":"Updates an existing link's target URL or status. Requires member role or higher.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"destination":{"type":"string","format":"uri","description":"New target URL"},"status":{"type":"string","enum":["active","disabled"],"description":"New link status"},"redirectType":{"anyOf":[{"type":"number","enum":[301]},{"type":"number","enum":[302]}],"description":"New redirect type"},"expiresAt":{"type":"string","format":"date-time","description":"Optional expiration timestamp"},"linkType":{"type":"string","enum":["short_link","direct_path"],"description":"Link model type"},"handle":{"type":"string","description":"Handle for direct-path links"},"path":{"type":"string","pattern":"^[a-z0-9-]{1,64}$","description":"Direct-path segment (single slug-safe segment)"}}},"example":{"destination":"https://example.com/products/winter-sale","status":"disabled","redirectType":301}}}},"responses":{"200":{"description":"Link updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"link":{"type":"object","properties":{"id":{"type":"string","description":"Unique link identifier (ULID)"},"workspaceId":{"type":"string","description":"Workspace that owns this link"},"domainId":{"type":"string","description":"Custom domain ID (if using custom domain)"},"slug":{"type":"string","description":"Short URL slug"},"destination":{"type":"string","format":"uri","description":"Target URL where the link redirects"},"redirectType":{"anyOf":[{"type":"number","enum":[301]},{"type":"number","enum":[302]}],"description":"HTTP redirect type"},"status":{"type":"string","enum":["active","disabled","deleted"],"description":"Current link status"},"expiresAt":{"type":"string","format":"date-time","description":"Optional expiration timestamp"},"linkType":{"type":"string","enum":["short_link","direct_path"],"description":"Link model type"},"handle":{"type":"string","description":"Handle for direct-path links"},"path":{"type":"string","description":"Path segment for direct-path links"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of link creation"},"updatedAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of last update"}},"required":["id","workspaceId","slug","destination","redirectType","status","createdAt","updatedAt"],"description":"Updated link information"}},"required":["link"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G2Z","data":{"link":{"id":"01HQZX3Y4Z5A6B7C8D9E0F1G2X","workspaceId":"01HQZX3Y4Z5A6B7C8D9E0F1G2I","domainId":"01HQZX3Y4Z5A6B7C8D9E0F1G2R","slug":"summer-sale","destination":"https://example.com/products/winter-sale","redirectType":301,"status":"disabled","linkType":"short_link","createdAt":"2024-01-15T10:30:00Z","updatedAt":"2024-01-15T11:45:00Z"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3T","error":{"code":"VALIDATION_ERROR","message":"Request validation failed"}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3U","error":{"code":"UNAUTHORIZED","message":"Authentication required"}}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3V","error":{"code":"FORBIDDEN","message":"Insufficient permissions to access this resource"}}}}},"404":{"description":"Link not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3W","error":{"code":"NOT_FOUND","message":"Link not found"}}}}}}},"delete":{"tags":["links"],"summary":"Delete a link","description":"Soft deletes a link by setting status to 'deleted'. Requires member role or higher.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Link deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requestId":{"type":"string","description":"Unique request identifier for debugging"},"data":{"type":"object","properties":{"success":{"type":"boolean","enum":[true],"description":"Link deletion completed successfully"}},"required":["success"]}},"required":["ok","requestId","data"]},"example":{"ok":true,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3D","data":{"success":true}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3X","error":{"code":"UNAUTHORIZED","message":"Authentication required"}}}}},"403":{"description":"Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3Y","error":{"code":"FORBIDDEN","message":"Insufficient permissions to access this resource"}}}}},"404":{"description":"Link not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","NOT_FOUND","RATE_LIMITED","INTERNAL"]},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"required":["ok","requestId","error"]},"example":{"ok":false,"requestId":"01HQZX3Y4Z5A6B7C8D9E0F1G3Z","error":{"code":"NOT_FOUND","message":"Link not found"}}}}}}}},"/api/v1/workspaces/{workspaceId}/links/bulk-import":{"post":{"tags":["links"],"summary":"Bulk import links","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"destination":{"type":"string","format":"uri"},"slug":{"type":"string","minLength":1,"maxLength":100},"domainId":{"type":"string"},"redirectType":{"anyOf":[{"type":"number","enum":[301]},{"type":"number","enum":[302]}]},"expiresAt":{"type":"string"}},"required":["destination"]},"minItems":1,"maxItems":500}},"required":["items"]}}}},"responses":{"200":{"description":"Bulk import processed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/{workspaceId}/links/bulk-actions":{"post":{"tags":["links"],"summary":"Bulk actions on links","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["enable","disable","delete","tag_add","tag_remove"]},"linkIds":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":500},"tag":{"type":"string","minLength":1,"maxLength":50}},"required":["action","linkIds"]}}}},"responses":{"200":{"description":"Bulk actions processed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/{workspaceId}/links/:linkId/tags":{"get":{"tags":["links"],"summary":"Get link tags","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Tags returned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Link not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"put":{"tags":["links"],"summary":"Replace link tags","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"maxItems":30}},"required":["tags"]}}}},"responses":{"200":{"description":"Tags updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Link not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/{workspaceId}/links/:linkId/qr":{"get":{"tags":["links"],"summary":"Generate QR metadata for link","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"QR metadata returned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Invalid QR parameters","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked or forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Link not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/{workspaceId}/links/:linkId/qr/download":{"get":{"tags":["links"],"summary":"Download QR for link","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"302":{"description":"Redirect to QR download URL"},"400":{"description":"Invalid QR parameters","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}},"/api/v1/workspaces/{workspaceId}/links/:linkId/rules":{"get":{"tags":["links"],"summary":"Get link targeting rules","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Link rules returned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Link not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"put":{"tags":["links"],"summary":"Set link targeting rules","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"fallbackUrl":{"type":"string","format":"uri"},"deviceRules":{"type":"object","properties":{"mobile":{"type":"string","format":"uri"},"desktop":{"type":"string","format":"uri"},"tablet":{"type":"string","format":"uri"}}},"geoRules":{"type":"object","additionalProperties":{"type":"string","format":"uri"}},"timeWindows":{"type":"array","items":{"type":"object","properties":{"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"},"targetUrl":{"type":"string","format":"uri"}},"required":["start","end","targetUrl"]}},"abWeights":{"type":"array","items":{"type":"object","properties":{"targetUrl":{"type":"string","format":"uri"},"weight":{"type":"number","minimum":0,"exclusiveMinimum":true}},"required":["targetUrl","weight"]}}},"required":["fallbackUrl"]}}}},"responses":{"200":{"description":"Rules updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Tier locked or forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Link not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}},"delete":{"tags":["links"],"summary":"Clear link targeting rules","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Rules cleared","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}},"404":{"description":"Link not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requestId":{"type":"string"},"data":{"nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fieldErrors":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["ok","requestId"]}}}}}}}}}