{"openapi":"3.0.0","info":{"title":"BaseOS API Documentation","version":"1.0.0","description":"API documentation for the BaseOS platform. All endpoints require API key authentication via the Authorization header.","contact":{"name":"API Support"}},"servers":[{"url":"http://localhost:3000","description":"API Server"}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API Key authentication. Format: Bearer <api_key>"}},"schemas":{"Error":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"Error message"}},"required":["success","error"]},"Success":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"}},"required":["success"]},"QuoteStatus":{"type":"string","enum":["DRAFT","SENT","ACCEPTED","REJECTED","EXPIRED"]},"QuoteItem":{"type":"object","properties":{"id":{"type":"integer","example":1},"quoteId":{"type":"integer","example":1},"itemId":{"type":"integer","nullable":true,"example":1},"name":{"type":"string","example":"Web Development Service"},"description":{"type":"string","nullable":true,"example":"Custom web development"},"quantity":{"type":"number","example":1},"unitPrice":{"type":"number","example":1000},"discount":{"type":"number","example":0},"tax":{"type":"number","nullable":true,"example":0},"setupFee":{"type":"number","example":0},"subtotal":{"type":"number","example":1000}},"required":["name","quantity","unitPrice"]},"Quote":{"type":"object","properties":{"id":{"type":"integer","example":1},"organizationId":{"type":"integer","example":1},"clientId":{"type":"integer","example":1},"title":{"type":"string","example":"Website Development Quote"},"quoteNumber":{"type":"string","example":"Q-1-2024-0001"},"publicToken":{"type":"string","example":"abc123def456"},"status":{"$ref":"#/components/schemas/QuoteStatus"},"subtotal":{"type":"number","example":1000},"tax":{"type":"number","nullable":true,"example":0},"total":{"type":"number","example":1000},"currencyId":{"type":"integer","example":1},"validUntil":{"type":"string","format":"date-time","example":"2024-12-31T23:59:59Z"},"notes":{"type":"string","nullable":true,"example":"Additional notes"},"contractId":{"type":"integer","nullable":true},"projectId":{"type":"integer","nullable":true},"invoiceId":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"items":{"type":"array","items":{"$ref":"#/components/schemas/QuoteItem"}}},"required":["id","organizationId","clientId","title","quoteNumber","status","subtotal","total","currencyId","validUntil"]},"CreateQuoteItem":{"type":"object","properties":{"itemId":{"type":"integer","nullable":true,"example":1},"name":{"type":"string","example":"Web Development Service"},"description":{"type":"string","nullable":true,"example":"Custom web development"},"quantity":{"type":"number","example":1},"unitPrice":{"type":"number","example":1000},"discount":{"type":"number","example":0},"tax":{"type":"number","nullable":true,"example":0},"setupFee":{"type":"number","example":0}},"required":["name","quantity","unitPrice"]},"CreateQuoteRequest":{"type":"object","properties":{"clientId":{"type":"integer","nullable":true,"example":1,"description":"Existing client target. Required when opportunityId is not provided."},"opportunityId":{"type":"integer","nullable":true,"example":77,"description":"Sales opportunity/deal target. Quotes for leads must be created from an opportunity; leadId is not accepted here."},"title":{"type":"string","example":"Website Development Quote"},"currencyId":{"type":"integer","nullable":true,"example":1,"description":"Currency id. Ignored when opportunityId is provided because the quote inherits the opportunity currency."},"currencyCode":{"type":"string","nullable":true,"example":"USD","description":"Currency code alternative for API clients. Ignored when opportunityId is provided."},"validUntil":{"type":"string","format":"date-time","example":"2024-12-31T23:59:59Z"},"notes":{"type":"string","nullable":true,"example":"Additional notes"},"items":{"type":"array","items":{"$ref":"#/components/schemas/CreateQuoteItem"}}},"required":["title","validUntil","items"]},"UpdateQuoteRequest":{"type":"object","properties":{"title":{"type":"string","example":"Updated Quote Title"},"status":{"$ref":"#/components/schemas/QuoteStatus"},"currencyId":{"type":"integer","example":1},"validUntil":{"type":"string","format":"date-time","example":"2024-12-31T23:59:59Z"},"notes":{"type":"string","nullable":true},"items":{"type":"array","items":{"$ref":"#/components/schemas/CreateQuoteItem"}}}},"QuotesListResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"quotes":{"type":"array","items":{"$ref":"#/components/schemas/Quote"}},"pagination":{"type":"object","properties":{"page":{"type":"integer","example":1},"limit":{"type":"integer","example":10},"total":{"type":"integer","example":100},"totalPages":{"type":"integer","example":10}}}}}}},"QuoteResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"quote":{"$ref":"#/components/schemas/Quote"}}}}},"Client":{"type":"object","properties":{"id":{"type":"integer","example":1},"organizationId":{"type":"integer","example":1},"userId":{"type":"integer","nullable":true,"example":1},"name":{"type":"string","example":"John Doe"},"email":{"type":"string","nullable":true,"example":"john.doe@example.com"},"phone":{"type":"string","nullable":true,"example":"+1234567890"},"avatar":{"type":"string","nullable":true,"example":"https://example.com/avatar.jpg"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"user":{"type":"object","nullable":true,"properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"John Doe"},"email":{"type":"string","example":"john.doe@example.com"},"phone":{"type":"string","nullable":true},"avatar":{"type":"string","nullable":true}}},"organization":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Acme Corp"}}},"projects":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Project Name"},"description":{"type":"string","nullable":true},"status":{"type":"string","example":"ACTIVE"},"startDate":{"type":"string","format":"date-time","nullable":true},"endDate":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}},"tickets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":1},"subject":{"type":"string","example":"Ticket Subject"},"status":{"type":"string","example":"OPEN"},"priority":{"type":"string","example":"MEDIUM"},"departmentId":{"type":"integer","nullable":true},"projectId":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"lastReply":{"type":"string","format":"date-time","nullable":true},"department":{"type":"object","nullable":true,"properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Support"}}},"project":{"type":"object","nullable":true,"properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Project Name"}}}}}},"_count":{"type":"object","properties":{"projects":{"type":"integer","example":5},"tickets":{"type":"integer","example":10}}}},"required":["id","organizationId","name"]},"CreateClientRequest":{"type":"object","properties":{"name":{"type":"string","example":"John Doe"},"email":{"type":"string","nullable":true,"example":"john.doe@example.com"},"phone":{"type":"string","nullable":true,"example":"+1234567890"},"avatar":{"type":"string","nullable":true,"example":"https://example.com/avatar.jpg"},"userId":{"type":"integer","nullable":true,"description":"Platform user to link (portal access). Accepted only for a member of the organization, a user already linked to one of its clients, or the user whose email equals the client's email; any other id answers 404 User not found.","example":1}},"required":["name"]},"UpdateClientRequest":{"type":"object","properties":{"name":{"type":"string","example":"John Doe Updated"},"email":{"type":"string","nullable":true,"example":"john.doe.updated@example.com"},"phone":{"type":"string","nullable":true,"example":"+1234567891"},"avatar":{"type":"string","nullable":true,"example":"https://example.com/avatar-updated.jpg"},"userId":{"type":"integer","nullable":true,"description":"Platform user to link (portal access). Accepted only for a member of the organization, a user already linked to one of its clients, or the user whose email equals the client's email; any other id answers 404 User not found.","example":1}}},"ClientsListResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"clients":{"type":"array","items":{"$ref":"#/components/schemas/Client"}},"pagination":{"type":"object","properties":{"page":{"type":"integer","example":1},"limit":{"type":"integer","example":10},"total":{"type":"integer","example":100},"totalPages":{"type":"integer","example":10}}}}}}},"ClientResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"client":{"$ref":"#/components/schemas/Client"}}}}},"TicketPriority":{"type":"string","enum":["LOW","MEDIUM","HIGH","URGENT"]},"SupportTicketStatus":{"type":"string","enum":["NEW","OPEN","ASSIGNED","IN_PROGRESS","AWAITING_CUSTOMER","ON_HOLD","RESOLVED","CLOSED","REOPENED","CANCELED","MERGED"]},"PublicationContentType":{"type":"string","enum":["TEXT","VIDEO","GALLERY","LINK","CUSTOM","DISCUSSION"]},"TicketMessageContent":{"type":"object","properties":{"id":{"type":"integer","example":1},"messageId":{"type":"integer","example":1},"type":{"$ref":"#/components/schemas/PublicationContentType"},"content":{"type":"string","example":"<p>We found the root cause and applied a fix.</p>"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","messageId","type","content","createdAt","updatedAt"]},"TicketMessage":{"type":"object","properties":{"id":{"type":"integer","example":1},"ticketId":{"type":"integer","example":1},"organizationId":{"type":"integer","nullable":true,"example":1},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"organization":{"type":"object","nullable":true,"properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Acme Inc"}}},"content":{"type":"array","items":{"$ref":"#/components/schemas/TicketMessageContent"}}},"required":["id","ticketId","createdAt","updatedAt"]},"Ticket":{"type":"object","properties":{"id":{"type":"integer","example":1},"number":{"type":"integer","description":"Public ticket number, sequential per organization (shown to customers as #number). Use `id` in API paths.","example":42},"subject":{"type":"string","example":"Integration issue with billing webhook"},"departmentId":{"type":"integer","nullable":true,"example":2},"status":{"$ref":"#/components/schemas/SupportTicketStatus"},"priority":{"$ref":"#/components/schemas/TicketPriority"},"clientId":{"type":"integer","nullable":true,"example":14},"projectId":{"type":"integer","nullable":true,"example":8},"email":{"type":"string","nullable":true,"example":"client@example.com"},"message":{"type":"string","nullable":true,"example":"<p>The webhook is returning 500 for paid invoices.</p>"},"lastReply":{"type":"string","format":"date-time","nullable":true},"organizationId":{"type":"integer","nullable":true,"example":1},"assignedToUserMembershipId":{"type":"integer","nullable":true,"example":17},"last24hNotificationSent":{"type":"string","format":"date-time","nullable":true},"last72hNotificationSent":{"type":"string","format":"date-time","nullable":true},"isPinned":{"type":"boolean","example":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"organization":{"type":"object","nullable":true,"properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Acme Inc"}}},"department":{"type":"object","nullable":true,"properties":{"id":{"type":"integer","example":2},"name":{"type":"string","example":"Support"},"description":{"type":"string","nullable":true,"example":"Technical support and incidents"}}},"client":{"type":"object","nullable":true,"properties":{"id":{"type":"integer","example":14},"name":{"type":"string","example":"Jane Doe"},"email":{"type":"string","nullable":true,"example":"jane@example.com"},"phone":{"type":"string","nullable":true,"example":"+5511999999999"}}},"project":{"type":"object","nullable":true,"properties":{"id":{"type":"integer","example":8},"name":{"type":"string","example":"ERP rollout"},"description":{"type":"string","nullable":true,"example":"Implementation and support project"},"status":{"type":"string","example":"ACTIVE"}}},"assignedToUserMembership":{"type":"object","nullable":true,"properties":{"id":{"type":"integer","example":17},"user":{"type":"object","nullable":true,"properties":{"id":{"type":"integer","example":7},"name":{"type":"string","example":"Support Agent"},"email":{"type":"string","nullable":true,"example":"agent@example.com"},"avatar":{"type":"string","nullable":true,"example":"https://example.com/avatar.png"}}}}},"messages":{"type":"array","items":{"$ref":"#/components/schemas/TicketMessage"}}},"required":["id","subject","status","priority","createdAt","updatedAt"]},"CreateTicketRequest":{"type":"object","properties":{"subject":{"type":"string","example":"Integration issue with billing webhook"},"departmentId":{"type":"integer","nullable":true,"example":2},"priority":{"$ref":"#/components/schemas/TicketPriority"},"clientId":{"type":"integer","nullable":true,"example":14},"projectId":{"type":"integer","nullable":true,"example":8},"email":{"type":"string","nullable":true,"example":"client@example.com"},"message":{"type":"string","example":"<p>The webhook is returning 500 for paid invoices.</p>"}},"required":["subject","message"]},"UpdateTicketRequest":{"type":"object","properties":{"subject":{"type":"string","example":"Updated issue title"},"departmentId":{"type":"integer","nullable":true,"example":2},"priority":{"$ref":"#/components/schemas/TicketPriority"},"status":{"$ref":"#/components/schemas/SupportTicketStatus"},"clientId":{"type":"integer","nullable":true,"example":14},"email":{"type":"string","nullable":true,"example":"client@example.com"},"assignedToUserMembershipId":{"type":"integer","nullable":true,"example":17}}},"AddTicketMessageRequest":{"type":"object","properties":{"content":{"type":"string","example":"<p>We found the root cause and applied a fix.</p>"},"type":{"$ref":"#/components/schemas/PublicationContentType"}},"required":["content"]},"TicketsListResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"tickets":{"type":"array","items":{"$ref":"#/components/schemas/Ticket"}},"pagination":{"type":"object","properties":{"page":{"type":"integer","example":1},"limit":{"type":"integer","example":10},"total":{"type":"integer","example":42},"totalPages":{"type":"integer","example":5}}}}}}},"TicketResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"ticket":{"$ref":"#/components/schemas/Ticket"}}}}},"TicketMessageResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/TicketMessage"}}}}},"DeleteTicketResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"deleted":{"type":"boolean","example":true},"trashed":{"type":"boolean","description":"Deletion is reversible: the ticket is moved to the trash and permanently removed after the retention window.","example":true},"restorableUntil":{"type":"string","format":"date-time","nullable":true}}}}},"ItemType":{"type":"string","enum":["SERVICE","PHYSICAL_PRODUCT","LICENSE_SAAS","SUBSCRIPTION","DIGITAL_CONTENT"]},"UnitOfMeasure":{"type":"string","enum":["HOUR","MONTH","SPRINT","UNIT","TOKEN","LICENSE","USER_SLOT"]},"BillingModel":{"type":"string","enum":["FIXED_PRICE","TIME_AND_MATERIALS","RECURRING"]},"ProvisioningStrategy":{"type":"string","enum":["NONE","GITHUB_ACCESS","SAAS_INSTANCE","LMS_ACCESS","PROJECT_CREATION"]},"RenewalType":{"type":"string","enum":["NONE","EXTEND_EXPIRY","CREATE_NEW_RESET","CREATE_NEW_ROLLOVER"]},"ItemStatus":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"],"description":"Lifecycle. DRAFT is never offered for sale; ARCHIVED is not offered for new sales but stays readable wherever it is already used; only ACTIVE can join a new quote or contract."},"Item":{"type":"object","properties":{"id":{"type":"integer","example":1},"organizationId":{"type":"integer","example":1},"categoryId":{"type":"integer","nullable":true,"example":1},"name":{"type":"string","example":"Web Development Service"},"description":{"type":"string","nullable":true,"example":"Custom web development service"},"type":{"$ref":"#/components/schemas/ItemType"},"unitOfMeasure":{"$ref":"#/components/schemas/UnitOfMeasure"},"billingModel":{"$ref":"#/components/schemas/BillingModel"},"internalCost":{"type":"number","example":50},"basePrice":{"type":"number","example":100},"setupFee":{"type":"number","example":0},"currencyId":{"type":"integer","example":1},"provisioningStrategy":{"$ref":"#/components/schemas/ProvisioningStrategy"},"renewalType":{"$ref":"#/components/schemas/RenewalType"},"metadata":{"type":"object","nullable":true},"status":{"$ref":"#/components/schemas/ItemStatus"},"sku":{"type":"string","nullable":true,"description":"Unique per organization when set.","example":"WEB-DEV-H"},"imageAssetId":{"type":"integer","nullable":true,"description":"DAM asset of the organization used as the item image."},"imageUrl":{"type":"string","nullable":true,"description":"Public URL of the item image, when set."},"isActive":{"type":"boolean","example":true,"description":"Legacy mirror of `status === ACTIVE`, kept for compatibility."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"category":{"type":"object","nullable":true,"properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Services"},"description":{"type":"string","nullable":true}}},"currency":{"type":"object","properties":{"id":{"type":"integer","example":1},"code":{"type":"string","example":"USD"},"name":{"type":"string","example":"US Dollar"},"symbol":{"type":"string","example":"$"}}},"basePrices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":1},"itemId":{"type":"integer","example":1},"currencyId":{"type":"integer","example":1},"price":{"type":"number","example":100},"effectiveDate":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"currency":{"type":"object","properties":{"id":{"type":"integer","example":1},"code":{"type":"string","example":"USD"},"name":{"type":"string","example":"US Dollar"}}}}}}},"required":["id","organizationId","name","type","unitOfMeasure","billingModel","internalCost","basePrice","currencyId","provisioningStrategy","renewalType","status","isActive"]},"CreateItemRequest":{"type":"object","properties":{"name":{"type":"string","example":"Web Development Service"},"description":{"type":"string","nullable":true,"example":"Custom web development service"},"type":{"$ref":"#/components/schemas/ItemType"},"unitOfMeasure":{"$ref":"#/components/schemas/UnitOfMeasure"},"billingModel":{"$ref":"#/components/schemas/BillingModel"},"internalCost":{"type":"number","example":50},"basePrice":{"type":"number","example":100},"setupFee":{"type":"number","example":0},"currencyId":{"type":"integer","example":1},"categoryId":{"type":"integer","nullable":true,"example":1},"provisioningStrategy":{"$ref":"#/components/schemas/ProvisioningStrategy"},"renewalType":{"$ref":"#/components/schemas/RenewalType"},"metadata":{"type":"object","nullable":true},"status":{"$ref":"#/components/schemas/ItemStatus"},"sku":{"type":"string","nullable":true,"description":"Unique per organization when set.","example":"WEB-DEV-H"},"imageAssetId":{"type":"integer","nullable":true,"description":"DAM asset of the organization used as the item image."}},"required":["name","type","unitOfMeasure","billingModel","internalCost","basePrice","currencyId"]},"UpdateItemRequest":{"type":"object","properties":{"name":{"type":"string","example":"Updated Web Development Service"},"description":{"type":"string","nullable":true},"type":{"$ref":"#/components/schemas/ItemType"},"unitOfMeasure":{"$ref":"#/components/schemas/UnitOfMeasure"},"billingModel":{"$ref":"#/components/schemas/BillingModel"},"internalCost":{"type":"number","example":50},"basePrice":{"type":"number","example":120},"setupFee":{"type":"number","example":0},"currencyId":{"type":"integer","example":1},"categoryId":{"type":"integer","nullable":true,"example":1},"provisioningStrategy":{"$ref":"#/components/schemas/ProvisioningStrategy"},"renewalType":{"$ref":"#/components/schemas/RenewalType"},"metadata":{"type":"object","nullable":true},"status":{"$ref":"#/components/schemas/ItemStatus"},"sku":{"type":"string","nullable":true,"description":"Unique per organization when set.","example":"WEB-DEV-H"},"imageAssetId":{"type":"integer","nullable":true,"description":"DAM asset of the organization used as the item image."},"isActive":{"type":"boolean","example":true,"description":"Legacy: sets status to ACTIVE (true) or ARCHIVED (false). Prefer `status`."}}},"ResolvedItemPrice":{"type":"object","description":"The price version in force now in the requested currency (catalog D3), priced at quantity 1. Amounts are numbers at 4 decimal places.","properties":{"priceId":{"type":"integer","example":42},"currencyId":{"type":"integer","example":1},"currencyCode":{"type":"string","example":"BRL"},"model":{"type":"string","enum":["FLAT","PER_UNIT","VOLUME","GRADUATED","PACKAGE"]},"interval":{"type":"string","enum":["MONTH","QUARTER","HALF_YEAR","YEAR","TWO_YEARS","THREE_YEARS"],"nullable":true,"description":"Amount covers one complete cycle: MONTH=1, QUARTER=3, HALF_YEAR=6, YEAR=12, TWO_YEARS=24 and THREE_YEARS=36 months. Null is a one-off price."},"unitAmount":{"type":"number","example":150},"setupFee":{"type":"number","example":0},"source":{"type":"string","enum":["list","price_list","rate_card"],"example":"list"}}},"ItemsListResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"items":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/Item"},{"type":"object","description":"Present only when the request passed `currency`.","properties":{"resolvedPrice":{"allOf":[{"$ref":"#/components/schemas/ResolvedItemPrice"}],"nullable":true},"priceError":{"type":"object","nullable":true,"description":"Why `resolvedPrice` is null. Prices are never converted between currencies.","properties":{"code":{"type":"string","enum":["NO_PRICE","NO_PRICE_IN_CURRENCY"]},"message":{"type":"string","example":"\"Dev hour\" has no price in USD (priced in: BRL)"}}}}}]}},"pagination":{"type":"object","properties":{"page":{"type":"integer","example":1},"limit":{"type":"integer","example":10},"total":{"type":"integer","example":100},"totalPages":{"type":"integer","example":10}}}}}}},"ItemResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"item":{"$ref":"#/components/schemas/Item"}}}}},"StripeWebhookEvent":{"type":"object","properties":{"id":{"type":"string","example":"evt_1234567890"},"object":{"type":"string","example":"event"},"api_version":{"type":"string","example":"2023-10-16"},"created":{"type":"integer","example":1698765432},"type":{"type":"string","example":"invoice.paid"},"data":{"type":"object","properties":{"object":{"$ref":"#/components/schemas/StripeInvoicePaidEvent"}}}},"required":["id","type","data"]},"StripeInvoicePaidEvent":{"type":"object","properties":{"id":{"type":"string","example":"in_1234567890"},"object":{"type":"string","example":"invoice"},"amount_paid":{"type":"integer","description":"Amount paid in cents","example":10000},"amount_due":{"type":"integer","description":"Amount due in cents","example":0},"currency":{"type":"string","example":"usd"},"customer":{"type":"string","example":"cus_1234567890"},"invoice_pdf":{"type":"string","nullable":true,"example":"https://pay.stripe.com/invoice/xxx"},"hosted_invoice_url":{"type":"string","nullable":true,"example":"https://invoice.stripe.com/i/xxx"},"status":{"type":"string","example":"paid"},"subtotal":{"type":"integer","description":"Subtotal in cents","example":10000},"tax":{"type":"integer","nullable":true,"description":"Tax amount in cents","example":null},"created":{"type":"integer","example":1698765432},"due_date":{"type":"integer","nullable":true,"example":1698765432},"metadata":{"type":"object","properties":{"organizationId":{"type":"string","example":"123"},"clientId":{"type":"string","nullable":true,"example":"456"},"clientInvoiceId":{"type":"string","nullable":true,"example":"789"},"projectId":{"type":"string","nullable":true,"example":"101"},"notes":{"type":"string","nullable":true,"example":"Additional notes"}}},"status_transitions":{"type":"object","properties":{"paid_at":{"type":"integer","nullable":true,"example":1698765432}}},"payment_intent":{"type":"string","nullable":true,"example":"pi_1234567890"},"lines":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"il_1234567890"},"description":{"type":"string","example":"Service Subscription"},"amount":{"type":"integer","description":"Amount in cents","example":10000},"quantity":{"type":"integer","example":1},"price":{"type":"object","properties":{"unit_amount":{"type":"integer","description":"Unit amount in cents","example":10000}}}}}}}}},"required":["id","amount_paid","currency"]},"WebhookSuccessResponse":{"type":"object","properties":{"message":{"type":"string","example":"ok"}},"required":["message"]},"WebhookErrorResponse":{"type":"object","properties":{"error":{"type":"string","example":"Error message"}},"required":["error"]},"ProjectStatus":{"type":"string","enum":["ACTIVE","INACTIVE","COMPLETED","CANCELLED"]},"ProjectType":{"type":"string","enum":["DEVELOPMENT","IMPLEMENTATION","CONSULTING","MAINTENANCE","OPERATIONS","TRAINING","RESEARCH","MIGRATION","SUPPORT"]},"TaskPriority":{"type":"string","enum":["LOW","MEDIUM","HIGH","URGENT"]},"Project":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Website Redesign"},"description":{"type":"string","nullable":true},"status":{"$ref":"#/components/schemas/ProjectStatus"},"type":{"allOf":[{"$ref":"#/components/schemas/ProjectType"}],"nullable":true},"startDate":{"type":"string","format":"date-time","nullable":true},"endDate":{"type":"string","format":"date-time","nullable":true},"clientId":{"type":"integer","nullable":true},"organizationId":{"type":"integer"},"folderId":{"type":"integer","nullable":true},"templateId":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"CreateProjectRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","example":"Website Redesign"},"description":{"type":"string"},"status":{"$ref":"#/components/schemas/ProjectStatus"},"type":{"$ref":"#/components/schemas/ProjectType"},"startDate":{"type":"string","format":"date-time"},"endDate":{"type":"string","format":"date-time"},"clientId":{"type":"integer","nullable":true},"folderId":{"type":"integer","nullable":true},"templateId":{"type":"integer"}}},"UpdateProjectRequest":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"$ref":"#/components/schemas/ProjectStatus"},"startDate":{"type":"string","format":"date-time","nullable":true},"endDate":{"type":"string","format":"date-time","nullable":true},"clientId":{"type":"integer","nullable":true},"folderId":{"type":"integer","nullable":true}}},"ProjectResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}}}}},"ProjectsListResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project"}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}}}}}}},"Task":{"type":"object","properties":{"id":{"type":"integer","example":1},"title":{"type":"string","example":"Implement login page"},"description":{"type":"string","nullable":true},"startDate":{"type":"string","format":"date-time","nullable":true},"dueDate":{"type":"string","format":"date-time","nullable":true},"priority":{"$ref":"#/components/schemas/TaskPriority"},"estimatedHours":{"type":"number","nullable":true},"actualHours":{"type":"number","nullable":true},"projectId":{"type":"integer"},"statusId":{"type":"integer"},"organizationId":{"type":"integer"},"order":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"CreateTaskRequest":{"type":"object","required":["title"],"properties":{"title":{"type":"string","example":"Implement login page"},"description":{"type":"string"},"startDate":{"type":"string","format":"date-time"},"dueDate":{"type":"string","format":"date-time"},"priority":{"$ref":"#/components/schemas/TaskPriority"},"estimatedHours":{"type":"number"},"statusId":{"type":"integer"},"assigneeIds":{"type":"array","items":{"type":"integer"}},"tagIds":{"type":"array","items":{"type":"integer"}},"ticketId":{"type":"integer"},"parentTaskId":{"type":"integer"}}},"UpdateTaskRequest":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":"string","nullable":true},"startDate":{"type":"string","format":"date-time","nullable":true},"dueDate":{"type":"string","format":"date-time","nullable":true},"priority":{"$ref":"#/components/schemas/TaskPriority"},"estimatedHours":{"type":"number","nullable":true},"actualHours":{"type":"number","nullable":true},"statusId":{"type":"integer"},"assigneeIds":{"type":"array","items":{"type":"integer"}},"tagIds":{"type":"array","items":{"type":"integer"}}}},"TaskResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"task":{"$ref":"#/components/schemas/Task"}}}}},"TasksListResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"tasks":{"type":"array","items":{"$ref":"#/components/schemas/Task"}}}}}},"AccountType":{"type":"string","enum":["BANK","CREDIT_CARD","DEBT","CASH","INVESTMENT","OTHER"]},"BalanceAccountNature":{"type":"string","enum":["ASSET","LIABILITY","EQUITY"]},"FinancialTransactionType":{"type":"string","enum":["INCOME","EXPENSE","TRANSFER"]},"FinancialBusinessEventType":{"type":"string","enum":["OPERATING_INCOME","OPERATING_EXPENSE","OWNER_CONTRIBUTION","PRO_LABORE","SHAREHOLDER_LOAN_IN","SHAREHOLDER_LOAN_REPAYMENT","SHAREHOLDER_LOAN_CONVERSION","DIVIDEND_DECLARATION","DIVIDEND_PAYMENT","TRANSFER","ADJUSTMENT"]},"CashFlowBucket":{"type":"string","enum":["OPERATING","INVESTING","FINANCING"]},"CurrencySummary":{"type":"object","properties":{"id":{"type":"integer","example":1},"code":{"type":"string","example":"USD"},"symbol":{"type":"string","nullable":true,"example":"$"}},"required":["id"]},"FinancialCategorySummary":{"type":"object","properties":{"id":{"type":"integer","example":12},"name":{"type":"string","example":"Software subscriptions"},"type":{"$ref":"#/components/schemas/FinancialTransactionType"}},"required":["id","name","type"]},"ClientSummary":{"type":"object","properties":{"id":{"type":"integer","example":10},"name":{"type":"string","example":"Acme Corp"},"email":{"type":"string","nullable":true,"example":"finance@acme.com"}},"required":["id","name"]},"ProjectSummary":{"type":"object","properties":{"id":{"type":"integer","example":22},"name":{"type":"string","example":"ERP rollout"}},"required":["id","name"]},"InvoiceSummary":{"type":"object","properties":{"id":{"type":"integer","example":31},"invoiceNumber":{"type":"string","example":"INV-2026-0031"},"status":{"type":"string","example":"PAID"}},"required":["id","invoiceNumber"]},"AccountSummary":{"type":"object","properties":{"id":{"type":"integer","example":8},"name":{"type":"string","example":"Main Bank Account"},"type":{"$ref":"#/components/schemas/AccountType"},"isActive":{"type":"boolean","example":true},"last4Digits":{"type":"string","nullable":true,"example":"1234"}},"required":["id","name","type","isActive"]},"FinancialTransaction":{"type":"object","properties":{"id":{"type":"integer","example":15},"organizationId":{"type":"integer","example":1},"type":{"$ref":"#/components/schemas/FinancialTransactionType"},"amount":{"type":"number","example":249.9},"currencyId":{"type":"integer","example":1},"categoryId":{"type":"integer","nullable":true,"example":12},"clientId":{"type":"integer","nullable":true,"example":10},"projectId":{"type":"integer","nullable":true,"example":22},"invoiceId":{"type":"integer","nullable":true,"example":31},"accountId":{"type":"integer","nullable":true,"example":8},"toAccountId":{"type":"integer","nullable":true,"example":9},"affectsProfit":{"type":"boolean","example":true},"businessEventType":{"allOf":[{"$ref":"#/components/schemas/FinancialBusinessEventType"}],"nullable":true},"cashFlowBucket":{"allOf":[{"$ref":"#/components/schemas/CashFlowBucket"}],"nullable":true},"description":{"type":"string","nullable":true,"example":"March software payment"},"transactionDate":{"type":"string","format":"date-time","example":"2026-03-13T12:00:00.000Z"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"category":{"allOf":[{"$ref":"#/components/schemas/FinancialCategorySummary"}],"nullable":true},"client":{"allOf":[{"$ref":"#/components/schemas/ClientSummary"}],"nullable":true},"project":{"allOf":[{"$ref":"#/components/schemas/ProjectSummary"}],"nullable":true},"invoice":{"allOf":[{"$ref":"#/components/schemas/InvoiceSummary"}],"nullable":true},"account":{"allOf":[{"$ref":"#/components/schemas/AccountSummary"}],"nullable":true},"toAccount":{"allOf":[{"$ref":"#/components/schemas/AccountSummary"}],"nullable":true},"currency":{"allOf":[{"$ref":"#/components/schemas/CurrencySummary"}],"nullable":true}},"required":["id","organizationId","type","amount","currencyId","affectsProfit","transactionDate","createdAt","updatedAt"]},"Account":{"type":"object","properties":{"id":{"type":"integer","example":8},"organizationId":{"type":"integer","example":1},"name":{"type":"string","example":"Main Bank Account"},"type":{"$ref":"#/components/schemas/AccountType"},"accountingNature":{"$ref":"#/components/schemas/BalanceAccountNature"},"currencyId":{"type":"integer","example":1},"description":{"type":"string","nullable":true,"example":"Primary operating account"},"isActive":{"type":"boolean","example":true},"isPrimary":{"type":"boolean","example":false},"creditLimit":{"type":"number","nullable":true,"example":10000},"initialBalance":{"type":"number","example":5000},"expirationDate":{"type":"string","format":"date-time","nullable":true},"last4Digits":{"type":"string","nullable":true,"example":"1234"},"metadata":{"type":"object","nullable":true,"additionalProperties":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"currency":{"allOf":[{"$ref":"#/components/schemas/CurrencySummary"}],"nullable":true}},"required":["id","organizationId","name","type","accountingNature","currencyId","isActive","isPrimary","initialBalance","createdAt","updatedAt"]},"AccountWithBalance":{"allOf":[{"$ref":"#/components/schemas/Account"},{"type":"object","properties":{"balance":{"type":"number","example":7340.15},"availableCredit":{"type":"number","nullable":true,"example":3200},"recentTransactions":{"type":"array","items":{"$ref":"#/components/schemas/FinancialTransaction"}}},"required":["balance"]}]},"CreateAccountRequest":{"type":"object","properties":{"name":{"type":"string","example":"Main Bank Account"},"type":{"$ref":"#/components/schemas/AccountType"},"currencyId":{"type":"integer","example":1},"accountingNature":{"$ref":"#/components/schemas/BalanceAccountNature"},"description":{"type":"string","nullable":true,"example":"Main operating bank account"},"creditLimit":{"type":"number","nullable":true,"example":10000},"initialBalance":{"type":"number","nullable":true,"example":5000},"expirationDate":{"type":"string","format":"date","nullable":true},"last4Digits":{"type":"string","nullable":true,"example":"1234"},"metadata":{"type":"object","nullable":true,"additionalProperties":true}},"required":["name","type","currencyId"]},"CreateTransactionRequest":{"type":"object","properties":{"type":{"$ref":"#/components/schemas/FinancialTransactionType"},"amount":{"type":"number","example":249.9},"currencyId":{"type":"integer","example":1},"categoryId":{"type":"integer","nullable":true,"example":12},"clientId":{"type":"integer","nullable":true,"example":10},"projectId":{"type":"integer","nullable":true,"example":22},"invoiceId":{"type":"integer","nullable":true,"example":31},"accountId":{"type":"integer","nullable":true,"example":8},"toAccountId":{"type":"integer","nullable":true,"example":9},"affectsProfit":{"type":"boolean","nullable":true,"example":true},"businessEventType":{"allOf":[{"$ref":"#/components/schemas/FinancialBusinessEventType"}],"nullable":true},"cashFlowBucket":{"allOf":[{"$ref":"#/components/schemas/CashFlowBucket"}],"nullable":true},"description":{"type":"string","nullable":true,"example":"March payroll transfer"},"transactionDate":{"type":"string","format":"date","example":"2026-03-13"}},"required":["type","amount","currencyId","transactionDate"]},"AccountResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"account":{"$ref":"#/components/schemas/AccountWithBalance"}}}},"required":["success","data"]},"AccountsListResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"accounts":{"type":"array","items":{"$ref":"#/components/schemas/AccountWithBalance"}}}}},"required":["success","data"]},"TransactionResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"transaction":{"$ref":"#/components/schemas/FinancialTransaction"}}}},"required":["success","data"]},"TransactionsListResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"transactions":{"type":"array","items":{"$ref":"#/components/schemas/FinancialTransaction"}},"pagination":{"type":"object","properties":{"page":{"type":"integer","example":1},"limit":{"type":"integer","example":50},"total":{"type":"integer","example":125},"totalPages":{"type":"integer","example":3}},"required":["page","limit","total","totalPages"]}}}},"required":["success","data"]},"Activity":{"type":"object","properties":{"id":{"type":"integer","example":77},"type":{"type":"string","enum":["CALL","EMAIL","MEETING","TASK","NOTE","FOLLOW_UP"]},"status":{"type":"string","enum":["PLANNED","COMPLETED","CANCELED"]},"title":{"type":"string","example":"Discovery call"},"description":{"type":"string","nullable":true},"dueAt":{"type":"string","format":"date-time","nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true},"ownerMembershipId":{"type":"integer","nullable":true},"leadId":{"type":"integer","nullable":true},"opportunityId":{"type":"integer","nullable":true},"clientId":{"type":"integer","nullable":true},"contactId":{"type":"integer","nullable":true,"description":"Read-only. The CRM record this activity was filed under, resolved from the link you gave."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"CreateActivityRequest":{"type":"object","properties":{"title":{"type":"string","example":"Discovery call"},"type":{"type":"string","enum":["CALL","EMAIL","MEETING","TASK","NOTE","FOLLOW_UP"]},"description":{"type":"string","nullable":true},"dueAt":{"type":"string","format":"date-time","nullable":true},"ownerMembershipId":{"type":"integer","nullable":true},"leadId":{"type":"integer","nullable":true},"opportunityId":{"type":"integer","nullable":true},"clientId":{"type":"integer","nullable":true},"contactId":{"type":"integer","nullable":true,"description":"A CRM record id, when the activity is about a person or company directly rather than a lead or a deal."}},"required":["title","type"]},"UpdateContactRequest":{"type":"object","description":"Partial update - only the fields present in the body are written. Send\nnull to clear a nullable field; omit it to leave it untouched.\n\nIdentifiers are replaced BY TYPE: sending `email` swaps the contact's\ne-mail addresses and leaves its phone alone, and `\"email\": null`\nclears them. A value already held by another contact is refused with\n409 rather than moved, because moving it would silently blank it on\nthe record that had it.\n\n`type` cannot be changed here. A person is not turned into a company\nby an edit - the two have different relationships hanging off them.\n","properties":{"name":{"type":"string","description":"Unlike POST, this renames the contact outright. An explicit statement about one record, not a side effect of a sync."},"email":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"domain":{"type":"string","nullable":true},"taxId":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"jobTitle":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"lifecycleStatus":{"type":"string","nullable":true},"ownerMembershipId":{"type":"integer","nullable":true},"tags":{"type":"array","items":{"type":"string"},"description":"The COMPLETE tag list. Omit to leave tags untouched; send [] to clear them."}}},"ContactIdentifier":{"type":"object","properties":{"type":{"type":"string","enum":["EMAIL","PHONE","DOMAIN","TAX_ID","EXTERNAL_ID"],"example":"EMAIL"},"value":{"type":"string","description":"The normalized form actually stored - e-mails lower-cased, phones reduced to digits, domains stripped of scheme and www.","example":"ada@example.com"}}},"ContactOwner":{"type":"object","nullable":true,"properties":{"membershipId":{"type":"integer","example":9},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true}}},"ContactTag":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"slug":{"type":"string"}}},"Contact":{"type":"object","properties":{"id":{"type":"integer","example":20},"type":{"type":"string","enum":["PERSON","COMPANY"]},"name":{"type":"string","example":"Ada Lovelace"},"description":{"type":"string","nullable":true},"lifecycleStatus":{"type":"string","nullable":true,"enum":["subscriber","lead","prospect","opportunity","customer","churned","disqualified"]},"source":{"type":"string","nullable":true},"jobTitle":{"type":"string","nullable":true},"email":{"type":"string","nullable":true,"description":"Convenience field - the first EMAIL identifier. The full list is in identifiers."},"phone":{"type":"string","nullable":true,"description":"Convenience field - the first PHONE identifier."},"identifiers":{"type":"array","items":{"$ref":"#/components/schemas/ContactIdentifier"}},"ownerMembershipId":{"type":"integer","nullable":true},"owner":{"$ref":"#/components/schemas/ContactOwner"},"tags":{"type":"array","items":{"$ref":"#/components/schemas/ContactTag"}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"ContactListResponse":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"contacts":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}}}}}}},"ContactResponse":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"contact":{"$ref":"#/components/schemas/Contact"},"created":{"type":"boolean","description":"true when a new record was minted, false when an existing one was matched by identifier and updated."}}}}},"UpsertContactRequest":{"type":"object","description":"At least one identifier (email, phone, domain, taxId, externalId) is\nrequired - it is what the endpoint resolves on. A body without one is\nrefused rather than always creating, because a retried request would\nthen mint a second copy of the same contact.\n","properties":{"type":{"type":"string","enum":["PERSON","COMPANY"],"example":"PERSON"},"name":{"type":"string","description":"Used as the display name when a record is created. On a match it is IGNORED unless the stored name is a placeholder (the record's own e-mail or phone) - a sync must not revert a name corrected by hand. Use PATCH to rename.","example":"Ada Lovelace"},"email":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"domain":{"type":"string","nullable":true},"taxId":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true,"description":"The id this contact has in YOUR system. The most reliable key to sync on, since it does not change when the person changes jobs."},"jobTitle":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"lifecycleStatus":{"type":"string","nullable":true,"enum":["subscriber","lead","prospect","opportunity","customer","churned","disqualified"]},"ownerMembershipId":{"type":"integer","nullable":true},"tags":{"type":"array","items":{"type":"string"},"description":"The COMPLETE tag list for this contact - tags not listed are removed. Omit the field to leave tags untouched; send [] to clear them. Unknown names are created."}},"required":["type","name"]},"UpdateLeadRequest":{"type":"object","description":"Partial update - only the fields present in the body are written. Send null to clear a nullable field; omit it to leave it untouched.","properties":{"name":{"type":"string","example":"Ada Lovelace"},"company":{"type":"string","nullable":true},"jobTitle":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true,"description":"Must be a valid email address, or 400. Send null (or blank) to clear it."},"phone":{"type":"string","nullable":true,"description":"Contact fields are written through the linked CRM person record, so the lead columns stay a mirror of it. The stored phone may be canonicalized (country code prepended)."},"sourceId":{"type":"integer","nullable":true,"description":"Takes precedence over sourceName when both are provided."},"sourceName":{"type":"string","nullable":true,"description":"Resolved case-insensitively against the organization's sources. Returns 400 if it does not match an existing source."},"campaignId":{"type":"integer","nullable":true},"ownerMembershipId":{"type":"integer","nullable":true},"score":{"type":"integer","nullable":true},"estimatedValue":{"type":"number","nullable":true},"notes":{"type":"string","nullable":true},"status":{"type":"string","enum":["NEW","CONTACTED","QUALIFIED","UNQUALIFIED","LOST","CONVERTED"],"description":"CONVERTED cannot be set directly - a lead becomes CONVERTED by converting it to a client, which links the client record. Sending it returns 400.","example":"QUALIFIED"},"lostReason":{"type":"string","nullable":true},"whatsappOptIn":{"type":"boolean","description":"Two-way consent switch. true records a SUBSCRIBED row (marketing templates allowed); false records UNSUBSCRIBED, which also cancels that contact's messages still waiting in the send queue. Omit to leave consent unchanged. Must be a real JSON boolean - strings like \"true\" return 400. Ignored when the lead has no resolvable phone.","example":false},"optInSource":{"type":"string","nullable":true,"description":"Provenance recorded on the consent row (e.g. \"portal:unsubscribe\", \"form:123\"). Defaults to \"lead_update\".","example":"portal:unsubscribe"}}},"CreateLeadRequest":{"type":"object","properties":{"name":{"type":"string","example":"Ada Lovelace"},"company":{"type":"string","nullable":true,"example":"Analytical Engines Ltd"},"jobTitle":{"type":"string","nullable":true,"example":"Founder"},"email":{"type":"string","format":"email","nullable":true,"description":"Must be a valid email address, or 400. Blank is stored as no email.","example":"ada@example.com"},"phone":{"type":"string","nullable":true,"example":"+18095550000"},"sourceId":{"type":"integer","nullable":true,"description":"Lead source id. Takes precedence over sourceName when both are provided.","example":1},"sourceName":{"type":"string","nullable":true,"description":"Lead source name, matched case-insensitively against the organization's sources. Used to resolve the source when sourceId is omitted. Returns 400 if the name does not match an existing source.","example":"Website"},"campaignId":{"type":"integer","nullable":true,"example":1},"ownerMembershipId":{"type":"integer","nullable":true,"example":9},"score":{"type":"integer","nullable":true,"example":80},"estimatedValue":{"type":"number","nullable":true,"example":2500},"notes":{"type":"string","nullable":true,"example":"Captured from partner integration"},"metadata":{"type":"object","nullable":true,"additionalProperties":true,"example":{"externalId":"lead_123","form":"demo-request"}},"whatsappOptIn":{"type":"boolean","nullable":true,"description":"Set true only when the contact gave explicit WhatsApp marketing consent (e.g. a checked opt-in box). When true and a phone is present, records a SUBSCRIBED consent row so a compliant marketing-template first-touch may be sent. Leads without opt-in are never cold-messaged. Must be a real JSON boolean - strings like \"true\" or numbers return 400. If no phone can be resolved for the lead the opt-in is ignored and no consent row is written, while the lead is still created.","example":true},"optInSource":{"type":"string","nullable":true,"description":"Provenance recorded on the consent row when whatsappOptIn is true (e.g. \"form:123\", \"ad:meta-q3\"). Defaults to \"lead_capture\" when omitted. Ignored when whatsappOptIn is not true.","example":"form:123"}},"required":["name"]},"LeadCrmRecord":{"type":"object","nullable":true,"properties":{"id":{"type":"integer","example":20},"displayName":{"type":"string","example":"Ada Lovelace"}}},"Lead":{"type":"object","properties":{"id":{"type":"integer","example":10},"name":{"type":"string","example":"Ada Lovelace"},"company":{"type":"string","nullable":true,"example":"Analytical Engines Ltd"},"jobTitle":{"type":"string","nullable":true,"example":"Founder"},"email":{"type":"string","nullable":true,"example":"ada@example.com"},"phone":{"type":"string","nullable":true,"example":"+18095550000"},"status":{"type":"string","example":"NEW"},"score":{"type":"integer","example":80},"estimatedValue":{"type":"number","nullable":true,"example":2500},"notes":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true,"additionalProperties":true},"personRecordId":{"type":"integer","nullable":true,"example":20},"companyRecordId":{"type":"integer","nullable":true,"example":30},"personRecord":{"$ref":"#/components/schemas/LeadCrmRecord"},"companyRecord":{"$ref":"#/components/schemas/LeadCrmRecord"},"lostReason":{"type":"string","nullable":true},"sourceId":{"type":"integer","nullable":true},"campaignId":{"type":"integer","nullable":true},"ownerMembershipId":{"type":"integer","nullable":true},"convertedClientId":{"type":"integer","nullable":true,"description":"Set once the lead became a client. Its presence is what makes the status CONVERTED."},"convertedAt":{"type":"string","format":"date-time","nullable":true},"source":{"type":"object","nullable":true,"description":"Only present on the read endpoints.","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"campaign":{"type":"object","nullable":true,"description":"Only present on the read endpoints.","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"owner":{"type":"object","nullable":true,"description":"Only present on the read endpoints. membershipId is the value to send back as ownerMembershipId.","properties":{"membershipId":{"type":"integer"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true}}},"tags":{"type":"array","description":"Only present on the read endpoints.","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"slug":{"type":"string"}}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"LeadResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"lead":{"$ref":"#/components/schemas/Lead"}}}},"required":["success","data"]},"LeadListResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"leads":{"type":"array","items":{"$ref":"#/components/schemas/Lead"}},"pagination":{"type":"object","properties":{"page":{"type":"integer","example":1},"limit":{"type":"integer","example":25},"total":{"type":"integer","example":137},"totalPages":{"type":"integer","example":6}}}}}},"required":["success","data"]},"Opportunity":{"type":"object","properties":{"id":{"type":"integer","example":42},"title":{"type":"string","example":"Website redesign"},"status":{"type":"string","enum":["OPEN","WON","LOST"]},"value":{"type":"number","example":45000},"currencyId":{"type":"integer"},"probability":{"type":"integer","example":60},"probabilityIsManual":{"type":"boolean","description":"While true, moving the deal to another stage does not change its probability."},"stageId":{"type":"integer"},"pipelineId":{"type":"integer","nullable":true,"description":"The pipeline the deal sits in - always its stage's. Moving the deal to a stage of another pipeline moves it to that pipeline."},"stageEnteredAt":{"type":"string","format":"date-time"},"expectedCloseDate":{"type":"string","format":"date-time","nullable":true},"wonAt":{"type":"string","format":"date-time","nullable":true},"lostAt":{"type":"string","format":"date-time","nullable":true},"lostReason":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"ownerMembershipId":{"type":"integer","nullable":true},"leadId":{"type":"integer","nullable":true},"clientId":{"type":"integer","nullable":true},"quoteId":{"type":"integer","nullable":true},"personRecordId":{"type":"integer","nullable":true},"companyRecordId":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"CreateOpportunityRequest":{"type":"object","properties":{"title":{"type":"string","example":"Website redesign"},"stageId":{"type":"integer","nullable":true,"description":"Defaults to the first stage of the organization's default pipeline. The stage decides the pipeline; a stage that is not this organization's is rejected."},"value":{"type":"number","nullable":true},"currencyId":{"type":"integer","nullable":true},"probability":{"type":"integer","nullable":true},"expectedCloseDate":{"type":"string","format":"date-time","nullable":true},"notes":{"type":"string","nullable":true},"ownerMembershipId":{"type":"integer","nullable":true},"leadId":{"type":"integer","nullable":true,"description":"The lead this deal came from. Its owner, source, campaign and estimated value are inherited when not given explicitly. A lead can only have one open deal."},"clientId":{"type":"integer","nullable":true},"personRecordId":{"type":"integer","nullable":true},"companyRecordId":{"type":"integer","nullable":true},"campaignId":{"type":"integer","nullable":true},"sourceId":{"type":"integer","nullable":true}},"required":["title"]},"ProductAccount":{"type":"object","properties":{"externalId":{"type":"string","description":"The account's id in the product. The sync key — the same id always maps to the same company, client and deal.","example":"1042"},"name":{"type":"string","description":"Account / company name.","example":"Locadora Sol"},"email":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","nullable":true},"owner":{"type":"object","nullable":true,"description":"The account owner. A PERSON record is matched or created only when an email is present.","properties":{"name":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","nullable":true}}},"lifecycle":{"type":"string","enum":["lead","prospect","opportunity","customer","churned","disqualified"],"description":"Where the account is now. \"opportunity\" means an active trial."},"plan":{"type":"object","nullable":true,"properties":{"name":{"type":"string","nullable":true},"price":{"type":"number","nullable":true,"description":"Becomes the deal value."},"interval":{"type":"string","nullable":true,"example":"month"}}},"paymentStatus":{"type":"string","enum":["paid","unpaid"],"nullable":true,"description":"\"unpaid\" = a customer whose last charge failed; the deal is kept open as a payment-recovery deal unless it is already won."},"trialEndsAt":{"type":"string","format":"date-time","nullable":true},"signupAt":{"type":"string","format":"date-time","nullable":true},"lastSeenAt":{"type":"string","format":"date-time","nullable":true},"createLeadIfMissing":{"type":"boolean","default":false,"description":"Create the lead through the normal capture path (routing, lead workflows, webhooks) when none exists. Send true only for a real new signup — a bulk resync must leave it false so no lead workflow fires."},"metadata":{"type":"object","nullable":true,"additionalProperties":true,"description":"Stored on the company record under metadata.productAccount and shown on the record as \"Product usage\". Numeric keys ending in \"Count\" (e.g. clientCount, bookingCount) are usage counters: each time one goes up, the record timeline gets a row (first usage / +N). onboardingCompleted (boolean) becomes a timeline row when it turns true. Send the CURRENT totals on every sync.\n"}},"required":["externalId","name","lifecycle"]},"ProductAccountSyncResult":{"type":"object","properties":{"externalId":{"type":"string"},"ok":{"type":"boolean"},"error":{"type":"string","description":"Present when ok is false."},"companyRecordId":{"type":"integer"},"personRecordId":{"type":"integer"},"leadId":{"type":"integer"},"clientId":{"type":"integer"},"opportunityId":{"type":"integer"},"actions":{"type":"array","items":{"type":"string"},"description":"What changed, e.g. company_created, lead_converted, client_updated, opportunity_won. A replay of the same payload reports only *_matched entries."}}},"EnrollRequest":{"type":"object","description":"Exactly one of leadIds or contactIds, matching what the workflow runs on.","properties":{"leadIds":{"type":"array","items":{"type":"integer"},"description":"Lead ids, for a workflow whose trigger object is `lead`."},"contactIds":{"type":"array","items":{"type":"integer"},"description":"CRM person record ids, for a workflow whose trigger object is `person`."}}},"EnrollResult":{"type":"object","properties":{"workflowId":{"type":"integer","example":12},"subject":{"type":"string","enum":["lead","person"]},"enrolled":{"type":"integer","example":2},"skipped":{"type":"integer","example":1},"results":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"The lead or contact id you sent."},"status":{"type":"string","enum":["enrolled","skipped"]},"runId":{"type":"integer","nullable":true,"description":"The run created","when enrolled.":null},"reason":{"type":"string","nullable":true,"enum":["not_found","opted_out","already_enrolled"],"description":"Why this one got no run. `already_enrolled` is the idempotent no-op, not a failure."}}}}}},"ContractSignedPdfResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"url":{"type":"string","description":"Presigned download URL. Short-lived — fetch it right away, never store it."},"expiresInSeconds":{"type":"integer","example":300}}}}},"ContractVersionResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"version":{"type":"object","properties":{"contractId":{"type":"integer"},"contractNumber":{"type":"string","example":"CT-2026-0042"},"number":{"type":"integer","example":2},"reason":{"type":"string","example":"INTERNAL_EDIT"},"contentHash":{"type":"string"},"signed":{"type":"boolean","description":"True for the version that binds (was signed)."},"terms":{"type":"object","additionalProperties":true},"note":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"html":{"type":"string","description":"The version's rendered text as safe HTML (escaped by construction; legacy bodies are sanitized)."}}}}}}},"ContractVersionRef":{"type":"object","nullable":true,"properties":{"number":{"type":"integer","example":2},"reason":{"type":"string","example":"INTERNAL_EDIT"},"contentHash":{"type":"string","description":"SHA-256 of the rendered version + canonical terms.","example":"9f2c…"},"createdAt":{"type":"string","format":"date-time"}}},"ContractKeyDate":{"type":"object","properties":{"kind":{"type":"string","enum":["END_OF_TERM","NOTICE_DEADLINE","ADJUSTMENT_ANNIVERSARY","ENVELOPE_EXPIRY"]},"date":{"type":"string","format":"date"},"alertOn":{"type":"string","format":"date"},"daysLeft":{"type":"integer"}}},"ContractDetail":{"allOf":[{"$ref":"#/components/schemas/ContractSummary"},{"type":"object","properties":{"terms":{"type":"object","description":"The typed terms (D2) — dates as YYYY-MM-DD, decimals as strings.","additionalProperties":true},"signatureProvider":{"type":"string","example":"NATIVE"},"terminationReason":{"type":"string","nullable":true},"voidReason":{"type":"string","nullable":true},"legacy":{"type":"boolean","description":"A pre-frontier HTML contract (read-only)."},"currentVersion":{"$ref":"#/components/schemas/ContractVersionRef"},"signedVersion":{"$ref":"#/components/schemas/ContractVersionRef"},"signature":{"type":"object","nullable":true,"description":"The latest signature envelope of the contract (amendment envelopes excluded).","properties":{"verificationId":{"type":"string","description":"Public id of the verification page."},"status":{"type":"string","enum":["OPEN","COMPLETED","DECLINED","VOIDED","EXPIRED"]},"order":{"type":"string","enum":["SEQUENTIAL","PARALLEL"]},"versionHash":{"type":"string"},"sentAt":{"type":"string","format":"date-time","nullable":true},"expiresAt":{"type":"string","format":"date-time","nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true},"voidedAt":{"type":"string","format":"date-time","nullable":true},"finalPdfHash":{"type":"string","nullable":true},"parties":{"type":"array","items":{"type":"object","properties":{"side":{"type":"string","enum":["ORG","COUNTERPARTY"]},"role":{"type":"string","enum":["SIGNER","APPROVER","WITNESS","CC"]},"order":{"type":"integer"},"name":{"type":"string"},"email":{"type":"string"},"status":{"type":"string"},"signedAt":{"type":"string","format":"date-time","nullable":true},"signedChannel":{"type":"string","nullable":true},"declinedAt":{"type":"string","format":"date-time","nullable":true},"declineReason":{"type":"string","nullable":true}}}}}},"signedPdfAvailable":{"type":"boolean"},"items":{"type":"array","items":{"type":"object","properties":{"itemId":{"type":"integer"},"name":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"},"billingModel":{"type":"string"},"billingFrequency":{"type":"string","nullable":true},"serviceState":{"type":"string","enum":["ACTIVE","SUSPENDED"],"description":"Independent line state"},"effectiveServiceState":{"type":"string","enum":["ACTIVE","SUSPENDED"],"description":"Parent suspension is inherited"}}}},"billing":{"type":"object","description":"Billing schedule summary (contract-to-cash).","properties":{"lines":{"type":"integer"},"planned":{"type":"object","properties":{"count":{"type":"integer"},"amount":{"type":"string"}}},"invoiced":{"type":"object","properties":{"count":{"type":"integer"},"amount":{"type":"string"}}},"canceled":{"type":"object","properties":{"count":{"type":"integer"},"amount":{"type":"string"}}},"nextDue":{"type":"object","nullable":true,"properties":{"dueDate":{"type":"string","format":"date"},"amount":{"type":"string"}}}}},"keyDates":{"type":"array","items":{"$ref":"#/components/schemas/ContractKeyDate"}}}}]},"ContractResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"contract":{"$ref":"#/components/schemas/ContractDetail"}}}},"required":["success","data"]},"ContractSummary":{"type":"object","properties":{"id":{"type":"integer","example":42},"number":{"type":"string","example":"CT-2026-0042"},"name":{"type":"string","example":"Website retainer 2026"},"status":{"type":"string","enum":["DRAFT","IN_REVIEW","APPROVED","OUT_FOR_SIGNATURE","PARTIALLY_SIGNED","SIGNED","ACTIVE","SUSPENDED","EXPIRED","TERMINATED","DECLINED","VOIDED","EXPIRED_UNSIGNED"]},"contractType":{"type":"string","nullable":true,"example":"retainer"},"clientId":{"type":"integer","example":7},"client":{"type":"object","nullable":true,"properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"projectId":{"type":"integer","nullable":true},"quoteId":{"type":"integer","nullable":true},"ownerMembershipId":{"type":"integer","nullable":true},"currency":{"type":"string","nullable":true,"example":"BRL"},"totalValue":{"type":"string","nullable":true,"description":"Decimal as a string, 2 places.","example":"48000.00"},"effectiveDate":{"type":"string","format":"date","nullable":true,"example":"2026-01-01"},"endDate":{"type":"string","format":"date","nullable":true,"description":"Last day in force (inclusive).","example":"2026-12-31"},"termMonths":{"type":"integer","nullable":true,"example":12},"renewalType":{"type":"string","enum":["NONE","MANUAL","AUTO"]},"renewalTermMonths":{"type":"integer","nullable":true},"noticeDays":{"type":"integer","nullable":true,"example":30},"sentAt":{"type":"string","format":"date-time","nullable":true},"signedAt":{"type":"string","format":"date-time","nullable":true},"activatedAt":{"type":"string","format":"date-time","nullable":true},"terminatedAt":{"type":"string","format":"date-time","nullable":true},"declinedAt":{"type":"string","format":"date-time","nullable":true},"voidedAt":{"type":"string","format":"date-time","nullable":true},"expiredAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"ContractListResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"contracts":{"type":"array","items":{"$ref":"#/components/schemas/ContractSummary"}},"pagination":{"type":"object","properties":{"page":{"type":"integer","example":1},"limit":{"type":"integer","example":25},"total":{"type":"integer","example":61},"totalPages":{"type":"integer","example":3}}}}}},"required":["success","data"]},"CreateContractRequest":{"type":"object","description":"Creates a DRAFT. Either `clientId` (blank or from `templateId`) or\n`quoteId` (an ACCEPTED quote; its client, currency, total and items\nare copied). `terms` cannot be combined with `quoteId`.\n","properties":{"name":{"type":"string","description":"Required unless quoteId is given (defaults to the quote title).","example":"Website retainer 2026"},"clientId":{"type":"integer","description":"Required unless quoteId is given.","example":7},"projectId":{"type":"integer","nullable":true},"ownerMembershipId":{"type":"integer","description":"The active member the key acts for; owns the draft.","example":3},"templateId":{"type":"integer","nullable":true},"quoteId":{"type":"integer","nullable":true},"contractType":{"type":"string","nullable":true,"maxLength":60},"terms":{"type":"object","description":"Partial typed terms (dates as YYYY-MM-DD, decimals as strings).","properties":{"currencyId":{"type":"integer"},"totalValue":{"type":"string","nullable":true,"example":"48000.00"},"effectiveDate":{"type":"string","format":"date","nullable":true},"endDate":{"type":"string","format":"date","nullable":true},"termMonths":{"type":"integer","nullable":true},"renewalType":{"type":"string","enum":["NONE","MANUAL","AUTO"]},"renewalTermMonths":{"type":"integer","nullable":true},"noticeDays":{"type":"integer","nullable":true},"adjustmentIndex":{"type":"string","enum":["NONE","IPCA","IGPM","INPC","FIXED_PCT"]},"adjustmentBaseDate":{"type":"string","format":"date","nullable":true},"adjustmentFixedPct":{"type":"string","nullable":true},"adjustmentCapPct":{"type":"string","nullable":true},"adjustmentFloorPct":{"type":"string","nullable":true},"adjustmentRequiresSignature":{"type":"boolean"},"paymentTermsDays":{"type":"integer","nullable":true},"governingLaw":{"type":"string","nullable":true},"jurisdiction":{"type":"string","nullable":true}}}},"required":["ownerMembershipId"]},"InvoiceApiDraft":{"type":"object","additionalProperties":false,"required":["currencyId","items"],"properties":{"currencyId":{"type":"integer","minimum":1},"clientId":{"type":"integer","minimum":1,"nullable":true},"projectId":{"type":"integer","minimum":1,"nullable":true},"issueDate":{"type":"string","format":"date"},"dueDate":{"type":"string","format":"date","nullable":true},"items":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","additionalProperties":false,"required":["name","quantity","unitPrice"],"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"description":{"type":"string","maxLength":4000,"nullable":true},"itemId":{"type":"integer","minimum":1,"nullable":true},"quantity":{"type":"integer","minimum":1,"maximum":1000000},"unitPrice":{"type":"string","pattern":"^(0|[1-9]\\d{0,13})(\\.\\d{1,4})?$","example":"12.3400"},"setupFee":{"type":"string","pattern":"^(0|[1-9]\\d{0,13})(\\.\\d{1,4})?$"},"tax":{"type":"string","pattern":"^(0|[1-9]\\d{0,13})(\\.\\d{1,4})?$"}}}}}},"WebhookSubscription":{"type":"object","properties":{"id":{"type":"integer"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"allEvents":{"type":"boolean","description":"True for an endpoint added in Settings with no event ticked - it receives every event."},"isActive":{"type":"boolean"},"description":{"type":"string","nullable":true},"lastDeliveryAt":{"type":"string","format":"date-time","nullable":true},"lastDeliveryStatus":{"type":"integer","nullable":true},"failureCount":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"secret":{"type":"string","description":"Only in the response to POST. Verify each delivery with it: X-Baseos-Webhook-Signature is v1=<hex HMAC-SHA256 of \"<X-Baseos-Webhook-Timestamp>.<raw body>\">; refuse timestamps more than 5 minutes off and remember X-Baseos-Webhook-Id (also in the body as deliveryId) to refuse a repeat. The legacy X-Baseos-Signature (sha256=HMAC of the raw body) is still sent but does not protect against replays."}}},"CreateWebhookSubscriptionRequest":{"type":"object","required":["url","events"],"properties":{"url":{"type":"string","description":"Where deliveries are POSTed. https only."},"events":{"type":"array","items":{"type":"string"},"description":"One or more event names from the webhook catalog. Unknown names are refused.","example":["lead.created","opportunity.won"]},"description":{"type":"string","description":"Shown in Settings → Webhooks next to the endpoint."}}}}},"security":[{"ApiKeyAuth":[]}],"paths":{"/api/v1/automation-hooks/{token}":{"post":{"summary":"Trigger an automation through its inbound webhook","description":"Starts a run of a published automation whose trigger is \"Inbound webhook\". The secret token in the URL is the credential (copy it from the trigger block); no API key is sent. The JSON body (at most 64 KB) becomes the run's input and is validated against the flow's input schema. The run executes after the response. Sending the same `Idempotency-Key` header — or, without one, the same body — returns the same `runId` and starts nothing new. Limited to 60 requests a minute per token. A revoked, unknown or unpublished hook answers a generic 404.\n","tags":["Automations"],"security":[],"parameters":[{"in":"path","name":"token","required":true,"schema":{"type":"string","maxLength":128}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"202":{"description":"Accepted — the run was queued (or an identical earlier request is answered again)","content":{"application/json":{"schema":{"type":"object","properties":{"runId":{"type":"string"}}}}}},"400":{"description":"The body is not JSON","or the Idempotency-Key is malformed":null},"404":{"description":"Unknown","revoked or unpublished hook":null},"413":{"description":"The body is larger than 64 KB"},"422":{"description":"The body fails the flow's input schema; `error.fields` names the failing fields"},"429":{"description":"Too many requests; see the Retry-After header"}},"operationId":"createAutomationHookByToken"}},"/api/stripe/webhook/{organizationId}":{"post":{"summary":"Stripe webhook endpoint for invoice.paid events","description":"Webhook endpoint to receive Stripe events, specifically for invoice.paid events.\nWhen a Stripe invoice is paid, this endpoint will:\n1. Create or update a ClientInvoice record\n2. Register the payment\n3. Create a FinancialTransaction entry in the accounting system\n\nThe webhook signature must be verified using the Stripe webhook secret configured\nin the organization's Stripe integration settings.\n","tags":["Finance","Webhooks"],"parameters":[{"in":"path","name":"organizationId","required":true,"schema":{"type":"integer"},"description":"Organization ID"},{"in":"header","name":"stripe-signature","required":true,"schema":{"type":"string"},"description":"Stripe webhook signature header sent automatically by Stripe with each webhook request.\nThis header is used to verify the authenticity of the webhook. The webhook secret\nmust be configured in the integration settings; unsigned events are rejected.\n"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeWebhookEvent"},"examples":{"invoicePaid":{"summary":"Invoice Paid Event","value":{"id":"evt_1234567890","object":"event","api_version":"2023-10-16","created":1698765432,"type":"invoice.paid","data":{"object":{"id":"in_1234567890","object":"invoice","amount_paid":10000,"amount_due":0,"currency":"usd","customer":"cus_1234567890","invoice_pdf":"https://pay.stripe.com/invoice/xxx","hosted_invoice_url":"https://invoice.stripe.com/i/xxx","status":"paid","subtotal":10000,"tax":null,"created":1698765432,"due_date":1698765432,"metadata":{"organizationId":"123","clientId":"456","clientInvoiceId":"789"},"status_transitions":{"paid_at":1698765432},"payment_intent":"pi_1234567890","lines":{"data":[{"id":"il_1234567890","description":"Service Subscription","amount":10000,"quantity":1,"price":{"unit_amount":10000}}]}}}}}}}}},"responses":{"200":{"description":"Webhook processed successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSuccessResponse"},"example":{"message":"ok"}}}},"400":{"description":"Bad request - Invalid payload, signature verification failed, or webhook processing failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookErrorResponse"},"examples":{"invalidOrganization":{"value":{"error":"Invalid organization ID"}},"signatureVerificationFailed":{"value":{"error":"Webhook signature verification failed: No signatures found matching the expected signature"}},"processingFailed":{"value":{"error":"Could not identify organization from webhook"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookErrorResponse"},"example":{"error":"Internal server error"}}}}},"operationId":"createStripeWebhookByOrganizationid"}},"/api/v1/ai-connections":{"get":{"summary":"Get the AI connection","description":"The organization's AI provider connection, or null. The API key is never returned (hasCredential only). Requires `ai-connections:read`.","tags":["AI connections"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"The connection"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null}},"operationId":"listAiConnections"}},"/api/v1/ai-connections/models":{"get":{"summary":"List reachable models","description":"Catalog models the connection reaches, with USD prices per million tokens. Requires `ai-connections:read`.","tags":["AI connections"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"The models"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null}},"operationId":"listAiConnectionModels"}},"/api/v1/checkout/billing-portal-sessions":{"post":{"summary":"Open the hosted billing portal for a customer (secret key, checkout:write)","description":"Body { customerExternalId, returnUrl, locale? (en|es|pt) }. Returns { url, expiresAt } — a one-time link, valid for 1 hour, where that customer sees their subscriptions and invoices, cancels or resumes, and changes the card (Stripe). Redirect the customer to url. returnUrl must be on one of your allowed redirect hosts (Checkout › Settings). A retry mints another one-time link (no Idempotency-Key).","tags":["Checkout"],"security":[{"ApiKeyAuth":[]}],"responses":{"201":{"description":"{ url, expiresAt }"},"400":{"description":"Invalid body, or returnUrl not allowed (invalid_redirect, redirect_host_not_allowed)"},"403":{"description":"Missing scope","a public key":null,"or the billing portal unavailable":null},"404":{"description":"customer_not_found — never mirrored in this account"}},"operationId":"createCheckoutBillingPortalSession"}},"/api/v1/checkout/customers/{externalId}":{"put":{"summary":"Mirror a customer account and its people (secret key, checkout:write)","description":"Upsert by YOUR id. Body { name, email?, taxId?, members [{ externalId, email|null, name|null, role owner|admin|member }] }. The account is a BaseOS customer (by organization + externalId); each member a person linked to it with that role. A member missing from the list is unlinked (never deleted). An e-mail that already belongs to another customer or person of your account is NOT written nor merged — the answer lists it in conflicts and the record keeps its externalId. Returns { externalId, customerAccountId, created, conflicts }. A natural upsert; repeating it is harmless.","tags":["Checkout"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"externalId","required":true,"schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Customer updated"},"201":{"description":"Customer created"},"400":{"description":"Invalid body (invalid_input, invalid_email, duplicate_member)"},"403":{"description":"Missing scope","a public key":null,"or checkout unavailable":null}},"operationId":"updateCheckoutCustomerByExternalid"}},"/api/v1/checkout/customers/{externalId}/access":{"get":{"summary":"What a customer has right now (secret key, checkout:read)","description":"The customer's ACTIVE and SUSPENDED grants of every source (checkout, contract, trial, manual), in the key's mode (a test key reads test grants). Each one carries its item, quantity and consumed as decimal strings, expiresAt and — when a subscription renews it — the subscription's status, period end, scheduled cancellation and scheduled plan change. Read it again whenever checkout.customer.access_changed or checkout.subscription.* arrives.","tags":["Checkout"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"externalId","required":true,"schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"{ customer { externalId, name }, livemode, entitlements [...] }"},"404":{"description":"customer_not_found — never mirrored in this account"}},"operationId":"getCheckoutCustomerAccesByExternalid"}},"/api/v1/checkout/public/items":{"get":{"summary":"Sellable catalog items (public key, checkout:public)","description":"Items marked for checkout, with their active prices per currency (decimal strings) and lookup keys. Send the key as X-Baseos-Public-Key from an allowed origin.","tags":["Checkout"],"responses":{"200":{"description":"Items and prices"},"403":{"description":"Origin not allowed","missing scope or checkout unavailable":null}},"operationId":"listCheckoutPublicItems"}},"/api/v1/checkout/public/sessions":{"post":{"summary":"Open a checkout from the browser (public key, checkout:public)","description":"Catalog lines only (itemPriceId or lookupKey + quantity), and optionally a promotionCode (the code only — the discount is computed on the server), and optionally a referralCode (the visitor's ?ref= affiliate code; ignored when it is not an active affiliate). Returns the session id, hosted url and the clientSecret for status reads.","tags":["Checkout"],"responses":{"201":{"description":"Session created"},"400":{"description":"Invalid lines, or a refused promotion code (promotion_<reason>)"},"429":{"description":"Too many requests from this visitor"}},"operationId":"createCheckoutPublicSession"}},"/api/v1/checkout/public/sessions/{id}":{"get":{"summary":"Read a checkout's status (public key + clientSecret)","description":"Send the clientSecret as X-Baseos-Client-Secret (or ?client_secret=). Status, total and lines; no buyer data.","tags":["Checkout"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The session","without PII":null},"404":{"description":"Unknown session or wrong secret"}},"operationId":"getCheckoutPublicSessionById"}},"/api/v1/checkout/subscriptions":{"get":{"summary":"List subscriptions (secret key, checkout:read)","description":"The subscriptions of the key's mode, newest first (at most 100). Filter by customerExternalId (the id you mirrored with PUT /customers/{externalId}) and status.","tags":["Checkout"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"customerExternalId","schema":{"type":"string"}},{"in":"query","name":"status","schema":{"type":"string","enum":["ACTIVE","PAST_DUE","CANCELED","ENDED"]}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"An array of subscriptions (publicId, status, itemId, itemPriceId, quantity, currentPeriodStart/End, cancelAtPeriodEnd, scheduledItemPriceId, …)"}},"operationId":"listCheckoutSubscriptions"}},"/api/v1/checkout/subscriptions/{publicId}":{"get":{"summary":"Read a subscription (secret key, checkout:read)","tags":["Checkout"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"publicId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The subscription"},"404":{"description":"Not found in this account and mode"}},"operationId":"getCheckoutSubscriptionByPublicid"}},"/api/v1/checkout/subscriptions/{publicId}/cancel":{"post":{"summary":"Cancel a subscription (secret key, checkout:write)","description":"Body { atPeriodEnd = true }. At the period end it keeps access until currentPeriodEnd and does not renew (revert it with /resume). atPeriodEnd false cancels at once and the access expires now — no refund, no proration; an unpaid renewal invoice is cancelled too (one with a payment stays open for the merchant to review). Canceling a canceled subscription answers it as is. Send Idempotency-Key to retry safely.","tags":["Checkout"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"publicId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The subscription after the change"},"404":{"description":"Not found in this account and mode"},"409":{"description":"Not possible in its state (SUBSCRIPTION_NOT_EDITABLE, SUBSCRIPTION_INVALID_TRANSITION)"}},"operationId":"createCheckoutSubscriptionCancelByPublicid"}},"/api/v1/checkout/subscriptions/{publicId}/resume":{"post":{"summary":"Undo a scheduled cancellation (secret key, checkout:write)","description":"Only while ACTIVE and before currentPeriodEnd. Send Idempotency-Key to retry safely.","tags":["Checkout"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"publicId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The subscription after the change"},"404":{"description":"Not found in this account and mode"},"409":{"description":"Not active","or its period already ended":null}},"operationId":"createCheckoutSubscriptionResumeByPublicid"}},"/api/v1/checkout/subscriptions/{publicId}/schedule-change":{"post":{"summary":"Schedule a plan change for the next renewal (secret key, checkout:write)","description":"Body { itemPriceId | null }. The new price (a recurring price of your catalog, in force, in the subscription's currency; another item or interval is fine) is charged from the next renewal on — no proration. null, or the current price, clears a scheduled change. Send Idempotency-Key to retry safely.","tags":["Checkout"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"publicId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The subscription after the change"},"400":{"description":"The price is not recurring, not in force, or in another currency (schedule_price_*)"},"404":{"description":"Subscription or price not found"},"409":{"description":"Not active","or its period already ended":null}},"operationId":"createCheckoutSubscriptionScheduleChangeByPublicid"}},"/api/v1/checkout/trials":{"post":{"summary":"Start a free trial of an offer (secret key, checkout:write)","description":"Body { offer (the offer's public id, from Checkout › Trials), email, name?, externalUserId? (your own user id, the distinctId you send to /api/v1/events), ref? (an affiliate code) }. One trial per offer and e-mail — a repeat returns the existing trial (200), never a second one. Grants ACCESS to the offer's item until endsAt, e-mails the buyer, and before the end e-mails a checkout link for the offer's price; paying it converts the trial. Live keys only. Send Idempotency-Key to retry safely.","tags":["Checkout"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"This e-mail already has a trial of this offer (returned as is)"},"201":{"description":"Trial started"},"400":{"description":"Invalid body","or a test key":null},"403":{"description":"Missing scope or trials unavailable"},"404":{"description":"Unknown or archived offer"}},"operationId":"createCheckoutTrial"}},"/api/v1/activities":{"get":{"summary":"List activities","tags":["Activities"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"in":"query","name":"type","schema":{"type":"string","enum":["CALL","EMAIL","MEETING","TASK","NOTE","FOLLOW_UP"]}},{"in":"query","name":"status","schema":{"type":"string","enum":["PLANNED","COMPLETED","CANCELED"]}},{"in":"query","name":"ownerMembershipId","description":"A membership id, or the literal \"unassigned\".","schema":{"type":"string"}},{"in":"query","name":"leadId","schema":{"type":"integer"}},{"in":"query","name":"opportunityId","schema":{"type":"integer"}},{"in":"query","name":"clientId","schema":{"type":"integer"}},{"in":"query","name":"contactId","schema":{"type":"integer"}},{"in":"query","name":"dueBefore","description":"Combine with status=PLANNED for \"what is overdue\".","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"dueAfter","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"updatedSince","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"createdSince","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"sort","schema":{"type":"string","enum":["dueAt","createdAt","updatedAt","completedAt","id"],"default":"dueAt"}},{"in":"query","name":"order","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Activities page"},"400":{"description":"A query parameter could not be parsed"},"401":{"description":"Missing or invalid API key"}},"operationId":"listActivities"},"post":{"summary":"Log an activity","tags":["Activities"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateActivityRequest"}}}},"responses":{"201":{"description":"Activity created"},"400":{"description":"Invalid payload"},"401":{"description":"Missing or invalid API key"}},"operationId":"createActivity"}},"/api/v1/activities/{id}":{"get":{"summary":"Get one activity","tags":["Activities"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"The activity"},"401":{"description":"Missing or invalid API key"},"404":{"description":"No such activity in this organization"}},"operationId":"getActivityById"},"patch":{"summary":"Complete or cancel an activity","tags":["Activities"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["PLANNED","COMPLETED","CANCELED"],"description":"COMPLETED stamps completedAt; anything else clears it. Since 2026-10-25 a COMPLETED activity cannot become CANCELED (or the reverse) directly — reopen it to PLANNED first. Sending the current status is a no-op."}},"required":["status"]}}}},"responses":{"200":{"description":"The updated activity"},"400":{"description":"Invalid payload"},"401":{"description":"Missing or invalid API key"},"404":{"description":"No such activity in this organization (or it was deleted)"},"409":{"description":"COMPLETED ↔ CANCELED without reopening first"}},"operationId":"updateActivityById"}},"/api/v1/contacts/{id}":{"get":{"summary":"Read one CRM contact","description":"The same contact the list returns, so a caller needs one mapper rather\nthan two.\n\nA contact of another organization, and a record that is not a PERSON or\nCOMPANY (a deal, an internal record), both answer 404. They are the same\nanswer on purpose: distinguishing them would let a caller probe which\nids exist in someone else's account.\n","tags":["CRM Contacts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"The contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponse"}}}},"400":{"description":"Malformed id"},"401":{"description":"Unauthorized - invalid or missing API key"},"403":{"description":"The CRM module is not active for this organization"},"404":{"description":"No such contact in this organization"}},"operationId":"getContactById"},"patch":{"summary":"Update a CRM contact","description":"Partially update a PERSON or COMPANY record owned by the authenticated organization. Changes to a person's name, e-mail or phone propagate to the leads that mirror it, and a record.updated workflow trigger fires after the write.","tags":["CRM Contacts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContactRequest"}}}},"responses":{"200":{"description":"The updated contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponse"}}}},"400":{"description":"Malformed id or field"},"401":{"description":"Unauthorized - invalid or missing API key"},"403":{"description":"The CRM module is not active for this organization"},"404":{"description":"No such contact in this organization"},"409":{"description":"An identifier in the body already belongs to another contact"}},"operationId":"updateContactById"}},"/api/v1/contacts":{"get":{"summary":"List CRM contacts (people and companies)","description":"The canonical identity layer of the CRM: the records that leads,\nconversations, opportunities and clients all point at. Only PERSON and\nCOMPANY records are ever returned - deal records belong to the\nopportunities resource.\n\nAt most ONE identifier filter (email, phone, domain, taxId, externalId)\nper request; values are normalized before matching, so an address sent\nin any casing finds its contact.\n","tags":["CRM Contacts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","default":1}},{"in":"query","name":"limit","schema":{"type":"integer","default":25,"maximum":100}},{"in":"query","name":"type","schema":{"type":"string","enum":["PERSON","COMPANY"]}},{"in":"query","name":"lifecycleStatus","schema":{"type":"string"}},{"in":"query","name":"source","schema":{"type":"string"}},{"in":"query","name":"ownerMembershipId","description":"A membership id, or the literal \"unassigned\" for contacts nobody owns.","schema":{"type":"string"}},{"in":"query","name":"tag","description":"Tag name or slug, matched on the slug (casing and spacing forgiven).","schema":{"type":"string"}},{"in":"query","name":"email","schema":{"type":"string"}},{"in":"query","name":"phone","schema":{"type":"string"}},{"in":"query","name":"domain","schema":{"type":"string"}},{"in":"query","name":"taxId","schema":{"type":"string"}},{"in":"query","name":"externalId","schema":{"type":"string"}},{"in":"query","name":"updatedSince","description":"ISO-8601. Incremental sync - contacts touched at or after this instant.","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"createdSince","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"sort","schema":{"type":"string","enum":["updatedAt","createdAt","displayName","id"],"default":"updatedAt"}},{"in":"query","name":"order","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"A page of contacts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactListResponse"}}}},"400":{"description":"A malformed or ambiguous query parameter, named in the message"},"401":{"description":"Unauthorized - invalid or missing API key"},"403":{"description":"The CRM module is not active for this organization"}},"operationId":"listContacts"},"post":{"summary":"Create or update a CRM contact, resolved by identifier","description":"An upsert keyed on identity, not on our primary key. The identifiers in\nthe body are normalized and looked up first; a match updates that\ncontact (200) and no match creates one (201). Contacts are NEVER matched\nby name - two different customers sharing a name must not become one\nrecord.\n","tags":["CRM Contacts"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertContactRequest"}}}},"responses":{"200":{"description":"An existing contact was matched by identifier and updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponse"}}}},"201":{"description":"A new contact was created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponse"}}}},"400":{"description":"Missing name/type, no identifier, or an unusable value"},"401":{"description":"Unauthorized - invalid or missing API key"},"403":{"description":"The CRM module is not active for this organization"},"409":{"description":"The identifier already belongs to a record of another type"}},"operationId":"createContact"}},"/api/v1/events":{"post":{"summary":"Ingest product events","description":"Record business events emitted by a product (signup, subscription started/canceled, churn, revenue, feature usage). Feeds the PRODUCT dashboard (MRR, signups, churn). Accepts a single event object or a batch via `{ \"events\": [...] }` (max 500 per request). Supply an `externalId` to make delivery idempotent — a repeated id is a no-op.\n","tags":["Product Events"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProductEvent"},{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/ProductEvent"}}},"required":["events"]}]},"examples":{"signup":{"summary":"A single signup","value":{"name":"user_signed_up","distinctId":"user_123","email":"ada@example.com","externalId":"evt_abc"}},"batch":{"summary":"A batch with a paid subscription","value":{"events":[{"name":"user_signed_up","distinctId":"user_123"},{"name":"subscription_started","distinctId":"user_123","amountUsd":29,"currency":"USD"}]}}}}}},"responses":{"202":{"description":"Events accepted for ingestion","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"accepted":{"type":"integer","example":2},"duplicates":{"type":"integer","example":0},"eventIds":{"type":"array","items":{"type":"integer"}}}}}}}}},"400":{"description":"Invalid request body or event payload"},"401":{"description":"Unauthorized - Invalid or missing API key"}},"operationId":"createEvent"}},"/api/v1/leads/{id}":{"get":{"summary":"Read one growth lead","description":"The full lead, with its source, campaign, owner and tags resolved — the\nsame shape the list endpoint returns, so a caller does not need a second\nmapper for the detail view.\n\nA lead of another organization and a deleted lead both answer 404. They\nare the same answer on purpose: distinguishing them would let a caller\nprobe which ids exist in someone else's account.\n","tags":["Growth Leads"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"example":10}],"responses":{"200":{"description":"The lead","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadResponse"}}}},"400":{"description":"Malformed id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Lead not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getLeadById"},"patch":{"summary":"Update a growth lead","description":"Partially update a lead owned by the authenticated organization. Contact changes propagate to the linked CRM person record, and a record.updated workflow trigger fires after the write.","tags":["Growth Leads"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Lead id returned by POST /api/v1/leads","example":10}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLeadRequest"},"examples":{"qualify":{"summary":"Move the lead forward and assign an owner","value":{"status":"QUALIFIED","score":90,"ownerMembershipId":9}},"revokeConsent":{"summary":"Record a WhatsApp opt-out and suppress queued sends","value":{"whatsappOptIn":false,"optInSource":"portal:unsubscribe"}},"clearField":{"summary":"Clear a nullable field","value":{"notes":null}}}}}},"responses":{"200":{"description":"Lead updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Lead not found in this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"updateLeadById"}},"/api/v1/leads":{"post":{"summary":"Create a growth lead","description":"Create a lead for the authenticated organization and automatically link it to CRM person/company records.","tags":["Growth Leads"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLeadRequest"},"examples":{"bySourceId":{"summary":"Attribute the lead using a source id","value":{"name":"Ada Lovelace","company":"Analytical Engines Ltd","jobTitle":"Founder","email":"ada@example.com","phone":"+18095550000","sourceId":1,"ownerMembershipId":9,"score":80,"estimatedValue":2500,"notes":"Captured from partner integration","metadata":{"externalId":"lead_123"}}},"bySourceName":{"summary":"Attribute the lead using a source name (resolved to its id)","value":{"name":"Ada Lovelace","email":"ada@example.com","sourceName":"Website","notes":"Captured from partner integration"}},"withWhatsAppOptIn":{"summary":"Record explicit WhatsApp marketing consent","value":{"name":"Ada Lovelace","phone":"+18095550000","sourceName":"Website","whatsappOptIn":true,"optInSource":"form:123"}}}}}},"responses":{"201":{"description":"Lead created and linked to CRM records","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Duplicate lead","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"createLead"},"get":{"summary":"List growth leads","description":"Paginated list of the authenticated organization's leads, newest change\nfirst. Deleted leads are never returned — the CRM hides them rather than\ndestroying them, and a sync that saw them would resurrect every contact\nthe customer removed.\n\nEvery filter is validated: a parameter that cannot be parsed answers 400\nand names itself, instead of being dropped. A dropped filter returns the\nwhole base and looks like a successful sync.\n","tags":["Growth Leads"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"in":"query","name":"status","schema":{"type":"string","enum":["NEW","CONTACTED","QUALIFIED","UNQUALIFIED","LOST","CONVERTED"]}},{"in":"query","name":"sourceId","schema":{"type":"integer"}},{"in":"query","name":"campaignId","schema":{"type":"integer"}},{"in":"query","name":"ownerMembershipId","description":"A membership id, or the literal \"unassigned\" for leads nobody owns. Omit for any owner.","schema":{"type":"string","example":"unassigned"}},{"in":"query","name":"tag","description":"Tag name or slug. Matched on the slug, so casing and inner spacing are forgiven.","schema":{"type":"string","example":"hot lead"}},{"in":"query","name":"email","description":"Exact e-mail lookup, forgiving case and surrounding spaces. Finds the same lead a POST with this e-mail would answer 409 for - the lead's own address or one on its CRM person.","schema":{"type":"string","example":"ada@example.com"}},{"in":"query","name":"updatedSince","description":"ISO-8601. Incremental sync — rows whose updatedAt is at or after this instant.","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"createdSince","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"sort","schema":{"type":"string","enum":["updatedAt","createdAt","id"],"default":"updatedAt"}},{"in":"query","name":"order","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Page of leads","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadListResponse"}}}},"400":{"description":"Invalid query parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"listLeads"}},"/api/v1/opportunities":{"get":{"summary":"List opportunities","tags":["Opportunities"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"in":"query","name":"status","schema":{"type":"string","enum":["OPEN","WON","LOST"]}},{"in":"query","name":"stageId","schema":{"type":"integer"}},{"in":"query","name":"ownerMembershipId","description":"A membership id, or the literal \"unassigned\".","schema":{"type":"string"}},{"in":"query","name":"leadId","schema":{"type":"integer"}},{"in":"query","name":"clientId","schema":{"type":"integer"}},{"in":"query","name":"personRecordId","schema":{"type":"integer"}},{"in":"query","name":"companyRecordId","schema":{"type":"integer"}},{"in":"query","name":"campaignId","schema":{"type":"integer"}},{"in":"query","name":"sourceId","schema":{"type":"integer"}},{"in":"query","name":"closedSince","description":"Won or lost at or after this instant - the incremental read for a revenue sync.","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"updatedSince","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"createdSince","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"sort","schema":{"type":"string","enum":["updatedAt","createdAt","value","expectedCloseDate","id"],"default":"updatedAt"}},{"in":"query","name":"order","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Opportunities page"},"400":{"description":"A query parameter could not be parsed"},"401":{"description":"Missing or invalid API key"}},"operationId":"listOpportunities"},"post":{"summary":"Create an opportunity","tags":["Opportunities"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOpportunityRequest"}}}},"responses":{"201":{"description":"Opportunity created"},"400":{"description":"Invalid payload"},"401":{"description":"Missing or invalid API key"}},"operationId":"createOpportunity"}},"/api/v1/opportunities/{id}":{"get":{"summary":"Get one opportunity","tags":["Opportunities"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"The opportunity"},"401":{"description":"Missing or invalid API key"},"404":{"description":"No such opportunity in this organization"}},"operationId":"getOpportunityById"},"patch":{"summary":"Update, move or close an opportunity","tags":["Opportunities"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Partial update - only the fields present are written.","properties":{"title":{"type":"string"},"value":{"type":"number"},"currencyId":{"type":"integer"},"probability":{"type":"integer","minimum":0,"maximum":100},"expectedCloseDate":{"type":"string","format":"date-time","nullable":true},"notes":{"type":"string","nullable":true},"ownerMembershipId":{"type":"integer","nullable":true},"personRecordId":{"type":"integer","nullable":true},"companyRecordId":{"type":"integer","nullable":true},"stageId":{"type":"integer","description":"Moves the deal. A stage of another pipeline moves the deal to that pipeline. Cannot be combined with a WON or LOST status - closing already moves it to the terminal stage of its own pipeline."},"status":{"type":"string","enum":["OPEN","WON","LOST"]},"lostReason":{"type":"string","description":"Required when status is LOST. One of the values listed in the error message when omitted."}}}}}},"responses":{"200":{"description":"The updated opportunity"},"400":{"description":"Invalid payload","or LOST without a loss reason":null},"401":{"description":"Missing or invalid API key"},"404":{"description":"No such opportunity in this organization"}},"operationId":"updateOpportunityById"}},"/api/v1/product-accounts":{"post":{"summary":"Sync product accounts into the CRM","description":"Idempotent batch upsert of a SaaS product's customer accounts. For each account BaseOS converges the company record, the owner's person record, the lead status, the client (customers only) and a single pipeline deal onto the state sent. Accepts one account object or `{ \"accounts\": [...] }` (1-100). The whole request is refused with 400 when any account is malformed; a failure while writing one account is reported in its result and does not affect the others.\n","tags":["Product Accounts"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProductAccount"},{"type":"object","properties":{"accounts":{"type":"array","minItems":1,"maxItems":100,"items":{"$ref":"#/components/schemas/ProductAccount"}}},"required":["accounts"]}]},"examples":{"signup":{"summary":"A new trial signup (creates the lead)","value":{"externalId":"1042","name":"Locadora Sol","owner":{"name":"Ana Souza","email":"ana@locadorasol.com.br"},"lifecycle":"opportunity","trialEndsAt":"2026-10-26T00:00:00Z","signupAt":"2026-10-12T14:03:00Z","createLeadIfMissing":true}},"batch":{"summary":"Nightly resync","value":{"accounts":[{"externalId":"1042","name":"Locadora Sol","lifecycle":"customer","plan":{"name":"Pro","price":199,"interval":"month"},"paymentStatus":"paid"},{"externalId":"977","name":"Aluga Fácil","lifecycle":"churned"}]}}}}}},"responses":{"200":{"description":"Per-account results","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/ProductAccountSyncResult"}}}}}}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"createProductAccount"}},"/api/v1/timeline":{"get":{"summary":"Read the interaction timeline of a contact, lead or opportunity","tags":["Activities"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"contactId","description":"A CRM record id. At least one of contactId, leadId or opportunityId is required.","schema":{"type":"integer"}},{"in":"query","name":"leadId","schema":{"type":"integer"}},{"in":"query","name":"opportunityId","schema":{"type":"integer"}},{"in":"query","name":"category","description":"Repeatable. Filters to these interaction categories.","schema":{"type":"string"}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":200,"default":100}}],"responses":{"200":{"description":"The timeline","newest first":null},"400":{"description":"No subject given","or a parameter could not be parsed":null},"401":{"description":"Missing or invalid API key"}},"operationId":"listTimeline"}},"/api/v1/workflows/{id}/enroll":{"post":{"summary":"Enroll leads or contacts into a published workflow","description":"Starts the workflow for each subject, exactly as the CRM's bulk-enroll button does. Safe to retry: a subject already in this workflow comes back as `already_enrolled` rather than starting a second run.\n","tags":["Workflows"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollRequest"}}}},"responses":{"200":{"description":"Every subject got a verdict — see `results`."},"400":{"description":"Invalid payload","or the wrong subject type for this workflow":null},"401":{"description":"Missing or invalid API key"},"403":{"description":"The organization does not have workflow automations"},"404":{"description":"No such workflow in this organization"},"409":{"description":"The workflow exists but is not published and active"}},"operationId":"createWorkflowEnrollById"}},"/api/v1/accounts/{id}":{"get":{"summary":"Get customer account by ID","tags":["Customer Accounts"],"operationId":"getAccountById"},"put":{"summary":"Update customer account","tags":["Customer Accounts"],"operationId":"updateAccountById"},"delete":{"summary":"Delete customer account","tags":["Customer Accounts"],"operationId":"deleteAccountById"}},"/api/v1/accounts":{"get":{"summary":"List customer accounts","description":"Canonical customer-account endpoint. /api/v1/clients remains available as a legacy-compatible alias.","tags":["Customer Accounts"],"operationId":"listAccounts"},"post":{"summary":"Create customer account","description":"Canonical create endpoint. Accepts the same payload as legacy /api/v1/clients and returns customerAccount/customerAccountId.","tags":["Customer Accounts"],"operationId":"createAccount"}},"/api/v1/clients/{id}":{"get":{"summary":"Get client by ID","description":"Retrieve a single client by its ID. Returns full client details including user, organization, projects, and tickets information.","tags":["Clients"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Client ID"}],"responses":{"200":{"description":"Client retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientResponse"}}}},"400":{"description":"Invalid client ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Client not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getClientById"},"put":{"summary":"Update client","description":"Update an existing client. All fields are optional. Email uniqueness is enforced within the organization.","tags":["Clients"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Client ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateClientRequest"},"example":{"name":"John Doe Updated","email":"john.doe.updated@example.com","phone":"+1234567891"}}}},"responses":{"200":{"description":"Client updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Client or user not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"updateClientById"},"delete":{"summary":"Delete client","description":"Delete a client by ID. Cannot delete clients with associated projects or tickets.","tags":["Clients"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Client ID"}],"responses":{"200":{"description":"Client deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"integer","example":1},"message":{"type":"string","example":"Client deleted successfully"}}}}}}}},"400":{"description":"Invalid client ID or client cannot be deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Client not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"deleteClientById"}},"/api/v1/clients":{"get":{"summary":"List clients with pagination and search filters","description":"Retrieve a paginated list of clients for the authenticated organization. Supports searching by name, email, and phone.","tags":["Clients"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1},"description":"Page number for pagination"},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"description":"Number of items per page"},{"in":"query","name":"search","schema":{"type":"string"},"description":"Search in client name, email, and phone"}],"responses":{"200":{"description":"Successful response with clients list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientsListResponse"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"listClients"},"post":{"summary":"Create a new client","description":"Create a new client in the authenticated organization. Name is required, all other fields are optional.","tags":["Clients"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateClientRequest"},"example":{"name":"John Doe","email":"john.doe@example.com","phone":"+1234567890","avatar":"https://example.com/avatar.jpg","userId":1}}}},"responses":{"200":{"description":"Client created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"User not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"createClient"}},"/api/v1/items/{id}":{"get":{"summary":"Get item by ID","description":"Retrieve a single item by its ID. Returns full item details including category, currency, and base prices. Requires the `catalog:read` (or `catalog:write`) API key scope; a key with no scopes (legacy) holds both.","tags":["Items"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Item ID"}],"responses":{"200":{"description":"Item retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemResponse"}}}},"400":{"description":"Invalid item ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key lacks the `catalog:read` scope, or the catalog module is not active for the organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getItemById"},"put":{"summary":"Update item","description":"Update an existing item. All fields are optional. Enum values must be valid if provided. `status` (DRAFT, ACTIVE, ARCHIVED) is the lifecycle; the legacy `isActive` is still accepted (true = ACTIVE, false = ARCHIVED) and always returned as its mirror. Leaving ARCHIVED takes a catalog slot and fails at the plan limit; a sold item cannot go back to DRAFT. Requires the `catalog:write` API key scope (prices included); a key with no scopes (legacy) holds it. Every change is recorded in the organization audit log with origin `api` and the price before/after.","tags":["Items"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Item ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateItemRequest"},"example":{"name":"Updated Web Development Service","basePrice":120,"status":"ARCHIVED","sku":"WEB-DEV-H"}}}},"responses":{"200":{"description":"Item updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key lacks the `catalog:write` scope, or the catalog module is not active for the organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Item, currency, category or image asset not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Another item of the organization already uses this SKU","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"updateItemById"},"delete":{"summary":"Delete item","description":"Delete an item by ID. Cannot delete items with associated contract items, invoice items, entitlements, or quote items. Requires the `catalog:write` API key scope; a key with no scopes (legacy) holds it.","tags":["Items"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Item ID"}],"responses":{"200":{"description":"Item deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"integer","example":1},"message":{"type":"string","example":"Item deleted successfully"}}}}}}}},"400":{"description":"Invalid item ID or item cannot be deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key lacks the `catalog:write` scope, or the catalog module is not active for the organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"deleteItemById"}},"/api/v1/items":{"get":{"summary":"List items with pagination and filters","description":"Retrieve a paginated list of items for the authenticated organization. Supports filtering by type, category (a parent category includes its children), lifecycle status, provisioning strategy, and a search term matched without case or accents (\"servico\" finds \"Serviço\") against name, description, SKU, external id and category name. With `currency`, each item also carries the price resolved in that currency now (`resolvedPrice`), or `null` plus `priceError` when it has none — a price is never converted between currencies. `basePrice`/`setupFee` on the item are a display cache in the item's own currency; use `resolvedPrice` to price a sale. Requires the `catalog:read` (or `catalog:write`) API key scope; a key with no scopes (legacy) holds both.","tags":["Items"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1},"description":"Page number for pagination"},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"description":"Number of items per page"},{"in":"query","name":"type","schema":{"$ref":"#/components/schemas/ItemType"},"description":"Filter by item type"},{"in":"query","name":"categoryId","schema":{"type":"integer"},"description":"Filter by category ID"},{"in":"query","name":"status","schema":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"]},"description":"Filter by lifecycle status (wins over isActive)"},{"in":"query","name":"isActive","schema":{"type":"boolean"},"description":"Legacy filter — true = ACTIVE, false = DRAFT or ARCHIVED"},{"in":"query","name":"provisioningStrategy","schema":{"$ref":"#/components/schemas/ProvisioningStrategy"},"description":"Filter by provisioning strategy"},{"in":"query","name":"search","schema":{"type":"string"},"description":"Case- and accent-insensitive search in name, description, SKU, external id and category name"},{"in":"query","name":"currency","schema":{"type":"string","example":"BRL"},"description":"ISO currency code. When given, each item carries `resolvedPrice` (or `resolvedPrice null` + `priceError`) in that currency. Unknown code → 400."}],"responses":{"200":{"description":"Successful response with items list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemsListResponse"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key lacks the `catalog:read` scope, or the catalog module is not active for the organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"listItems"},"post":{"summary":"Create a new item","description":"Create a new item in the authenticated organization. All required fields must be provided. Requires the `catalog:write` API key scope; a key with no scopes (legacy) holds it. Recorded in the organization audit log with origin `api`.","tags":["Items"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateItemRequest"},"example":{"name":"Web Development Service","description":"Custom web development service","type":"SERVICE","unitOfMeasure":"HOUR","billingModel":"TIME_AND_MATERIALS","internalCost":50,"basePrice":100,"setupFee":0,"currencyId":1,"categoryId":1,"provisioningStrategy":"NONE","renewalType":"NONE","status":"ACTIVE","sku":"WEB-DEV-H"}}}},"responses":{"200":{"description":"Item created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key lacks the `catalog:write` scope, or the catalog module is not active for the organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Currency, category or image asset not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Another item of the organization already uses this SKU","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"createItem"}},"/api/v1/quotes/{id}":{"get":{"summary":"Get quote by ID","description":"Retrieve a single quote by its ID. Returns full quote details including items, client, and currency information.","tags":["Quotes"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Quote ID"}],"responses":{"200":{"description":"Quote retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteResponse"}}}},"400":{"description":"Invalid quote ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Quote not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getQuoteById"},"put":{"summary":"Update quote","description":"Update an existing quote. All fields are optional. Cannot update quotes that have been converted to contracts, projects, or invoices.","tags":["Quotes"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Quote ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateQuoteRequest"},"example":{"title":"Updated Quote Title","status":"SENT","notes":"Updated notes"}}}},"responses":{"200":{"description":"Quote updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteResponse"}}}},"400":{"description":"Invalid request data or quote cannot be updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Quote not found, or an item's itemId is not a catalog item of this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"updateQuoteById"},"delete":{"summary":"Delete quote","description":"Delete a quote by ID. Cannot delete quotes that have been converted to contracts, projects, or invoices.","tags":["Quotes"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Quote ID"}],"responses":{"200":{"description":"Quote deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"integer","example":1},"message":{"type":"string","example":"Quote deleted successfully"}}}}}}}},"400":{"description":"Invalid quote ID or quote cannot be deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Quote not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"deleteQuoteById"}},"/api/v1/quotes":{"get":{"summary":"List quotes with pagination and filters","description":"Retrieve a paginated list of quotes for the authenticated organization. Supports filtering by status, client, and search terms.","tags":["Quotes"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1},"description":"Page number for pagination"},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"description":"Number of items per page"},{"in":"query","name":"status","schema":{"$ref":"#/components/schemas/QuoteStatus"},"description":"Filter by quote status"},{"in":"query","name":"clientId","schema":{"type":"integer"},"description":"Filter by client ID"},{"in":"query","name":"search","schema":{"type":"string"},"description":"Search in quote title and quote number"}],"responses":{"200":{"description":"Successful response with quotes list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuotesListResponse"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"listQuotes"},"post":{"summary":"Create a new quote","description":"Create a new quote with items. Provide either clientId for an existing client or opportunityId for a sales opportunity/deal. Quotes are not created directly from leadId; convert the lead to an opportunity first. The quote will be created in DRAFT status and totals are calculated automatically.","tags":["Quotes"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateQuoteRequest"},"example":{"opportunityId":77,"title":"Website Development Quote","currencyCode":"usd","validUntil":"2024-12-31T23:59:59Z","notes":"This is a custom quote for website development","items":[{"name":"Web Development Service","description":"Custom web development","quantity":1,"unitPrice":1000,"discount":0,"tax":0,"setupFee":0}]}}}},"responses":{"200":{"description":"Quote created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Client not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"createQuote"}},"/api/v1/departments":{"get":{"summary":"List help-desk departments","description":"Departments a ticket can be routed to (departmentId of POST /api/v1/tickets). Alert addresses are never returned.","tags":["Tickets"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"The departments"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null}},"operationId":"listDepartments"}},"/api/v1/development/repositories":{"get":{"summary":"List linked repositories","description":"Requires `development:read`. No credential is returned.","tags":["Development"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"projectId","schema":{"type":"integer"}}],"responses":{"200":{"description":"The repositories"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null}},"operationId":"listDevelopmentRepositories"}},"/api/v1/development/environments":{"get":{"summary":"List hosting environments","description":"The hosting project each project deploys to, with its last deployment. Requires `development:read`.","tags":["Development"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"projectId","schema":{"type":"integer"}}],"responses":{"200":{"description":"The environments"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null}},"operationId":"listDevelopmentEnvironments"}},"/api/v1/development/releases":{"get":{"summary":"List production releases","description":"The production release ledger, newest first. Requires `development:read`.","tags":["Development"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"projectId","schema":{"type":"integer"}},{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"A page of releases"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null}},"operationId":"listDevelopmentReleases"}},"/api/v1/entitlements":{"get":{"summary":"List entitlements (hour banks and licences)","tags":["Contracts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"clientId","schema":{"type":"integer"}},{"in":"query","name":"contractId","schema":{"type":"integer"}},{"in":"query","name":"status","schema":{"type":"string"}},{"in":"query","name":"type","schema":{"type":"string","enum":["TIME","ACCESS"]}},{"in":"query","name":"page","schema":{"type":"integer"}},{"in":"query","name":"limit","schema":{"type":"integer"}}],"responses":{"200":{"description":"Entitlements and pagination"}},"operationId":"listEntitlements"}},"/api/v1/entitlements/{id}":{"get":{"summary":"Read one entitlement","tags":["Contracts"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"The entitlement"},"404":{"description":"Not found"}},"operationId":"getEntitlementById"}},"/api/v1/entitlements/activations":{"get":{"summary":"List provisioning requests (the activations queue)","description":"Defaults to PENDING. Approving and rejecting stay in the product.","tags":["Contracts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"status","schema":{"type":"string","enum":["PENDING","APPROVED","REJECTED"]}},{"in":"query","name":"contractId","schema":{"type":"integer"}}],"responses":{"200":{"description":"Provisioning requests and pagination"}},"operationId":"listEntitlementActivations"}},"/api/v1/factory":{"get":{"summary":"Get the Factory venture","description":"Status, product identity and features, budget and journey stages. Requires `factory:read`.","tags":["Factory"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"The venture"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null},"404":{"description":"The organization has no venture"}},"operationId":"listFactory"}},"/api/v1/contracts/{id}/signed-pdf":{"get":{"summary":"Get a download link for the signed PDF","description":"A short-lived presigned URL for the signed PDF (the rendered version\nplus its signature certificate). The file is private; every call mints\na new link and is recorded in the audit log. Requires `contracts:read`.\n","tags":["Contracts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"A presigned URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractSignedPdfResponse"}}}},"400":{"description":"Invalid id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The resource is not available, or the key lacks the contracts:read scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Contract not found, or it has no signed PDF yet","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getContractSignedPdfById"}},"/api/v1/contracts/{id}/versions/{n}":{"get":{"summary":"Get one version of a contract","description":"An immutable version — the exact text and terms that were sent, and\nfor the signed one, signed — with its content hash. Requires\n`contracts:read`.\n","tags":["Contracts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}},{"in":"path","name":"n","required":true,"description":"Version number (1-based).","schema":{"type":"integer"}}],"responses":{"200":{"description":"The version","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractVersionResponse"}}}},"400":{"description":"Invalid id or version number","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The resource is not available, or the key lacks the contracts:read scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Contract or version not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getContractVersionByIdN"}},"/api/v1/contracts/{id}":{"get":{"summary":"Get a contract","description":"One contract with its typed terms, status and lifecycle dates, the\nlatest signature envelope (parties and their status), the current and\nsigned version hashes, a billing-schedule summary and the derived key\ndates. Comments are never returned. Requires `contracts:read`.\n","tags":["Contracts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"The contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractResponse"}}}},"400":{"description":"Invalid id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The resource is not available, or the key lacks the contracts:read scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Contract not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getContractById"}},"/api/v1/contracts":{"get":{"summary":"List contracts","description":"Paginated list of the organization's contracts, newest change first.\nRequires the `contracts:read` scope. Every filter is validated: a\nparameter that cannot be parsed answers 400 and names itself.\n","tags":["Contracts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"in":"query","name":"status","schema":{"type":"string","enum":["DRAFT","IN_REVIEW","APPROVED","OUT_FOR_SIGNATURE","PARTIALLY_SIGNED","SIGNED","ACTIVE","SUSPENDED","EXPIRED","TERMINATED","DECLINED","VOIDED","EXPIRED_UNSIGNED"]}},{"in":"query","name":"clientId","schema":{"type":"integer"}},{"in":"query","name":"renewalType","schema":{"type":"string","enum":["NONE","MANUAL","AUTO"]}},{"in":"query","name":"endDateFrom","description":"ISO-8601. Contracts whose term ends on or after this instant.","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"endDateTo","description":"ISO-8601. Contracts whose term ends on or before this instant.","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"updatedSince","description":"ISO-8601. Incremental sync — rows whose updatedAt is at or after this instant.","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"sort","schema":{"type":"string","enum":["updatedAt","createdAt","endDate","id"],"default":"updatedAt"}},{"in":"query","name":"order","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Page of contracts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractListResponse"}}}},"400":{"description":"Invalid query parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The resource is not available, or the key lacks the contracts:read scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"listContracts"},"post":{"summary":"Create a contract draft","description":"Creates a DRAFT contract — blank, from a template, or from an ACCEPTED\nquote — owned by `ownerMembershipId`, the member the key acts for.\nRequires the `contracts:write` scope. Sending for signature, signing,\namending and terminating are not available over the API: they stay in\nthe product, behind a member with the right role.\n","tags":["Contracts"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContractRequest"},"examples":{"blank":{"summary":"Blank draft with typed terms","value":{"name":"Website retainer 2026","clientId":7,"ownerMembershipId":3,"terms":{"totalValue":"48000.00","effectiveDate":"2026-01-01","termMonths":12,"renewalType":"AUTO","renewalTermMonths":12,"noticeDays":30}}},"fromQuote":{"summary":"From an accepted quote","value":{"quoteId":128,"ownerMembershipId":3}}}}}},"responses":{"201":{"description":"Draft created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The plan's contract ceiling is reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The resource is not available, or the key lacks the contracts:write scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Referenced quote not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The quote is not accepted or already has a contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"createContract"}},"/api/v1/financial/accounts/{id}":{"get":{"summary":"Get financial account by ID","description":"Retrieve a single account, including its calculated balance and optionally its most recent transactions.","tags":["Financial Accounts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Account ID"},{"in":"query","name":"includeTransactions","schema":{"type":"boolean","default":false},"description":"Include recent transactions for this account"},{"in":"query","name":"transactionLimit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"description":"Maximum number of recent transactions to include"}],"responses":{"200":{"description":"Account retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountResponse"}}}},"400":{"description":"Invalid account ID or query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Account not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getFinancialAccountById"}},"/api/v1/financial/accounts":{"get":{"summary":"List financial accounts","description":"Retrieve financial accounts for the authenticated organization, including their calculated balances.","tags":["Financial Accounts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"type","schema":{"$ref":"#/components/schemas/AccountType"},"description":"Filter by account type"},{"in":"query","name":"includeInactive","schema":{"type":"boolean","default":false},"description":"Include inactive accounts in the response"}],"responses":{"200":{"description":"Accounts retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountsListResponse"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"listFinancialAccounts"},"post":{"summary":"Create a financial account","description":"Create a new account for the authenticated organization. Credit card accounts require a positive credit limit.","tags":["Financial Accounts"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccountRequest"},"example":{"name":"Main Bank Account","type":"BANK","currencyId":1,"accountingNature":"ASSET","description":"Primary operating bank account","initialBalance":2500,"metadata":{"bank":"Inter"}}}}},"responses":{"200":{"description":"Account created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Currency not found for this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"createFinancialAccount"}},"/api/v1/financial/transactions/{id}":{"get":{"summary":"Get financial transaction by ID","description":"Retrieve a single financial transaction for the authenticated organization.","tags":["Financial Transactions"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Transaction ID"}],"responses":{"200":{"description":"Transaction retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionResponse"}}}},"400":{"description":"Invalid transaction ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Transaction not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getFinancialTransactionById"}},"/api/v1/financial/transactions":{"get":{"summary":"List financial transactions","description":"Retrieve financial transactions for the authenticated organization with pagination and optional filters.","tags":["Financial Transactions"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1},"description":"Page number"},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Number of items per page"},{"in":"query","name":"type","schema":{"$ref":"#/components/schemas/FinancialTransactionType"},"description":"Filter by transaction type"},{"in":"query","name":"categoryId","schema":{"type":"integer"},"description":"Filter by financial category"},{"in":"query","name":"clientId","schema":{"type":"integer"},"description":"Filter by client"},{"in":"query","name":"projectId","schema":{"type":"integer"},"description":"Filter by project"},{"in":"query","name":"accountId","schema":{"type":"integer"},"description":"Filter by source or destination account"},{"in":"query","name":"currencyId","schema":{"type":"integer"},"description":"Filter by currency"},{"in":"query","name":"startDate","schema":{"type":"string","format":"date"},"description":"Filter transactions on or after this date"},{"in":"query","name":"endDate","schema":{"type":"string","format":"date"},"description":"Filter transactions on or before this date"}],"responses":{"200":{"description":"Transactions retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionsListResponse"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"listFinancialTransactions"},"post":{"summary":"Create a financial transaction","description":"Create a financial transaction for the authenticated organization. Transfer transactions require both source and destination accounts.","tags":["Financial Transactions"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTransactionRequest"},"example":{"type":"EXPENSE","amount":249.9,"currencyId":1,"categoryId":12,"accountId":8,"description":"March software subscription","transactionDate":"2026-03-13"}}}},"responses":{"200":{"description":"Transaction created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Related resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"createFinancialTransaction"}},"/api/v1/invoices/{id}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer","minimum":1}}],"get":{"summary":"Read one client invoice (private invoices:read)","tags":["Invoices"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Customer-safe invoice DTO with exact decimal strings"},"404":{"description":"Missing or foreign invoice"}},"operationId":"getInvoiceById"},"put":{"summary":"Replace an unlinked DRAFT (private invoices:write)","description":"Full replacement body uses the POST schema. No issued, paid, cancelled, accounting/fiscal/payment/contract/quote/entitlement-linked drafts. Checks and replacement are atomic.","tags":["Invoices"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceApiDraft"}}}},"responses":{"200":{"description":"Replaced DRAFT"},"409":{"description":"Invoice is not an unlinked draft"}},"operationId":"updateInvoiceById"},"delete":{"summary":"Delete an unlinked DRAFT (private invoices:write)","tags":["Invoices"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Deleted draft ID"},"409":{"description":"Invoice has issued status or linked records"}},"operationId":"deleteInvoiceById"}},"/api/v1/invoices":{"get":{"summary":"List client invoices (private invoices:read scope)","description":"Tenant-scoped stable pagination. page/limit, status, clientId, currency and search filters; invalid filters return 400. Money uses exact four-decimal strings. No private notes, provider credentials or payment URLs.","tags":["Invoices"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"maximum":10000,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"in":"query","name":"status","schema":{"type":"string","enum":["DRAFT","PENDING","PARTIALLY_PAID","PAID","OVERDUE","CANCELLED"]}},{"in":"query","name":"clientId","schema":{"type":"integer","minimum":1}},{"in":"query","name":"currency","schema":{"type":"string","pattern":"^[A-Z]{3}$"}},{"in":"query","name":"search","schema":{"type":"string","maxLength":80}}],"responses":{"200":{"description":"success/data with invoices and page/limit/total/totalPages pagination"},"400":{"description":"Invalid filters"},"401":{"description":"Invalid or public key"},"403":{"description":"Missing invoices:read or inactive finance/invoices"}},"operationId":"listInvoices"},"post":{"summary":"Create a draft (private invoices:write scope)","description":"currencyId and items are required. Each item has name, integer quantity and decimal-string unitPrice; optional itemId, description, setupFee and tax. Optional clientId/projectId and YYYY-MM-DD issueDate/dueDate. Unknown fields including organizationId/status/total/actor/contractId are rejected. Read scope is independent. Invoice limits apply. No payment or fiscal issuance.","tags":["Invoices"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceApiDraft"}}}},"responses":{"201":{"description":"Created DRAFT"},"400":{"description":"Invalid body or foreign reference"},"403":{"description":"Scope/module/limit refusal"}},"operationId":"createInvoice"}},"/api/v1/insights/kpis":{"get":{"summary":"List the KPIs this organization collects","tags":["Insights"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"KPI keys with unit","direction":null,"breakdowns and collection start":null}},"operationId":"listInsightKpis"}},"/api/v1/insights/kpis/{key}/values":{"get":{"summary":"Daily values of one KPI","description":"`from` / `to` (YYYY-MM-DD, inclusive, at most 366 days) default to the last 30 days. `dimension` defaults to the organization-wide total; e.g. `department:3`.","tags":["Insights"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"from","schema":{"type":"string","format":"date"}},{"in":"query","name":"to","schema":{"type":"string","format":"date"}},{"in":"query","name":"dimension","schema":{"type":"string"}}],"responses":{"200":{"description":"The series"},"404":{"description":"Unknown","not collected or not available":null}},"operationId":"getInsightKpiValueByKey"}},"/api/v1/insights/targets":{"get":{"summary":"Targets set on the KPIs this organization collects","tags":["Insights"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"kpiKey","schema":{"type":"string"}}],"responses":{"200":{"description":"Targets"},"404":{"description":"Unknown","not collected or not available KPI":null}},"operationId":"listInsightTargets"}},"/api/v1/video-tutorials/refresh":{"post":{"summary":"Check video tutorials after a deploy","description":"Deploy hook for living video tutorials. Call it from your deployment pipeline after a\nrelease: each matching tutorial gets a drift check that replays its steps against your\napp (never the steps that save data). When the screens changed, a new draft version is\nproduced for review; when a step can no longer be found, the tutorial is re-recorded\nautomatically and flagged as broken if that fails. Nothing already published changes\nuntil someone publishes the new version.\n\nSend exactly one of `targetId` (every tutorial of that app whose refresh policy is\n\"on deploy\" or \"scheduled\") or `tutorialIds`. Tutorials with a manual refresh policy\nare never checked and come back in `skipped`. A tutorial whose check is already\nrunning is not checked twice — its running check is returned with `enqueued: false`.\n\nExample:\n\n```bash\ncurl -X POST \"$BASEOS_URL/api/v1/video-tutorials/refresh\" \\\n  -H \"Authorization: Bearer $BASEOS_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"targetId\": 12}'\n```\n","tags":["Video Tutorials"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","required":["targetId"],"properties":{"targetId":{"type":"integer","description":"The app (video tutorial target) that was just deployed."}}},{"type":"object","required":["tutorialIds"],"properties":{"tutorialIds":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"integer"}}}}]}}}},"responses":{"202":{"description":"Checks accepted. They run in the background; results appear on each tutorial.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"queued":{"type":"array","items":{"type":"object","properties":{"tutorialId":{"type":"integer"},"runId":{"type":"integer"},"enqueued":{"type":"boolean","description":"false when a check of this tutorial was already running."}}}},"skipped":{"type":"array","items":{"type":"object","properties":{"tutorialId":{"type":"integer"},"reason":{"type":"string","enum":["not_found","manual_policy","archived","no_ready_version","target_inactive","unavailable"]}}}}}}}}}}},"400":{"description":"Invalid body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Tutorial refresh is not available for this organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Target not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"createVideoTutorialRefresh"}},"/api/v1/webhooks/{id}":{"get":{"summary":"Get one webhook subscription","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"The webhook endpoint","without its secret":null},"401":{"description":"Missing or invalid API key"},"404":{"description":"No such webhook in this organization, or one added in Settings → Webhooks (not reachable with an API key)"}},"operationId":"getWebhookById"},"delete":{"summary":"Unsubscribe (delete a webhook endpoint)","description":"Deliveries to this endpoint stop immediately. Only endpoints created through this API can be deleted with an API key; one added in Settings → Webhooks answers 404, like one that was already removed - integration platforms can treat that as done.","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Deleted"},"401":{"description":"Missing or invalid API key"},"404":{"description":"No such webhook in this organization"}},"operationId":"deleteWebhookById"}},"/api/v1/webhooks":{"get":{"summary":"List webhook subscriptions","description":"The organization's webhook endpoints that were created through this API. Endpoints added in Settings → Webhooks are not listed (and cannot be read or deleted with an API key). Secrets are never listed.","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"The organization's webhook endpoints"},"401":{"description":"Missing or invalid API key"}},"operationId":"listWebhooks"},"post":{"summary":"Subscribe a URL to webhook events (REST hook)","description":"Creates an outbound webhook endpoint, exactly as adding one in\nSettings → Webhooks does, and returns its signing secret once.\nIntegration platforms call this when a flow is switched on and\nDELETE /api/v1/webhooks/{id} when it is switched off.\n","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhookSubscriptionRequest"}}}},"responses":{"201":{"description":"Subscribed. The body carries the webhook with its secret."},"400":{"description":"Missing url or events","an unknown event":null,"or a URL that is not https/public":null},"401":{"description":"Missing or invalid API key"},"409":{"description":"The organization reached its endpoint ceiling"}},"operationId":"createWebhook"}},"/api/v1/ads/accounts":{"get":{"summary":"List connected ad accounts","description":"Connected Meta / Google Ads accounts with sync status. Tokens are never exposed. Requires the `ads:read` scope on a secret key.\n","tags":["Ads"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the ads:read scope":null}},"operationId":"listAdAccounts"}},"/api/v1/ads/campaigns":{"get":{"summary":"List ad campaigns","description":"Synced campaigns, most recently seen first. Read-only: budgets and status are changed in the product. Requires `ads:read`.\n","tags":["Ads"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"accountId","schema":{"type":"integer"}},{"in":"query","name":"provider","schema":{"type":"string","enum":["META","GOOGLE"]}},{"in":"query","name":"status","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the ads:read scope":null}},"operationId":"listAdCampaigns"}},"/api/v1/ads/campaigns/{id}":{"get":{"summary":"Get an ad campaign with totals","description":"One campaign and its platform-reported totals (per currency) for the `from`/`to` window (default last 30 days, max 186). Requires `ads:read`.\n","tags":["Ads"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}},{"in":"query","name":"from","schema":{"type":"string","format":"date"}},{"in":"query","name":"to","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the ads:read scope":null},"404":{"description":"Not found"}},"operationId":"getAdCampaignById"}},"/api/v1/ads/insights":{"get":{"summary":"Daily campaign metrics","description":"Campaign-level daily impressions, clicks, spend and platform conversions for a window of at most 93 days (default last 30), with totals per campaign and per currency (money is never summed across currencies). Requires `ads:read`.\n","tags":["Ads"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"from","schema":{"type":"string","format":"date"}},{"in":"query","name":"to","schema":{"type":"string","format":"date"}},{"in":"query","name":"campaignId","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the ads:read scope":null}},"operationId":"listAdInsights"}},"/api/v1/conversations":{"get":{"summary":"List inbox conversations","description":"Customer threads of the omnichannel inbox, most recently updated first. Read-only: there is no send endpoint. Requires `conversations:read`.\n","tags":["Conversations"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"status","schema":{"type":"string","enum":["OPEN","AWAITING_AGENT","HUMAN_HANDOFF","CLOSED"]}},{"in":"query","name":"channel","schema":{"type":"string","enum":["WHATSAPP","MESSENGER","INSTAGRAM","WEBCHAT","TELEGRAM","EMAIL"]}},{"in":"query","name":"contactId","schema":{"type":"integer"}},{"in":"query","name":"updatedSince","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the conversations:read scope":null}},"operationId":"listConversations"}},"/api/v1/conversations/{id}":{"get":{"summary":"Get an inbox conversation","description":"One thread. Requires `conversations:read`.\n","tags":["Conversations"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the conversations:read scope":null},"404":{"description":"Not found"}},"operationId":"getConversationById"}},"/api/v1/conversations/{id}/messages":{"get":{"summary":"List messages of a conversation","description":"Messages oldest first; deleted messages are never returned and internal notes only with `includeNotes=true`. Requires `conversations:read`.\n","tags":["Conversations"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"includeNotes","schema":{"type":"boolean"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the conversations:read scope":null},"404":{"description":"Not found"}},"operationId":"getConversationMessageById"}},"/api/v1/dam/folders":{"get":{"summary":"List media folders","description":"Every folder of the media library (flat, with parentId). Requires `dam:read`.\n","tags":["Media library"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the dam:read scope":null}},"operationId":"listDamFolders"}},"/api/v1/dam/assets":{"get":{"summary":"List media assets","description":"Assets of the media library, most recently updated first. The storage key is never exposed. Requires `dam:read`.\n","tags":["Media library"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"folderId","schema":{"type":"integer"}},{"in":"query","name":"status","schema":{"type":"string","enum":["DRAFT","IN_REVIEW","APPROVED","PUBLISHED","REJECTED","ARCHIVED"]}},{"in":"query","name":"tag","schema":{"type":"string"}},{"in":"query","name":"name","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the dam:read scope":null}},"operationId":"listDamAssets"}},"/api/v1/dam/assets/{id}":{"get":{"summary":"Get a media asset","description":"One asset with a short-lived signed `downloadUrl`. Requires `dam:read`.\n","tags":["Media library"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the dam:read scope":null},"404":{"description":"Not found"}},"operationId":"getDamAssetById"},"patch":{"summary":"Update asset name and tags","description":"Renames the asset and/or replaces its tags. Status, sharing and the file itself are refused by name (422): they are changed in the product. Requires `dam:write`.\n","tags":["Media library"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":255},"tags":{"type":"array","maxItems":50,"items":{"type":"string","maxLength":64}}}}}}},"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the dam:write scope":null},"404":{"description":"Not found"},"422":{"description":"A field that only the product may change"}},"operationId":"updateDamAssetById"}},"/api/v1/demo-rooms":{"get":{"summary":"List demo rooms","description":"Demo rooms with their session counts. Requires `demo-rooms:read`.\n","tags":["Demo rooms"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"status","schema":{"type":"string","enum":["DRAFT","PUBLISHED","ARCHIVED"]}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the demo-rooms:read scope":null}},"operationId":"listDemoRooms"},"post":{"summary":"Create a draft demo room","description":"Creates a DRAFT room with a title. Building and publishing happen in the product; `status`/`publish` are refused (422). Requires `demo-rooms:write`.\n","tags":["Demo rooms"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title"],"properties":{"title":{"type":"string","maxLength":200}}}}}},"responses":{"201":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the demo-rooms:write scope":null},"422":{"description":"Refused (a publish claim","or the title rules)":null}},"operationId":"createDemoRoom"}},"/api/v1/demo-rooms/{id}":{"get":{"summary":"Get a demo room","description":"One demo room summary. Requires `demo-rooms:read`.\n","tags":["Demo rooms"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the demo-rooms:read scope":null},"404":{"description":"Not found"}},"operationId":"getDemoRoomById"}},"/api/v1/digital-products":{"get":{"summary":"List digital products","description":"Products (downloads and courses) with their catalog name. Requires `digital-products:read`.\n","tags":["Digital products"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"status","schema":{"type":"string","enum":["DRAFT","PUBLISHED","ARCHIVED"]}},{"in":"query","name":"kind","schema":{"type":"string","enum":["DOWNLOAD","COURSE"]}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the digital-products:read scope":null}},"operationId":"listDigitalProducts"}},"/api/v1/digital-products/{id}":{"get":{"summary":"Get a digital product","description":"One product with its file list and course outline. File contents, storage keys and lesson bodies are never exposed. Requires `digital-products:read`.\n","tags":["Digital products"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the digital-products:read scope":null},"404":{"description":"Not found"}},"operationId":"getDigitalProductById"}},"/api/v1/digital-products/{id}/deliveries":{"get":{"summary":"Delivery log of a digital product","description":"Who opened or downloaded which file from the client portal, newest first. Requires `digital-products:read`.\n","tags":["Digital products"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}},{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"clientId","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the digital-products:read scope":null},"404":{"description":"Not found"}},"operationId":"getDigitalProductDeliveryById"}},"/api/v1/partners/enrollment":{"get":{"summary":"Partner enrollment","description":"The organization's partner program status and terms. Requires `partners:read`.\n","tags":["Partners"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the partners:read scope":null}},"operationId":"listPartnerEnrollment"}},"/api/v1/partners/referrals":{"get":{"summary":"List partner referrals","description":"Prospect workspaces this partner prepared, newest first. Claim tokens are never exposed. Requires `partners:read`.\n","tags":["Partners"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"status","schema":{"type":"string","enum":["PROVISIONING","INCUBATING","ACTIVE","FAILED","EXPIRED","REVOKED","ENDED"]}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the partners:read scope":null}},"operationId":"listPartnerReferrals"}},"/api/v1/partners/commissions":{"get":{"summary":"List partner commissions","description":"The commission ledger, newest first, plus the balance per currency (accrued, reversed, net, paid, outstanding). Requires `partners:read`.\n","tags":["Partners"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the partners:read scope":null}},"operationId":"listPartnerCommissions"}},"/api/v1/partners/payouts":{"get":{"summary":"List partner payouts","description":"Payouts recorded to this partner, newest first. Requires `partners:read`.\n","tags":["Partners"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the partners:read scope":null}},"operationId":"listPartnerPayouts"}},"/api/v1/social/brands":{"get":{"summary":"List social brands","description":"Unarchived brands of the social publishing module. Requires `social:read`.\n","tags":["Social"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the social:read scope":null}},"operationId":"listSocialBrands"}},"/api/v1/social/accounts":{"get":{"summary":"List connected social profiles","description":"Connected profiles per brand. Tokens are never exposed. Requires `social:read`.\n","tags":["Social"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"brandId","schema":{"type":"string"}},{"in":"query","name":"network","schema":{"type":"string","enum":["INSTAGRAM","FACEBOOK","TIKTOK","YOUTUBE","X","THREADS","PINTEREST","GOOGLE_BUSINESS","BLUESKY"]}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the social:read scope":null}},"operationId":"listSocialAccounts"}},"/api/v1/social/posts":{"get":{"summary":"List social posts","description":"Unarchived posts with their per-network targets and media, newest first; `from`/`to` filter by creation date. Read-only: drafting, scheduling and publishing happen in the product. Requires `social:read`.\n","tags":["Social"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"brandId","schema":{"type":"string"}},{"in":"query","name":"status","schema":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","SCHEDULED","PUBLISHING","AWAITING_MANUAL","PUBLISHED","PARTIALLY_PUBLISHED","FAILED","CANCELED"]}},{"in":"query","name":"from","schema":{"type":"string","format":"date"}},{"in":"query","name":"to","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the social:read scope":null}},"operationId":"listSocialPosts"}},"/api/v1/social/posts/{id}":{"get":{"summary":"Get a social post","description":"One post with targets and media. Requires `social:read`.\n","tags":["Social"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the social:read scope":null},"404":{"description":"Not found"}},"operationId":"getSocialPostById"}},"/api/v1/social/calendar":{"get":{"summary":"Social publishing calendar","description":"One entry per post and network with the moment it is planned or was published, for a window of at most 92 days (default the next 31 days). Requires `social:read`.\n","tags":["Social"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"brandId","schema":{"type":"string"}},{"in":"query","name":"from","schema":{"type":"string","format":"date"}},{"in":"query","name":"to","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the social:read scope":null}},"operationId":"listSocialCalendar"}},"/api/v1/video-studio/videos":{"get":{"summary":"List Video Studio videos","description":"Videos, newest first. Requires `video-studio:read`.\n","tags":["Video Studio"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"status","schema":{"type":"string","enum":["DRAFTING","IN_REVIEW","APPROVED","RENDERING","READY","FAILED","ARCHIVED"]}},{"in":"query","name":"kind","schema":{"type":"string","enum":["PROMO","LAUNCH","EXPLAINER"]}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the video-studio:read scope":null}},"operationId":"listVideoStudioVideos"}},"/api/v1/video-studio/videos/{id}":{"get":{"summary":"Get a Video Studio video","description":"One video with its versions and renders. Read the rendered files through `/api/v1/dam/assets/{id}`. Requires `video-studio:read`.\n","tags":["Video Studio"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the video-studio:read scope":null},"404":{"description":"Not found"}},"operationId":"getVideoStudioVideoById"}},"/api/v1/video-studio/videos/{id}/renders":{"get":{"summary":"List renders of a video","description":"Renders (aspect, language, status, DAM asset ids), newest first. Requires `video-studio:read`.\n","tags":["Video Studio"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Invalid parameter or body (the message names it)"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the video-studio:read scope":null},"404":{"description":"Not found"}},"operationId":"getVideoStudioVideoRenderById"}},"/api/v1/newsletters":{"get":{"summary":"List newsletters","description":"The organization's newsletters (lists), newest first, with their confirmed and pending subscriber counts. Requires the `newsletters:read` scope on a secret key. Subscriber addresses are never exposed.\n","tags":["Newsletters"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"A page of newsletters"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the newsletters:read scope":null}},"operationId":"listNewsletters"}},"/api/v1/newsletters/{id}":{"get":{"summary":"Get a newsletter","description":"One newsletter with its subscriber counts. Requires `newsletters:read`.","tags":["Newsletters"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"The newsletter"},"404":{"description":"Newsletter not found"}},"operationId":"getNewsletterById"}},"/api/v1/newsletters/{id}/issues":{"get":{"summary":"List a newsletter's issues","description":"Issues newest first, optionally filtered by `status`. Requires `newsletters:read`.","tags":["Newsletters"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}},{"in":"query","name":"status","schema":{"type":"string","enum":["DRAFT","SCHEDULED","SENDING","SENT","FAILED","CANCELED"]}},{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"A page of issues"},"404":{"description":"Newsletter not found"}},"operationId":"getNewsletterIssueById"},"post":{"summary":"Create a DRAFT issue","description":"Creates a DRAFT issue (and its e-mail template) with the next issue number. Requires `newsletters:write`. Scheduling and sending are not available over the API: a person sends from the product. A body with `send`, `sendNow`, `scheduledAt`, `schedule` or `publish` is refused with code `SEND_NOT_ALLOWED`.\n","tags":["Newsletters"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title"],"properties":{"title":{"type":"string","maxLength":255},"segmentId":{"type":"integer","description":"A dynamic lead segment to narrow the audience"}}}}}},"responses":{"201":{"description":"The draft issue"},"400":{"description":"Invalid body"},"404":{"description":"Newsletter not found or inactive"}},"operationId":"createNewsletterIssueById"}},"/api/v1/newsletters/{id}/subscribers":{"post":{"summary":"Add a subscriber (double opt-in)","description":"Starts a subscription the address must confirm: BaseOS e-mails a confirmation link and the subscriber joins the list only when they click it (`newsletter.subscribed` fires then). Requires `newsletters:write`. Consent cannot be asserted over the API — a body with `status`, `confirmed`, `optIn`, `consent`… is refused with code `CONSENT_NOT_ASSERTABLE`. A suppressed address is refused (409).\n","tags":["Newsletters"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"},"name":{"type":"string","maxLength":160},"locale":{"type":"string","example":"pt-BR"},"referrerUrl":{"type":"string","format":"uri"}}}}}},"responses":{"200":{"description":"Already a confirmed subscriber"},"202":{"description":"Confirmation e-mail sent (or already pending) — status pending_confirmation"},"400":{"description":"Invalid body"},"404":{"description":"Newsletter not found or inactive"},"409":{"description":"The address is suppressed for e-mail"},"503":{"description":"The confirmation e-mail could not be sent; retry"}},"operationId":"createNewsletterSubscriberById"}},"/api/v1/projects/{projectId}/tasks":{"get":{"summary":"List tasks for a project","description":"Retrieve tasks for a project with optional filters by status, assignee, and search term.","tags":["Tasks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"projectId","required":true,"schema":{"type":"integer"}},{"in":"query","name":"statusId","schema":{"type":"integer"}},{"in":"query","name":"assigneeMembershipId","schema":{"type":"integer"}},{"in":"query","name":"search","schema":{"type":"string"}},{"in":"query","name":"archived","description":"Whether archived tasks are included. Defaults to `live`.","schema":{"type":"string","enum":["live","archived","all"]}}],"responses":{"200":{"description":"Successful response with tasks list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TasksListResponse"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getProjectTaskByProjectid"},"post":{"summary":"Create a task in a project","description":"Create a new task in the specified project. Title is required.","tags":["Tasks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"projectId","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaskRequest"}}}},"responses":{"200":{"description":"Task created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"createProjectTaskByProjectid"}},"/api/v1/projects/{id}":{"get":{"summary":"Get project by ID","description":"Retrieve a single project by its ID for the authenticated organization.","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Project retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectResponse"}}}},"400":{"description":"Invalid project ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getProjectById"},"put":{"summary":"Update project","description":"Update an existing project. All fields are optional.","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProjectRequest"}}}},"responses":{"200":{"description":"Project updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"updateProjectById"},"delete":{"summary":"Delete project","description":"Delete a project. Projects with associated tickets cannot be deleted.","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Project deleted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"deleteProjectById"}},"/api/v1/projects":{"get":{"summary":"List projects with pagination and filters","description":"Retrieve a paginated list of projects for the authenticated organization. Supports filtering by status, client, type, and search term.","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":10}},{"in":"query","name":"status","schema":{"$ref":"#/components/schemas/ProjectStatus"}},{"in":"query","name":"clientId","schema":{"type":"integer"}},{"in":"query","name":"type","schema":{"$ref":"#/components/schemas/ProjectType"}},{"in":"query","name":"search","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response with projects list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectsListResponse"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"listProjects"},"post":{"summary":"Create a new project","description":"Create a project in the authenticated organization. Name is required.","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProjectRequest"}}}},"responses":{"200":{"description":"Project created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"createProject"}},"/api/v1/tasks/{id}":{"get":{"summary":"Get task by ID","description":"Retrieve a single task by its ID for the authenticated organization.","tags":["Tasks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Task retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponse"}}}},"400":{"description":"Invalid task ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getTaskById"},"put":{"summary":"Update task","description":"Update an existing task. All fields are optional.","tags":["Tasks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTaskRequest"}}}},"responses":{"200":{"description":"Task updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"updateTaskById"},"delete":{"summary":"Delete task","description":"Soft-delete a task and its subtasks by moving them to trash.","tags":["Tasks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Task deleted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"deleteTaskById"}},"/api/v1/tickets/{id}/messages":{"post":{"summary":"Add message to ticket","description":"Add a public support reply to an existing ticket (it is sent to the customer — it is not an internal note). The ticket moves to AWAITING_CUSTOMER when its workflow allows it, the reply dates are stamped, and the reply is e-mailed to the ticket's e-mail address, or else to the requester contact's or the client's. Content is stored as TEXT; `type` is accepted for compatibility. Canceled and merged tickets refuse messages (400); trashed tickets return 404.","tags":["Tickets"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Ticket ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddTicketMessageRequest"},"example":{"content":"<p>We found the root cause and applied a fix. Please confirm.</p>","type":"TEXT"}}}},"responses":{"200":{"description":"Message added successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TicketMessageResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Ticket not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"createTicketMessageById"}},"/api/v1/tickets/{id}":{"get":{"summary":"Get ticket by ID","description":"Retrieve a single ticket by its ID, including its message history, relations, and assignee information.","tags":["Tickets"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Ticket ID"}],"responses":{"200":{"description":"Ticket retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TicketResponse"}}}},"400":{"description":"Invalid ticket ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Ticket not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getTicketById"},"put":{"summary":"Update ticket","description":"Update an existing ticket. Supports subject, department, priority, status, client, email, and assignment changes. Status transitions are validated against the ticket state machine before anything is written; an invalid transition returns 400 with `allowedTransitions`. An assignment applies its automatic status change first (e.g. OPEN → ASSIGNED) and the requested status is validated from there. Every change is recorded in the ticket's audit trail.","tags":["Tickets"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Ticket ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTicketRequest"},"example":{"status":"IN_PROGRESS","priority":"HIGH","departmentId":2,"assignedToUserMembershipId":17}}}},"responses":{"200":{"description":"Ticket updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TicketResponse"}}}},"400":{"description":"Invalid request data, or a status transition the ticket workflow does not allow (the body then includes `allowedTransitions`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Ticket or related resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"updateTicketById"},"delete":{"summary":"Delete ticket","description":"Move a ticket to the trash. Requires an API key with the opt-in `tickets:delete` scope (legacy keys without scopes do not hold it). Deletion is reversible for 30 days (`restorableUntil`); after that the ticket is permanently removed. Trashed tickets are no longer returned by any endpoint.","tags":["Tickets"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"},"description":"Ticket ID"}],"responses":{"200":{"description":"Ticket deleted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteTicketResponse"}}}},"400":{"description":"Invalid ticket ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key lacks the opt-in `tickets:delete` scope (grantable only by a manager or admin)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Ticket not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"deleteTicketById"}},"/api/v1/tickets":{"get":{"summary":"List tickets with pagination and filters","description":"Retrieve a paginated list of tickets for the authenticated organization. Supports filtering by status, priority, department, client, assignment, and search term.","tags":["Tickets"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1},"description":"Page number for pagination"},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"description":"Number of items per page"},{"in":"query","name":"status","schema":{"$ref":"#/components/schemas/SupportTicketStatus"},"description":"Filter by ticket status"},{"in":"query","name":"priority","schema":{"$ref":"#/components/schemas/TicketPriority"},"description":"Filter by ticket priority"},{"in":"query","name":"departmentId","schema":{"type":"integer"},"description":"Filter by department ID"},{"in":"query","name":"clientId","schema":{"type":"integer"},"description":"Filter by client ID"},{"in":"query","name":"assignedToUserMembershipId","schema":{"oneOf":[{"type":"integer"},{"type":"string","enum":["null"]}]},"description":"Filter by assigned membership ID. Use `null` to return unassigned tickets."},{"in":"query","name":"search","schema":{"type":"string"},"description":"Search in ticket subject, email, and message"}],"responses":{"200":{"description":"Successful response with tickets list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TicketsListResponse"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"listTickets"},"post":{"summary":"Create a new ticket","description":"Create a new support ticket in the authenticated organization with an initial message written by the requester. You must provide a client or an email. If `projectId` is provided and `clientId` is omitted, the project client is used automatically. When `departmentId` is omitted the organization's routing rules pick the department. The response includes `number`, the public per-organization ticket number. Creation beyond the plan's ticket ceiling is accepted and metered, never refused.","tags":["Tickets"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTicketRequest"},"example":{"subject":"Integration issue with billing webhook","message":"<p>The webhook is returning 500 for paid invoices.</p>","priority":"HIGH","departmentId":2,"clientId":14,"projectId":8}}}},"responses":{"200":{"description":"Ticket created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TicketResponse"}}}},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Related resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"createTicket"}},"/api/v1/people":{"get":{"summary":"List people (the directory, members only)","tags":["People"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"teamId","schema":{"type":"integer"}},{"in":"query","name":"managerProfileId","schema":{"type":"integer"}},{"in":"query","name":"seniority","schema":{"type":"string"}},{"in":"query","name":"employmentType","schema":{"type":"string"}},{"in":"query","name":"search","schema":{"type":"string"}},{"in":"query","name":"includeArchived","schema":{"type":"boolean"}}],"responses":{"200":{"description":"People and pagination"},"400":{"description":"Invalid parameter"},"401":{"description":"Unauthorized"},"403":{"description":"Module","feature or scope missing":null}},"operationId":"listPeople"},"post":{"summary":"Create the profile of an existing member (idempotent)","description":"Body {membershipId}. Returns 201 when created, 200 when the profile already existed.","tags":["People"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Already existed"},"201":{"description":"Created"},"400":{"description":"Invalid body"},"404":{"description":"Member not found"}},"operationId":"createPeople"}},"/api/v1/people/{id}":{"get":{"summary":"Read one person","tags":["People"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"The person"},"404":{"description":"Not found"}},"operationId":"getPeopleById"},"patch":{"summary":"Update a person's profile (partial)","description":"Writable fields — displayName, jobTitle, seniority, employmentType, teamId, managerProfileId, timeZone, startedOn, endedOn, utilizationTarget, billableByDefault, color. Anything else is refused.","tags":["People"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Updated person"},"400":{"description":"Invalid body"},"404":{"description":"Not found"}},"operationId":"updatePeopleById"}},"/api/v1/roadmap":{"get":{"summary":"List feature requests","description":"Feature requests of the roadmap. Requires `product-hub:read`.","tags":["Roadmap"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"status","schema":{"type":"string","enum":["PENDING_REVIEW","APPROVED","IN_PROGRESS","COMPLETED","REJECTED","MERGED"]}},{"in":"query","name":"statusId","schema":{"type":"integer"}},{"in":"query","name":"categoryId","schema":{"type":"integer"}},{"in":"query","name":"search","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of feature requests"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null}},"operationId":"listRoadmap"},"post":{"summary":"Create a feature request","description":"Creates a request in the review queue (PENDING_REVIEW); approving it stays in the product. Requires `product-hub:write`.","tags":["Roadmap"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title","description","statusId"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"statusId":{"type":"integer"},"categoryId":{"type":"integer","nullable":true}}}}}},"responses":{"201":{"description":"The created request"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null},"404":{"description":"Not found"}},"operationId":"createRoadmap"}},"/api/v1/roadmap/statuses":{"get":{"summary":"List roadmap columns","description":"The roadmap columns (a request's statusId). Requires `product-hub:read`.","tags":["Roadmap"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"The columns"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null}},"operationId":"listRoadmapStatuses"}},"/api/v1/roadmap/categories":{"get":{"summary":"List roadmap categories","description":"Requires `product-hub:read`.","tags":["Roadmap"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"The categories"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null}},"operationId":"listRoadmapCategories"}},"/api/v1/roadmap/{id}":{"get":{"summary":"Get a feature request","description":"One request with its public comments; visitor ids and internal comments are never returned. Requires `product-hub:read`.","tags":["Roadmap"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"The request"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null},"404":{"description":"Not found"}},"operationId":"getRoadmapById"},"patch":{"summary":"Update a feature request","description":"Title, description, column (statusId) and category. The lifecycle status is not writable. Requires `product-hub:write`.","tags":["Roadmap"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":"string"},"statusId":{"type":"integer"},"categoryId":{"type":"integer","nullable":true}}}}}},"responses":{"200":{"description":"The updated request"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null},"404":{"description":"Not found"}},"operationId":"updateRoadmapById"}},"/api/v1/changelog":{"get":{"summary":"List changelog entries","description":"Requires `product-hub:read`.","tags":["Changelog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"status","schema":{"type":"string","enum":["DRAFT","SCHEDULED","PUBLISHED","ARCHIVED"]}},{"in":"query","name":"labelId","schema":{"type":"integer"}},{"in":"query","name":"search","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of entries"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null}},"operationId":"listChangelog"},"post":{"summary":"Create a changelog draft","description":"Creates a DRAFT entry; publishing and scheduling stay in the product. Requires `product-hub:write`.","tags":["Changelog"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["translations"],"properties":{"version":{"type":"string","nullable":true},"labelIds":{"type":"array","items":{"type":"integer"}},"translations":{"type":"array","items":{"type":"object","required":["locale","title","content"],"properties":{"locale":{"type":"string"},"title":{"type":"string"},"content":{"type":"string"}}}}}}}}},"responses":{"201":{"description":"The created draft"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null},"404":{"description":"Not found"}},"operationId":"createChangelog"}},"/api/v1/changelog/labels":{"get":{"summary":"List changelog labels","description":"Requires `product-hub:read`.","tags":["Changelog"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"The labels"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null}},"operationId":"listChangelogLabels"}},"/api/v1/changelog/{id}":{"get":{"summary":"Get a changelog entry","description":"Requires `product-hub:read`.","tags":["Changelog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"The entry"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null},"404":{"description":"Not found"}},"operationId":"getChangelogById"},"patch":{"summary":"Update a changelog draft","description":"Version, translations and labels of a DRAFT entry; a published entry is refused (400). Requires `product-hub:write`.","tags":["Changelog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"string","nullable":true},"labelIds":{"type":"array","items":{"type":"integer"}},"translations":{"type":"array","items":{"type":"object"}}}}}}},"responses":{"200":{"description":"The updated entry"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null},"404":{"description":"Not found"}},"operationId":"updateChangelogById"}},"/api/v1/wiki":{"get":{"summary":"List wiki articles","description":"Articles with their translations; the author is a name only. Requires `product-hub:read`.","tags":["Wiki"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"status","schema":{"type":"string","enum":["DRAFT","PUBLISHED","ARCHIVED"]}},{"in":"query","name":"categoryId","schema":{"type":"integer"}},{"in":"query","name":"search","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of articles"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null}},"operationId":"listWiki"}},"/api/v1/wiki/categories":{"get":{"summary":"List wiki categories","description":"Requires `product-hub:read`.","tags":["Wiki"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"The categories"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null}},"operationId":"listWikiCategories"}},"/api/v1/wiki/{id}":{"get":{"summary":"Get a wiki article","description":"Requires `product-hub:read`.","tags":["Wiki"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"The article"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null},"404":{"description":"Not found"}},"operationId":"getWikiById"},"patch":{"summary":"Update a wiki article","description":"Category, featured flag and translations of an existing article. Its status is not writable and articles are not created over the API. Requires `product-hub:write`.","tags":["Wiki"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"categoryId":{"type":"integer","nullable":true},"isFeatured":{"type":"boolean"},"translations":{"type":"array","items":{"type":"object","required":["languageCode","title","content"],"properties":{"languageCode":{"type":"string"},"title":{"type":"string"},"content":{"type":"string"},"contentFormat":{"type":"string","enum":["HTML","MARKDOWN"]},"seoTitle":{"type":"string","nullable":true},"seoDesc":{"type":"string","nullable":true}}}}}}}}},"responses":{"200":{"description":"The updated article"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or missing API key"},"403":{"description":"The resource is not available","or the key lacks the scope":null},"404":{"description":"Not found"}},"operationId":"updateWikiById"}},"/api/v1/allocations":{"get":{"summary":"List allocations overlapping a window","description":"`from` and `to` (YYYY-MM-DD, inclusive, at most 366 days) are required.","tags":["Resourcing"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"from","required":true,"schema":{"type":"string","format":"date"}},{"in":"query","name":"to","required":true,"schema":{"type":"string","format":"date"}},{"in":"query","name":"personProfileId","schema":{"type":"integer"}},{"in":"query","name":"projectId","schema":{"type":"integer"}},{"in":"query","name":"status","schema":{"type":"string","enum":["CONFIRMED","TENTATIVE"]}},{"in":"query","name":"page","schema":{"type":"integer"}},{"in":"query","name":"limit","schema":{"type":"integer"}}],"responses":{"200":{"description":"Allocations and pagination"}},"operationId":"listAllocations"},"post":{"summary":"Book a person on a project, client or internal work","description":"Body: personProfileId, target (PROJECT | CLIENT | INTERNAL), projectId / clientId / internalLabel, optional taskId, startsOn, endsOn, hours, distribution (PER_DAY | TOTAL), status (CONFIRMED | TENTATIVE), billable, note. The answer lists overloaded days, never refuses on them.","tags":["Resourcing"],"security":[{"ApiKeyAuth":[]}],"responses":{"201":{"description":"Created"},"400":{"description":"Invalid body"}},"operationId":"createAllocation"}},"/api/v1/allocations/{id}":{"get":{"summary":"Read one allocation","tags":["Resourcing"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"The allocation"},"404":{"description":"Not found"}},"operationId":"getAllocationById"},"put":{"summary":"Replace an allocation (full body, same shape as POST)","tags":["Resourcing"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Updated"},"404":{"description":"Not found"}},"operationId":"updateAllocationById"},"delete":{"summary":"Remove an allocation","tags":["Resourcing"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Removed"},"404":{"description":"Not found"}},"operationId":"deleteAllocationById"}},"/api/v1/time-entries":{"get":{"summary":"List logged hours in a window","description":"`from` and `to` (YYYY-MM-DD, inclusive, at most 92 days) are required. Deleted entries are never listed.","tags":["Resourcing"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"in":"query","name":"from","required":true,"schema":{"type":"string","format":"date"}},{"in":"query","name":"to","required":true,"schema":{"type":"string","format":"date"}},{"in":"query","name":"membershipId","schema":{"type":"integer"}},{"in":"query","name":"taskId","schema":{"type":"integer"}},{"in":"query","name":"projectId","schema":{"type":"integer"}},{"in":"query","name":"billable","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Time entries and pagination"}},"operationId":"listTimeEntries"},"post":{"summary":"Log hours against a task for a member","description":"Body: taskId, membershipId (whose hour — required), hours (0 < h ≤ 24), workedOn (YYYY-MM-DD, not in the future), note, billable. A locked week, an archived task or an unavailable service is refused with the product's own sentence.","tags":["Resourcing"],"security":[{"ApiKeyAuth":[]}],"responses":{"201":{"description":"Logged"},"400":{"description":"Invalid body or refused by the ledger"}},"operationId":"createTimeEntry"}},"/api/v1/time-entries/{id}":{"get":{"summary":"Read one logged hour","tags":["Resourcing"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"The entry"},"404":{"description":"Not found"}},"operationId":"getTimeEntryById"}}},"tags":[{"name":"Financial Accounts","description":"Manage organization accounts such as bank, cash, debt, or credit card accounts."},{"name":"Financial Transactions","description":"Create and query financial transactions for the authenticated organization."}]}