{"openapi":"3.1.0","info":{"title":"Idle Atlas Customer API","version":"1.0.0","description":"Customer-facing API contracts generated from the route contract definitions in the app."},"tags":[{"name":"Documentation"},{"name":"Organization"},{"name":"Locations"},{"name":"Members"},{"name":"Invitations"},{"name":"Roles"},{"name":"API Keys"}],"components":{"securitySchemes":{"apiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"},"sessionCookieAuth":{"type":"apiKey","in":"cookie","name":"better-auth.session_token"}}},"paths":{"/api/customer/v1/openapi.json":{"get":{"operationId":"getCustomerApiOpenApiDocument","summary":"Get the customer API OpenAPI document","description":"Returns the generated OpenAPI document for the customer API surface.","tags":["Documentation"],"security":[],"responses":{"200":{"description":"OpenAPI document."}}}},"/api/customer/v1/organization":{"get":{"operationId":"getCustomerApiOrganization","summary":"Get the company linked to the API key","description":"Returns the company linked to the API key. Any valid customer API key can read this resource.","tags":["Organization"],"security":[{"apiKeyAuth":[]}],"responses":{"200":{"description":"Organization context.","content":{"application/json":{"schema":{"type":"object","required":["organization"],"additionalProperties":false,"properties":{"organization":{"type":"object","required":["id","name","slug","status"],"additionalProperties":false,"properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"status":{"type":"string"}}}}}}}},"401":{"description":"Invalid or missing API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}},"429":{"description":"Too many customer API requests for the current API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"/api/customer/v1/locations":{"get":{"operationId":"listCustomerApiLocations","summary":"List locations for the current company","description":"Returns the locations for the company linked to the API key. Any valid customer API key can read this resource.","tags":["Locations"],"security":[{"apiKeyAuth":[]}],"responses":{"200":{"description":"Organization locations.","content":{"application/json":{"schema":{"type":"object","required":["locations"],"additionalProperties":false,"properties":{"locations":{"type":"array","items":{"type":"object","required":["id","name","code","status","displayLabel"],"additionalProperties":false,"properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":["string","null"]},"status":{"type":"string"},"displayLabel":{"type":"string"}}}}}}}}},"401":{"description":"Invalid or missing API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}},"429":{"description":"Too many customer API requests for the current API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"/api/customer/v1/members":{"get":{"operationId":"listCustomerApiMembers","summary":"List people for the current company","description":"Returns the people in the company and their role assignments. Any valid customer API key can read this resource.","tags":["Members"],"security":[{"apiKeyAuth":[]}],"responses":{"200":{"description":"Organization members.","content":{"application/json":{"schema":{"type":"object","required":["members"],"additionalProperties":false,"properties":{"members":{"type":"array","items":{"type":"object","required":["membershipId","userId","email","name","status","joinedAt","roles"],"additionalProperties":false,"properties":{"membershipId":{"type":"string"},"userId":{"type":"string"},"email":{"type":"string"},"name":{"type":["string","null"]},"status":{"type":"string"},"joinedAt":{"type":"string","format":"date-time"},"roles":{"type":"array","items":{"type":"object","required":["assignmentId","roleKey","scopeType","scopeId","scopeLabel"],"additionalProperties":false,"properties":{"assignmentId":{"type":"string"},"roleKey":{"type":"string"},"scopeType":{"type":"string"},"scopeId":{"type":["string","null"]},"scopeLabel":{"type":"string"}}}}}}}}}}}},"401":{"description":"Invalid or missing API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}},"429":{"description":"Too many customer API requests for the current API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"/api/customer/v1/invitations":{"get":{"operationId":"listCustomerApiInvitations","summary":"List invitations for the current company","description":"Returns the invitations for the company linked to the API key. Any valid customer API key can read this resource.","tags":["Invitations"],"security":[{"apiKeyAuth":[]}],"responses":{"200":{"description":"Organization invitations.","content":{"application/json":{"schema":{"type":"object","required":["invitations"],"additionalProperties":false,"properties":{"invitations":{"type":"array","items":{"type":"object","required":["id","email","roleKey","scopeType","scopeId","scopeLabel","status","expiresAt","createdAt"],"additionalProperties":false,"properties":{"id":{"type":"string"},"email":{"type":"string"},"roleKey":{"type":"string"},"scopeType":{"type":"string"},"scopeId":{"type":["string","null"]},"scopeLabel":{"type":"string"},"status":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"}}}}}}}}},"401":{"description":"Invalid or missing API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}},"429":{"description":"Too many customer API requests for the current API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"/api/customer/v1/roles":{"get":{"operationId":"listCustomerApiRoles","summary":"List roles for the current company","description":"Returns the role definitions for the company linked to the API key. Any valid customer API key can read this resource.","tags":["Roles"],"security":[{"apiKeyAuth":[]}],"responses":{"200":{"description":"Organization role reference data.","content":{"application/json":{"schema":{"type":"object","required":["roles"],"additionalProperties":false,"properties":{"roles":{"type":"array","items":{"type":"object","required":["key","label","description","scopeType","scopeLabel","isAssignable","isProtected","highlights","permissions"],"additionalProperties":false,"properties":{"key":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"},"scopeType":{"type":"string"},"scopeLabel":{"type":"string"},"isAssignable":{"type":"boolean"},"isProtected":{"type":"boolean"},"highlights":{"type":"array","items":{"type":"string"}},"permissions":{"type":"array","items":{"type":"object","required":["key","group","groupLabel","label"],"additionalProperties":false,"properties":{"key":{"type":"string"},"group":{"type":"string"},"groupLabel":{"type":"string"},"label":{"type":"string"}}}}}}}}}}}},"401":{"description":"Invalid or missing API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}},"429":{"description":"Too many customer API requests for the current API key.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"/api/customer/v1/api-keys":{"get":{"operationId":"listCustomerApiKeys","summary":"List API keys for the active company","description":"Returns the customer API keys for the caller's active company.","tags":["API Keys"],"security":[{"sessionCookieAuth":[]}],"responses":{"200":{"description":"Customer API keys.","content":{"application/json":{"schema":{"type":"object","required":["apiKeys"],"additionalProperties":false,"properties":{"apiKeys":{"type":"array","items":{"type":"object","required":["id","name","start","enabled","createdAt","organizationId"],"additionalProperties":false,"properties":{"id":{"type":"string"},"name":{"type":"string"},"start":{"type":"string"},"prefix":{"type":"string"},"enabled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":["string","null"],"format":"date-time"},"lastRequestAt":{"type":["string","null"],"format":"date-time"},"organizationId":{"type":"string"},"revokedAt":{"type":["string","null"],"format":"date-time"}}}}}}}}},"403":{"description":"Caller lacks permission to manage API keys.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}},"post":{"operationId":"createCustomerApiKey","summary":"Create an API key for the active company","description":"Creates a new customer API key. The secret is returned once in the response and cannot be retrieved again later.","tags":["API Keys"],"security":[{"sessionCookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"additionalProperties":false,"properties":{"name":{"type":"string","description":"Display name for the key."},"expiresInDays":{"type":"integer","description":"Optional expiration in days from 1 to 365."}}}}}},"responses":{"201":{"description":"API key created.","content":{"application/json":{"schema":{"type":"object","required":["apiKey","secret"],"additionalProperties":false,"properties":{"apiKey":{"type":"object","required":["id","name","start","enabled","createdAt","organizationId"],"additionalProperties":false,"properties":{"id":{"type":"string"},"name":{"type":"string"},"start":{"type":"string"},"prefix":{"type":"string"},"enabled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":["string","null"],"format":"date-time"},"lastRequestAt":{"type":["string","null"],"format":"date-time"},"organizationId":{"type":"string"},"revokedAt":{"type":["string","null"],"format":"date-time"}}},"secret":{"type":"string","description":"One-time secret value for the API key."}}}}}},"400":{"description":"Validation failed.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}},"403":{"description":"Caller lacks permission to manage API keys.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"/api/customer/v1/api-keys/{apiKeyId}/revoke":{"post":{"operationId":"revokeCustomerApiKey","summary":"Revoke an API key","description":"Disables a previously issued API key for the active company.","tags":["API Keys"],"security":[{"sessionCookieAuth":[]}],"parameters":[{"name":"apiKeyId","in":"path","required":true,"description":"Identifier of the API key to revoke.","schema":{"type":"string"}}],"responses":{"200":{"description":"API key revoked.","content":{"application/json":{"schema":{"type":"object","required":["message","apiKey"],"additionalProperties":false,"properties":{"message":{"type":"string"},"apiKey":{"type":"object","required":["id","name","start","enabled","createdAt","organizationId"],"additionalProperties":false,"properties":{"id":{"type":"string"},"name":{"type":"string"},"start":{"type":"string"},"prefix":{"type":"string"},"enabled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":["string","null"],"format":"date-time"},"lastRequestAt":{"type":["string","null"],"format":"date-time"},"organizationId":{"type":"string"},"revokedAt":{"type":["string","null"],"format":"date-time"}}}}}}}},"403":{"description":"Caller lacks permission to manage API keys.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}},"404":{"description":"API key not found for the active company.","content":{"application/json":{"schema":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"object","required":["code","message"],"additionalProperties":false,"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}}