# Admin Documentation: https://docs.guidelab.co/api-reference/admin ## Endpoints [#endpoints] | Method | Endpoint | | -------- | --------------------------------------------------------------------------------------------------------------------------- | | `POST` | [Adopt an untracked Stripe subscription](/api-reference/admin/adminAdoptUntrackedProviderSubscription) | | `POST` | [Anonymize (GDPR-erase) a user](/api-reference/admin/adminAnonymizeUser) | | `GET` | [Audit Stripe subscriptions GuideLab does not track](/api-reference/admin/adminAuditOrganizationProviderSubscriptions) | | `POST` | [Authorize whole-conversation deletion as platform legal](/api-reference/admin/adminOverrideConversationDeletion) | | `DELETE` | [Clear admin viewing organization](/api-reference/admin/adminClearViewingOrg) | | `POST` | [Create organization billing portal session](/api-reference/admin/adminCreateOrganizationBillingPortal) | | `POST` | [Create organization subscription checkout session](/api-reference/admin/adminCreateOrganizationSubscriptionCheckout) | | `GET` | [Get organization by ID](/api-reference/admin/adminGetOrganization) | | `GET` | [Get user by ID](/api-reference/admin/adminGetUser) | | `GET` | [List all organizations](/api-reference/admin/adminListOrganizations) | | `GET` | [List all users](/api-reference/admin/adminListUsers) | | `GET` | [List duplicate subscription compensations](/api-reference/admin/adminListSubscriptionQuarantines) | | `GET` | [List platform billing commands requiring or retaining review](/api-reference/admin/adminListPlatformBillingCommandReviews) | | `GET` | [List platform-custody retention holds](/api-reference/admin/adminListPlatformCustodyRetentionHolds) | | `POST` | [Preview a notification template](/api-reference/admin/adminPreviewNotification) | | `POST` | [Release a platform-custody retention hold](/api-reference/admin/adminReleasePlatformCustodyRetentionHold) | | `DELETE` | [Remove a member from an organization](/api-reference/admin/adminRemoveOrganizationMember) | | `POST` | [Requeue a failed organization closure](/api-reference/admin/adminRequeueOrganizationClosure) | | `POST` | [Requeue a failed patient erasure](/api-reference/admin/adminRequeuePatientErasure) | | `POST` | [Resolve one ambiguous platform billing command](/api-reference/admin/adminResolvePlatformBillingCommandReview) | | `POST` | [Retry duplicate subscription compensation](/api-reference/admin/adminRetrySubscriptionQuarantine) | | `POST` | [Send a test notification](/api-reference/admin/adminTestNotification) | | `POST` | [Send password reset email for a user](/api-reference/admin/adminSendPasswordReset) | | `POST` | [Set admin viewing organization](/api-reference/admin/adminSetViewingOrg) | | `PUT` | [Update an organization](/api-reference/admin/adminUpdateOrganization) | --- # Ai Documentation: https://docs.guidelab.co/api-reference/ai ## Endpoints [#endpoints] | Method | Endpoint | | ------ | --------------------------------------------------------------------------------- | | `POST` | [Autocomplete a partially typed message](/api-reference/ai/autocompleteAiMessage) | | `POST` | [Generate an AI message for a conversation](/api-reference/ai/generateAiMessage) | --- # Archive Documentation: https://docs.guidelab.co/api-reference/archive ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ---------------------------------------------------------------------------- | | `POST` | [Archive a patient](/api-reference/archive/archivePatient) | | `POST` | [Archive an order](/api-reference/archive/archiveOrder) | | `GET` | [List archived orders](/api-reference/archive/listArchivedOrders) | | `GET` | [List archived patients](/api-reference/archive/listArchivedPatients) | | `POST` | [Restore an archived order](/api-reference/archive/restoreArchivedOrder) | | `POST` | [Restore an archived patient](/api-reference/archive/restoreArchivedPatient) | --- # Automations Documentation: https://docs.guidelab.co/api-reference/automations ## Endpoints [#endpoints] | Method | Endpoint | | -------- | --------------------------------------------------------------------------------- | | `POST` | [Create Automation](/api-reference/automations/createAutomation) | | `DELETE` | [Delete Automation](/api-reference/automations/deleteAutomation) | | `GET` | [Get Automation](/api-reference/automations/getAutomation) | | `GET` | [List Automation Executions](/api-reference/automations/listAutomationExecutions) | | `GET` | [List Automations](/api-reference/automations/listAutomations) | | `POST` | [Publish Automation](/api-reference/automations/publishAutomation) | | `POST` | [Run Automation](/api-reference/automations/runAutomation) | | `PATCH` | [Toggle Automation](/api-reference/automations/toggleAutomation) | | `PUT` | [Update Automation](/api-reference/automations/updateAutomation) | --- # Bundles Documentation: https://docs.guidelab.co/api-reference/bundles ## Endpoints [#endpoints] | Method | Endpoint | | -------- | --------------------------------------------------------------- | | `POST` | [Create a bundle](/api-reference/bundles/createBundle) | | `DELETE` | [Delete a bundle](/api-reference/bundles/deleteBundle) | | `GET` | [Get a bundle](/api-reference/bundles/getBundle) | | `GET` | [List bundles](/api-reference/bundles/listBundles) | | `PATCH` | [Partially update a bundle](/api-reference/bundles/patchBundle) | | `PUT` | [Update a bundle](/api-reference/bundles/updateBundle) | --- # Calendar Documentation: https://docs.guidelab.co/api-reference/calendar ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------- | | `POST` | [Create a time-off entry](/api-reference/calendar/createCalendarTimeOff) | | `DELETE` | [Deactivate a time-off entry](/api-reference/calendar/deleteCalendarTimeOff) | | `GET` | [Get a time-off entry by ID](/api-reference/calendar/getCalendarTimeOff) | | `GET` | [Get organization working days](/api-reference/calendar/getWorkingDays) | | `GET` | [List time-off entries](/api-reference/calendar/listCalendarTimeOff) | | `POST` | [Seed UK bank holidays](/api-reference/calendar/seedCalendarHolidays) | | `PUT` | [Update a time-off entry](/api-reference/calendar/updateCalendarTimeOff) | | `PUT` | [Update organization working days](/api-reference/calendar/updateWorkingDays) | --- # Categories Documentation: https://docs.guidelab.co/api-reference/categories ## Endpoints [#endpoints] | Method | Endpoint | | -------- | --------------------------------------------------------------------------------- | | `POST` | [Create a category](/api-reference/categories/createCategory) | | `DELETE` | [Delete a category](/api-reference/categories/deleteCategory) | | `DELETE` | [Delete category guide media](/api-reference/categories/deleteCategoryGuideMedia) | | `DELETE` | [Delete category image](/api-reference/categories/deleteCategoryImage) | | `GET` | [Get a category](/api-reference/categories/getCategory) | | `GET` | [Get category guide media](/api-reference/categories/getCategoryGuideMedia) | | `GET` | [Get category image](/api-reference/categories/getCategoryImage) | | `GET` | [List categories](/api-reference/categories/listCategories) | | `POST` | [Reorder categories](/api-reference/categories/reorderCategories) | | `PATCH` | [Toggle category active status](/api-reference/categories/toggleCategory) | | `PUT` | [Update a category](/api-reference/categories/updateCategory) | | `POST` | [Upload category guide media](/api-reference/categories/uploadCategoryGuideMedia) | | `POST` | [Upload category image](/api-reference/categories/uploadCategoryImage) | --- # Checkout Documentation: https://docs.guidelab.co/api-reference/checkout ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ----------------------------------------------------------------------------------- | | `POST` | [Cancel Checkout Order Payment](/api-reference/checkout/cancelCheckoutOrderPayment) | | `POST` | [Confirm Checkout Payment](/api-reference/checkout/confirmCheckoutPayment) | | `POST` | [Create Payment Intent](/api-reference/checkout/createPaymentIntent) | --- # Clients Documentation: https://docs.guidelab.co/api-reference/clients ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ----------------------------------------------------------------------------- | | `GET` | [List clinic clients (doctors) for a lab](/api-reference/clients/listClients) | --- # Clinic Documentation: https://docs.guidelab.co/api-reference/clinic ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ------------------------------------------------------------------------------ | | `GET` | [List partner labs for the clinic](/api-reference/clinic/getClinicPartnerLabs) | --- # Clinic Finances Documentation: https://docs.guidelab.co/api-reference/clinic-finances ## Endpoints [#endpoints] | Method | Endpoint | | ------ | --------------------------------------------------------------------------------------- | | `GET` | [Get Clinic Credit Note](/api-reference/clinic-finances/getClinicCreditNote) | | `GET` | [Get Clinic Finances Summary](/api-reference/clinic-finances/getClinicFinancesSummary) | | `GET` | [Get Clinic Invoice](/api-reference/clinic-finances/getClinicInvoice) | | `GET` | [Get Clinic Invoices By Order](/api-reference/clinic-finances/getClinicInvoicesByOrder) | | `GET` | [Get Clinic Statement](/api-reference/clinic-finances/getClinicStatement) | | `GET` | [Get Clinic Stripe Status](/api-reference/clinic-finances/getClinicStripeStatus) | | `GET` | [List Clinic Credit Notes](/api-reference/clinic-finances/listClinicCreditNotes) | | `GET` | [List Clinic Invoices](/api-reference/clinic-finances/listClinicInvoices) | | `GET` | [List Clinic Statements](/api-reference/clinic-finances/listClinicStatements) | --- # Clinic Locations Documentation: https://docs.guidelab.co/api-reference/clinic-locations ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------------------------ | | `POST` | [Create a clinic location](/api-reference/clinic-locations/createClinicLocation) | | `DELETE` | [Deactivate a clinic location](/api-reference/clinic-locations/deleteClinicLocation) | | `GET` | [Get a clinic location by ID](/api-reference/clinic-locations/getClinicLocation) | | `GET` | [List clinic locations](/api-reference/clinic-locations/listClinicLocations) | | `PUT` | [Update a clinic location](/api-reference/clinic-locations/updateClinicLocation) | --- # Clinic Payment Methods Documentation: https://docs.guidelab.co/api-reference/clinic-payment-methods ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ---------------------------------------------------------------------------------------------------------- | | `POST` | [Create Clinic Setup Intent](/api-reference/clinic-payment-methods/createClinicSetupIntent) | | `DELETE` | [Delete Clinic Payment Method](/api-reference/clinic-payment-methods/deleteClinicPaymentMethod) | | `POST` | [Enable clinic-owned saved-card autopay](/api-reference/clinic-payment-methods/enableClinicAutopayMandate) | | `GET` | [Get clinic autopay consent](/api-reference/clinic-payment-methods/getClinicAutopayMandate) | | `GET` | [List Clinic Payment Methods](/api-reference/clinic-payment-methods/listClinicPaymentMethods) | | `DELETE` | [Revoke clinic-owned autopay](/api-reference/clinic-payment-methods/revokeClinicAutopayMandate) | | `PUT` | [Set Default Clinic Payment Method](/api-reference/clinic-payment-methods/setDefaultClinicPaymentMethod) | --- # Company Settings Documentation: https://docs.guidelab.co/api-reference/company-settings ## Endpoints [#endpoints] | Method | Endpoint | | -------- | --------------------------------------------------------------------------------------------- | | `DELETE` | [Delete Company Cover Image](/api-reference/company-settings/deleteCompanyCoverImage) | | `DELETE` | [Delete Company Gallery Image](/api-reference/company-settings/deleteCompanyGalleryImage) | | `DELETE` | [Delete Company Logo](/api-reference/company-settings/deleteCompanyLogo) | | `GET` | [Get Company Cover Image](/api-reference/company-settings/getCompanyCoverImage) | | `GET` | [Get Company Gallery Image](/api-reference/company-settings/getCompanyGalleryImage) | | `GET` | [Get Company Logo](/api-reference/company-settings/getCompanyLogo) | | `GET` | [Get Company Settings](/api-reference/company-settings/getCompanySettings) | | `GET` | [List Company Gallery Images](/api-reference/company-settings/listCompanyGalleryImages) | | `POST` | [Reorder Company Gallery Images](/api-reference/company-settings/reorderCompanyGalleryImages) | | `PUT` | [Update Company Settings](/api-reference/company-settings/updateCompanySettings) | | `POST` | [Upload Company Cover Image](/api-reference/company-settings/uploadCompanyCoverImage) | | `POST` | [Upload Company Gallery Image](/api-reference/company-settings/uploadCompanyGalleryImage) | | `POST` | [Upload Company Logo](/api-reference/company-settings/uploadCompanyLogo) | --- # Components Documentation: https://docs.guidelab.co/api-reference/components ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------------------ | | `POST` | [Create a component](/api-reference/components/createComponent) | | `DELETE` | [Delete a component](/api-reference/components/deleteComponent) | | `GET` | [Get component settings](/api-reference/components/getComponentSettings) | | `GET` | [List components](/api-reference/components/listComponents) | | `POST` | [Reorder components](/api-reference/components/reorderComponents) | | `PUT` | [Update a component](/api-reference/components/updateComponent) | | `PUT` | [Update component settings](/api-reference/components/updateComponentSettings) | --- # Consolidations Documentation: https://docs.guidelab.co/api-reference/consolidations ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------------- | | `POST` | [Create Consolidation](/api-reference/consolidations/createConsolidation) | | `DELETE` | [Delete Consolidation](/api-reference/consolidations/deleteConsolidation) | | `POST` | [Email Consolidation](/api-reference/consolidations/emailConsolidation) | | `GET` | [Get Consolidation](/api-reference/consolidations/getConsolidation) | | `GET` | [List Consolidations](/api-reference/consolidations/listConsolidations) | --- # Conversations Documentation: https://docs.guidelab.co/api-reference/conversations ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------------------------------------------- | | `POST` | [Approve whole-conversation deletion](/api-reference/conversations/approveConversationDeletion) | | `DELETE` | [Archive a participant-owned conversation attachment](/api-reference/conversations/archiveConversationAttachment) | | `POST` | [Create a conversation](/api-reference/conversations/createConversation) | | `GET` | [Download a conversation attachment](/api-reference/conversations/getConversationAttachment) | | `POST` | [Finalize a direct conversation attachment upload](/api-reference/conversations/finalizeConversationAttachment) | | `GET` | [Get conversation by ID](/api-reference/conversations/getConversation) | | `GET` | [List conversations](/api-reference/conversations/listConversations) | | `GET` | [List messages in a conversation](/api-reference/conversations/listConversationMessages) | | `POST` | [Mark conversation as read](/api-reference/conversations/markConversationRead) | | `POST` | [Prepare a direct conversation attachment upload](/api-reference/conversations/presignConversationAttachment) | | `POST` | [Send a message in a conversation](/api-reference/conversations/sendMessage) | | `POST` | [Transcribe a voice attachment](/api-reference/conversations/transcribeConversationAttachment) | --- # Credit Notes Documentation: https://docs.guidelab.co/api-reference/credit-notes ## Endpoints [#endpoints] | Method | Endpoint | | -------- | -------------------------------------------------------------------------- | | `POST` | [Allocate Credit Note](/api-reference/credit-notes/allocateCreditNote) | | `POST` | [Create Credit Note](/api-reference/credit-notes/createCreditNote) | | `DELETE` | [Deallocate Credit Note](/api-reference/credit-notes/deallocateCreditNote) | | `POST` | [Email Credit Note](/api-reference/credit-notes/emailCreditNote) | | `GET` | [Get Credit Note](/api-reference/credit-notes/getCreditNote) | | `GET` | [List Credit Notes](/api-reference/credit-notes/listCreditNotes) | | `POST` | [Refund Credit Note](/api-reference/credit-notes/refundCreditNote) | | `DELETE` | [Void Credit Note](/api-reference/credit-notes/voidCreditNote) | --- # Dashboard Documentation: https://docs.guidelab.co/api-reference/dashboard ## Endpoints [#endpoints] | Method | Endpoint | | ------ | -------------------------------------------------------------------------------------------------------- | | `GET` | [Bootstrap all lab dashboard panels in one call](/api-reference/dashboard/getLabDashboardOverview) | | `GET` | [Get active orders by deadline](/api-reference/dashboard/getLabDashboardOperations) | | `GET` | [Get exact clinic dashboard counters](/api-reference/dashboard/getClinicDashboardStats) | | `GET` | [Get lab dashboard statistics](/api-reference/dashboard/getLabDashboardStats) | | `GET` | [Get order and revenue trends](/api-reference/dashboard/getLabDashboardTrends) | | `GET` | [Get today's hourly breakdown](/api-reference/dashboard/getLabDashboardToday) | | `GET` | [List clinic actions](/api-reference/dashboard/getClinicDashboardActions) | | `GET` | [List clinic-safe recent order activity](/api-reference/dashboard/getClinicDashboardActivity) | | `GET` | [List orders currently blocked by an active hold](/api-reference/dashboard/getLabDashboardBlockedOrders) | --- # Data Bundle Documentation: https://docs.guidelab.co/api-reference/data-bundle ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ------------------------------------------------------------------------------------------------------------- | | `POST` | [Dry-run an uploaded bundle against the current organization](/api-reference/data-bundle/analyzeDataBundle) | | `POST` | [Export selected domains as a re-importable zip bundle](/api-reference/data-bundle/exportDataBundle) | | `POST` | [Get a presigned PUT URL for uploading a bundle zip](/api-reference/data-bundle/presignDataBundleUpload) | | `POST` | [Import an uploaded bundle into the current organization](/api-reference/data-bundle/executeDataBundleImport) | --- # Document Settings Documentation: https://docs.guidelab.co/api-reference/document-settings ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ---------------------------------------------------------------------------------------- | | `DELETE` | [Delete Document Footer Logo](/api-reference/document-settings/deleteDocumentFooterLogo) | | `GET` | [Get Document Footer Logo](/api-reference/document-settings/getDocumentFooterLogo) | | `GET` | [Get Document Settings](/api-reference/document-settings/getDocumentSettings) | | `PUT` | [Update Document Settings](/api-reference/document-settings/updateDocumentSettings) | | `POST` | [Upload Document Footer Logo](/api-reference/document-settings/uploadDocumentFooterLogo) | --- # Download Documentation: https://docs.guidelab.co/api-reference/download ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ----------------------------------------------------------------------------------------------- | | `GET` | [Check for a signed uploader update](/api-reference/download/checkUploaderUpdate) | | `GET` | [Download a signed uploader update bundle](/api-reference/download/downloadUploaderUpdateAsset) | | `GET` | [Download software installer for a platform](/api-reference/download/downloadSoftwareInstaller) | --- # Email Templates Documentation: https://docs.guidelab.co/api-reference/email-templates ## Endpoints [#endpoints] | Method | Endpoint | | -------- | --------------------------------------------------------------------------- | | `POST` | [Create Email Template](/api-reference/email-templates/createEmailTemplate) | | `DELETE` | [Delete Email Template](/api-reference/email-templates/deleteEmailTemplate) | | `GET` | [Get Email Template](/api-reference/email-templates/getEmailTemplate) | | `GET` | [List Email Templates](/api-reference/email-templates/listEmailTemplates) | | `PUT` | [Update Email Template](/api-reference/email-templates/updateEmailTemplate) | --- # Export Documentation: https://docs.guidelab.co/api-reference/export ## Endpoints [#endpoints] | Method | Endpoint | | ------ | --------------------------------------------------------------------- | | `POST` | [Export balance list as CSV](/api-reference/export/exportBalanceList) | | `POST` | [Export clients as CSV](/api-reference/export/exportClients) | | `POST` | [Export price lists as CSV](/api-reference/export/exportPriceLists) | | `POST` | [Export products as CSV](/api-reference/export/exportProducts) | --- # File Requirements Documentation: https://docs.guidelab.co/api-reference/file-requirements ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------------- | | `DELETE` | [Archive file requirement](/api-reference/file-requirements/archiveFileRequirement) | | `POST` | [Create file requirement](/api-reference/file-requirements/createFileRequirement) | | `GET` | [Get file requirement](/api-reference/file-requirements/getFileRequirement) | | `GET` | [List file requirements](/api-reference/file-requirements/listFileRequirements) | | `PUT` | [Update file requirement](/api-reference/file-requirements/updateFileRequirement) | --- # Files Documentation: https://docs.guidelab.co/api-reference/files ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------------ | | `POST` | [Copy files to an order](/api-reference/files/copyFilesToOrder) | | `DELETE` | [Delete a file](/api-reference/files/deleteFile) | | `GET` | [Download a file](/api-reference/files/downloadFile) | | `POST` | [Finalize a direct file upload](/api-reference/files/finalizeFileUpload) | | `POST` | [Get presigned upload URL](/api-reference/files/presignFileUpload) | | `GET` | [List files](/api-reference/files/listFiles) | | `POST` | [Reassign files between orders](/api-reference/files/reassignFiles) | | `POST` | [Upload a file](/api-reference/files/uploadFile) | --- # Finance Settings Documentation: https://docs.guidelab.co/api-reference/finance-settings ## Endpoints [#endpoints] | Method | Endpoint | | ------ | -------------------------------------------------------------------------------- | | `GET` | [Get Finance Settings](/api-reference/finance-settings/getFinanceSettings) | | `PUT` | [Update Finance Settings](/api-reference/finance-settings/updateFinanceSettings) | --- # Finances Documentation: https://docs.guidelab.co/api-reference/finances ## Endpoints [#endpoints] | Method | Endpoint | | -------- | --------------------------------------------------------------------------------------------- | | `POST` | [Create Expense](/api-reference/finances/createExpense) | | `POST` | [Create Expense Category](/api-reference/finances/createExpenseCategory) | | `DELETE` | [Delete Expense](/api-reference/finances/deleteExpense) | | `DELETE` | [Delete Expense Category](/api-reference/finances/deleteExpenseCategory) | | `GET` | [Get Aged Balances](/api-reference/finances/getAgedBalances) | | `GET` | [Get Cashflow](/api-reference/finances/getCashflow) | | `GET` | [Get Finance Account](/api-reference/finances/getFinanceAccount) | | `GET` | [Get Finances Overview](/api-reference/finances/getFinancesOverview) | | `GET` | [Get Stripe External Adjustment](/api-reference/finances/getStripeExternalAdjustment) | | `GET` | [List Expense Categories](/api-reference/finances/listExpenseCategories) | | `GET` | [List Expenses](/api-reference/finances/listExpenses) | | `GET` | [List Finance Accounts](/api-reference/finances/listFinanceAccounts) | | `GET` | [List Stripe External Adjustments](/api-reference/finances/listStripeExternalAdjustments) | | `POST` | [Resolve Stripe External Adjustment](/api-reference/finances/resolveStripeExternalAdjustment) | | `PATCH` | [Update Expense](/api-reference/finances/updateExpense) | | `PATCH` | [Update Expense Category](/api-reference/finances/updateExpenseCategory) | | `POST` | [Void Expense](/api-reference/finances/voidExpense) | --- # Forms Documentation: https://docs.guidelab.co/api-reference/forms ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------------------------------------------------ | | `POST` | [Add questions to a form](/api-reference/forms/addQuestionsToForm) | | `POST` | [Create a form question](/api-reference/forms/createFormQuestion) | | `POST` | [Create a new form](/api-reference/forms/createForm) | | `DELETE` | [Deactivate a form](/api-reference/forms/deleteForm) | | `DELETE` | [Deactivate a form question](/api-reference/forms/deleteFormQuestion) | | `GET` | [Get a form by ID](/api-reference/forms/getForm) | | `GET` | [Get a form question by ID](/api-reference/forms/getFormQuestion) | | `GET` | [Get form feature settings](/api-reference/forms/getFormSettings) | | `GET` | [List all form questions](/api-reference/forms/listFormQuestions) | | `GET` | [List forms with questions](/api-reference/forms/listForms) | | `GET` | [List questions assigned to a form](/api-reference/forms/listFormAssignedQuestions) | | `POST` | [Publish an immutable form revision](/api-reference/forms/publishFormRevision) | | `DELETE` | [Remove a question from a form](/api-reference/forms/removeQuestionFromForm) | | `PUT` | [Reorder form questions globally](/api-reference/forms/reorderFormQuestions) | | `PUT` | [Reorder questions within a form](/api-reference/forms/reorderFormAssignedQuestions) | | `POST` | [Submit answers for a partnership registration form](/api-reference/forms/submitPartnershipRegistrationForm) | | `POST` | [Submit answers for an order form](/api-reference/forms/submitOrderForm) | | `PUT` | [Update a form](/api-reference/forms/updateForm) | | `PUT` | [Update a form question](/api-reference/forms/updateFormQuestion) | | `PUT` | [Update form feature settings](/api-reference/forms/updateFormSettings) | --- # Hold Reasons Documentation: https://docs.guidelab.co/api-reference/hold-reasons ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ---------------------------------------------------------------------- | | `POST` | [Create Hold Reason](/api-reference/hold-reasons/createHoldReason) | | `DELETE` | [Delete Hold Reason](/api-reference/hold-reasons/deleteHoldReason) | | `GET` | [List Hold Reasons](/api-reference/hold-reasons/listHoldReasons) | | `POST` | [Reorder Hold Reasons](/api-reference/hold-reasons/reorderHoldReasons) | | `PUT` | [Update Hold Reason](/api-reference/hold-reasons/updateHoldReason) | --- # Implant Systems Documentation: https://docs.guidelab.co/api-reference/implant-systems ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------------------ | | `POST` | [Create an implant system](/api-reference/implant-systems/createImplantSystem) | | `DELETE` | [Delete an implant system](/api-reference/implant-systems/deleteImplantSystem) | | `GET` | [Get an implant system](/api-reference/implant-systems/getImplantSystem) | | `GET` | [List implant systems](/api-reference/implant-systems/listImplantSystems) | | `PATCH` | [Patch an implant system](/api-reference/implant-systems/patchImplantSystem) | | `PUT` | [Update an implant system](/api-reference/implant-systems/updateImplantSystem) | --- # Import Documentation: https://docs.guidelab.co/api-reference/import ## Endpoints [#endpoints] | Method | Endpoint | | -------- | --------------------------------------------------------------------------------- | | `DELETE` | [Delete an import mapping template](/api-reference/import/deleteImportMapping) | | `POST` | [Import balance list from CSV data](/api-reference/import/importBalanceList) | | `POST` | [Import clients from CSV data](/api-reference/import/importClients) | | `POST` | [Import price list items from CSV data](/api-reference/import/importPriceLists) | | `POST` | [Import products from CSV data](/api-reference/import/importProducts) | | `GET` | [List saved import mappings](/api-reference/import/listImportMappings) | | `POST` | [Save an import mapping template](/api-reference/import/createImportMapping) | | `POST` | [Validate import data before importing](/api-reference/import/validateImportData) | --- # API Reference Complete GuideLab REST API reference, generated from OpenAPI. Documentation: https://docs.guidelab.co/api-reference ## Categories [#categories] | Category | Endpoints | | --------------------------------------------------------------------------- | --------: | | [Admin](/api-reference/admin) | 25 | | [Ai](/api-reference/ai) | 2 | | [Archive](/api-reference/archive) | 6 | | [Automations](/api-reference/automations) | 9 | | [Bundles](/api-reference/bundles) | 6 | | [Calendar](/api-reference/calendar) | 8 | | [Categories](/api-reference/categories) | 13 | | [Checkout](/api-reference/checkout) | 3 | | [Clients](/api-reference/clients) | 1 | | [Clinic](/api-reference/clinic) | 1 | | [Clinic Finances](/api-reference/clinic-finances) | 9 | | [Clinic Locations](/api-reference/clinic-locations) | 5 | | [Clinic Payment Methods](/api-reference/clinic-payment-methods) | 7 | | [Company Settings](/api-reference/company-settings) | 13 | | [Components](/api-reference/components) | 7 | | [Consolidations](/api-reference/consolidations) | 5 | | [Conversations](/api-reference/conversations) | 12 | | [Credit Notes](/api-reference/credit-notes) | 8 | | [Dashboard](/api-reference/dashboard) | 9 | | [Data Bundle](/api-reference/data-bundle) | 4 | | [Document Settings](/api-reference/document-settings) | 5 | | [Download](/api-reference/download) | 3 | | [Email Templates](/api-reference/email-templates) | 5 | | [Export](/api-reference/export) | 4 | | [File Requirements](/api-reference/file-requirements) | 5 | | [Files](/api-reference/files) | 8 | | [Finance Settings](/api-reference/finance-settings) | 2 | | [Finances](/api-reference/finances) | 17 | | [Forms](/api-reference/forms) | 20 | | [Hold Reasons](/api-reference/hold-reasons) | 5 | | [Implant Systems](/api-reference/implant-systems) | 6 | | [Import](/api-reference/import) | 8 | | [Integrations](/api-reference/integrations) | 60 | | [Inventory](/api-reference/inventory) | 38 | | [Invoices](/api-reference/invoices) | 10 | | [Location Routes](/api-reference/location-routes) | 5 | | [Materials](/api-reference/materials) | 8 | | [Notifications](/api-reference/notifications) | 5 | | [Order Filter Presets](/api-reference/order-filter-presets) | 6 | | [Order Tags](/api-reference/order-tags) | 5 | | [Orders](/api-reference/orders) | 46 | | [Organization](/api-reference/organization) | 28 | | [Organization Onboarding](/api-reference/organization-onboarding) | 4 | | [Organization Settings](/api-reference/organization-settings) | 1 | | [Overpayments](/api-reference/overpayments) | 2 | | [Partnership Payment Settings](/api-reference/partnership-payment-settings) | 2 | | [Partnerships](/api-reference/partnerships) | 17 | | [Patients](/api-reference/patients) | 9 | | [Pickup Requests](/api-reference/pickup-requests) | 15 | | [Practice Groups](/api-reference/practice-groups) | 8 | | [Price Lists](/api-reference/price-lists) | 16 | | [Production](/api-reference/production) | 44 | | [Products](/api-reference/products) | 14 | | [Push Subscriptions](/api-reference/push-subscriptions) | 4 | | [Qc Checklist](/api-reference/qc-checklist) | 5 | | [Qc Settings](/api-reference/qc-settings) | 2 | | [Quality Control](/api-reference/quality-control) | 2 | | [Receiving](/api-reference/receiving) | 6 | | [Remake Reasons](/api-reference/remake-reasons) | 5 | | [Reports](/api-reference/reports) | 8 | | [Scan Inbox](/api-reference/scan-inbox) | 7 | | [Scanner Connections](/api-reference/scanner-connections) | 19 | | [Scanner Settings](/api-reference/scanner-settings) | 2 | | [Search](/api-reference/search) | 1 | | [Shade Systems](/api-reference/shade-systems) | 9 | | [Shipments](/api-reference/shipments) | 12 | | [Standards](/api-reference/standards) | 4 | | [Statements](/api-reference/statements) | 4 | | [Sticker Templates](/api-reference/sticker-templates) | 15 | | [Stripe Connect](/api-reference/stripe-connect) | 7 | | [Team](/api-reference/team) | 9 | | [Transactions](/api-reference/transactions) | 1 | | [Treatment Phases](/api-reference/treatment-phases) | 7 | | [Users](/api-reference/users) | 7 | | [Webhooks](/api-reference/webhooks) | 3 | | [Whatsapp Templates](/api-reference/whatsapp-templates) | 13 | | [Work Trays](/api-reference/work-trays) | 5 | --- # Integrations Documentation: https://docs.guidelab.co/api-reference/integrations ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------------------------------------------------------- | | `POST` | [Connect a lab-owned carrier account without retaining its credentials](/api-reference/integrations/connectShipEngineCarrier) | | `POST` | [Connect or update Dentally integration](/api-reference/integrations/connectDentally) | | `DELETE` | [Delete Fatture in Cloud client mapping](/api-reference/integrations/deleteFattureInCloudClientMapping) | | `DELETE` | [Delete Xero contact mapping](/api-reference/integrations/deleteXeroContactMapping) | | `DELETE` | [Disconnect Dentally integration](/api-reference/integrations/disconnectDentally) | | `POST` | [Disconnect Fatture in Cloud integration](/api-reference/integrations/disconnectFattureInCloud) | | `POST` | [Disconnect Xero integration](/api-reference/integrations/disconnectXero) | | `GET` | [Get Ariba integration status and configuration](/api-reference/integrations/getAribaStatus) | | `GET` | [Get Bite Finder integration status](/api-reference/integrations/getBiteFinderStatus) | | `GET` | [Get Dentally connection status](/api-reference/integrations/getDentallyConnection) | | `GET` | [Get exocad integration status and mappings](/api-reference/integrations/getExocadStatus) | | `GET` | [Get Fatture in Cloud integration status](/api-reference/integrations/getFattureInCloudStatus) | | `GET` | [Get HeyGears integration status](/api-reference/integrations/getHeyGearsStatus) | | `GET` | [Get ShipStation partner shipping status](/api-reference/integrations/getShipEngineIntegration) | | `GET` | [Get Twilio integration status](/api-reference/integrations/getTwilioStatus) | | `GET` | [Get Xero integration status](/api-reference/integrations/getXeroStatus) | | `GET` | [Handle Fatture in Cloud OAuth callback](/api-reference/integrations/handleFattureInCloudOAuthCallback) | | `GET` | [Handle Xero OAuth callback](/api-reference/integrations/handleXeroOAuthCallback) | | `POST` | [Initiate Fatture in Cloud OAuth authorization](/api-reference/integrations/initiateFattureInCloudOAuth) | | `POST` | [Initiate Xero OAuth authorization](/api-reference/integrations/initiateXeroOAuth) | | `GET` | [List Dentally sync logs](/api-reference/integrations/listDentallySyncLogs) | | `GET` | [List Fatture in Cloud client mappings](/api-reference/integrations/listFattureInCloudClientMappings) | | `GET` | [List Fatture in Cloud companies](/api-reference/integrations/listFattureInCloudCompanies) | | `GET` | [List Fatture in Cloud payment accounts](/api-reference/integrations/listFattureInCloudPaymentAccounts) | | `GET` | [List Fatture in Cloud payment methods](/api-reference/integrations/listFattureInCloudPaymentMethods) | | `GET` | [List Fatture in Cloud sync logs](/api-reference/integrations/listFattureInCloudSyncLogs) | | `GET` | [List Fatture in Cloud VAT types](/api-reference/integrations/listFattureInCloudVatTypes) | | `GET` | [List the lab's connected carrier accounts](/api-reference/integrations/listShipEngineCarriers) | | `GET` | [List Xero accounts](/api-reference/integrations/listXeroAccounts) | | `GET` | [List Xero contact mappings](/api-reference/integrations/listXeroContactMappings) | | `GET` | [List Xero sync logs](/api-reference/integrations/listXeroSyncLogs) | | `GET` | [List Xero tax rates](/api-reference/integrations/listXeroTaxRates) | | `GET` | [Preview Ariba cXML invoice](/api-reference/integrations/previewAribaCxml) | | `POST` | [Provision the lab's ShipStation partner sub-account](/api-reference/integrations/provisionShipEngineIntegration) | | `POST` | [Reconcile invoice payments to Fatture in Cloud](/api-reference/integrations/syncFattureInCloudPayments) | | `POST` | [Refresh an invoice's SDI status](/api-reference/integrations/refreshFattureInCloudEInvoiceStatus) | | `GET` | [Search Fatture in Cloud clients](/api-reference/integrations/searchFattureInCloudClients) | | `GET` | [Search Xero contacts](/api-reference/integrations/searchXeroContacts) | | `POST` | [Select the Fatture in Cloud company](/api-reference/integrations/selectFattureInCloudCompany) | | `POST` | [Send a test message via Twilio](/api-reference/integrations/sendTwilioTestMessage) | | `POST` | [Send an invoice to SDI](/api-reference/integrations/sendFattureInCloudEInvoice) | | `POST` | [Send invoice to Ariba via cXML](/api-reference/integrations/sendAribaInvoice) | | `POST` | [Sync a credit note to Fatture in Cloud](/api-reference/integrations/syncFattureInCloudCreditNote) | | `POST` | [Sync a payment allocation to Xero](/api-reference/integrations/syncXeroPayment) | | `POST` | [Sync an invoice to Fatture in Cloud](/api-reference/integrations/syncFattureInCloudInvoice) | | `POST` | [Sync an invoice to Xero](/api-reference/integrations/syncXeroInvoice) | | `POST` | [Test Dentally API credentials](/api-reference/integrations/testDentallyConnection) | | `POST` | [Test Twilio API credentials](/api-reference/integrations/testTwilioConnection) | | `POST` | [Trigger Dentally patient sync](/api-reference/integrations/triggerDentallySync) | | `PUT` | [Update Ariba integration settings](/api-reference/integrations/updateAribaIntegration) | | `PUT` | [Update Bite Finder integration settings](/api-reference/integrations/updateBiteFinderIntegration) | | `PUT` | [Update exocad integration settings](/api-reference/integrations/updateExocadIntegration) | | `PUT` | [Update exocad material mappings](/api-reference/integrations/updateExocadMaterialMappings) | | `PUT` | [Update exocad reconstruction type mappings](/api-reference/integrations/updateExocadReconstructionMappings) | | `PUT` | [Update Fatture in Cloud integration settings](/api-reference/integrations/updateFattureInCloudSettings) | | `PUT` | [Update HeyGears integration settings](/api-reference/integrations/updateHeyGearsIntegration) | | `PUT` | [Update Twilio integration settings](/api-reference/integrations/updateTwilioIntegration) | | `PUT` | [Update Xero integration settings](/api-reference/integrations/updateXeroSettings) | | `PUT` | [Upsert Fatture in Cloud client mapping](/api-reference/integrations/upsertFattureInCloudClientMapping) | | `PUT` | [Upsert Xero contact mapping](/api-reference/integrations/upsertXeroContactMapping) | --- # Inventory Documentation: https://docs.guidelab.co/api-reference/inventory ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------------------- | | `DELETE` | [Archive a supplier](/api-reference/inventory/archiveSupplier) | | `DELETE` | [Archive an inventory item](/api-reference/inventory/archiveInventoryItem) | | `POST` | [Cancel a purchase order](/api-reference/inventory/cancelPurchaseOrder) | | `POST` | [Create a purchase order](/api-reference/inventory/createPurchaseOrder) | | `POST` | [Create a stock adjustment](/api-reference/inventory/createStockAdjustment) | | `POST` | [Create a supplier](/api-reference/inventory/createSupplier) | | `POST` | [Create an adjustment reason](/api-reference/inventory/createAdjustmentReason) | | `POST` | [Create an inventory category](/api-reference/inventory/createInventoryCategory) | | `POST` | [Create an inventory item](/api-reference/inventory/createInventoryItem) | | `DELETE` | [Delete a purchase order](/api-reference/inventory/deletePurchaseOrder) | | `DELETE` | [Delete an adjustment reason](/api-reference/inventory/deleteAdjustmentReason) | | `DELETE` | [Delete an inventory category](/api-reference/inventory/deleteInventoryCategory) | | `DELETE` | [Delete an inventory item image](/api-reference/inventory/deleteInventoryItemImage) | | `GET` | [Get a purchase order](/api-reference/inventory/getPurchaseOrder) | | `GET` | [Get a supplier](/api-reference/inventory/getSupplier) | | `GET` | [Get an inventory category](/api-reference/inventory/getInventoryCategory) | | `GET` | [Get an inventory item](/api-reference/inventory/getInventoryItem) | | `GET` | [Get an inventory item image](/api-reference/inventory/getInventoryItemImage) | | `GET` | [Get inventory dashboard statistics](/api-reference/inventory/getInventoryDashboardStats) | | `GET` | [Get inventory settings](/api-reference/inventory/getInventorySettings) | | `GET` | [List adjustment reasons](/api-reference/inventory/listAdjustmentReasons) | | `GET` | [List inventory categories](/api-reference/inventory/listInventoryCategories) | | `GET` | [List inventory items](/api-reference/inventory/listInventoryItems) | | `GET` | [List purchase orders](/api-reference/inventory/listPurchaseOrders) | | `GET` | [List stock adjustments](/api-reference/inventory/listStockAdjustments) | | `GET` | [List suppliers](/api-reference/inventory/listSuppliers) | | `POST` | [Receive purchase order items](/api-reference/inventory/receivePurchaseOrderItems) | | `POST` | [Reorder adjustment reasons](/api-reference/inventory/reorderAdjustmentReasons) | | `POST` | [Reorder inventory categories](/api-reference/inventory/reorderInventoryCategories) | | `POST` | [Seed default adjustment reasons](/api-reference/inventory/seedAdjustmentReasons) | | `POST` | [Seed default inventory categories](/api-reference/inventory/seedInventoryCategories) | | `POST` | [Send a purchase order](/api-reference/inventory/sendPurchaseOrder) | | `PUT` | [Update a supplier](/api-reference/inventory/updateSupplier) | | `PUT` | [Update an adjustment reason](/api-reference/inventory/updateAdjustmentReason) | | `PUT` | [Update an inventory category](/api-reference/inventory/updateInventoryCategory) | | `PUT` | [Update an inventory item](/api-reference/inventory/updateInventoryItem) | | `PUT` | [Update inventory settings](/api-reference/inventory/updateInventorySettings) | | `POST` | [Upload an inventory item image](/api-reference/inventory/uploadInventoryItemImage) | --- # Invoices Documentation: https://docs.guidelab.co/api-reference/invoices ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------------- | | `POST` | [Archive Invoice](/api-reference/invoices/archiveInvoice) | | `POST` | [Create Invoice](/api-reference/invoices/createInvoice) | | `DELETE` | [Delete Invoice](/api-reference/invoices/deleteInvoice) | | `POST` | [Email Invoice](/api-reference/invoices/emailInvoice) | | `POST` | [Generate Invoices From Orders](/api-reference/invoices/generateInvoicesFromOrders) | | `GET` | [Get Invoice](/api-reference/invoices/getInvoice) | | `GET` | [Get Invoice By Order](/api-reference/invoices/getInvoiceByOrder) | | `GET` | [List Invoices](/api-reference/invoices/listInvoices) | | `POST` | [Record Invoice Payment](/api-reference/invoices/recordInvoicePayment) | | `PUT` | [Update Invoice](/api-reference/invoices/updateInvoice) | --- # Location Routes Documentation: https://docs.guidelab.co/api-reference/location-routes ## Endpoints [#endpoints] | Method | Endpoint | | -------- | --------------------------------------------------------------------------------- | | `POST` | [Create a location route](/api-reference/location-routes/createLocationRoute) | | `DELETE` | [Deactivate a location route](/api-reference/location-routes/deleteLocationRoute) | | `GET` | [Get a location route by ID](/api-reference/location-routes/getLocationRoute) | | `GET` | [List location routes](/api-reference/location-routes/listLocationRoutes) | | `PUT` | [Update a location route](/api-reference/location-routes/updateLocationRoute) | --- # Materials Documentation: https://docs.guidelab.co/api-reference/materials ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------- | | `POST` | [Create a material](/api-reference/materials/createMaterial) | | `DELETE` | [Delete a material](/api-reference/materials/deleteMaterial) | | `DELETE` | [Delete material icon](/api-reference/materials/deleteMaterialIcon) | | `GET` | [Get a material](/api-reference/materials/getMaterial) | | `GET` | [Get material icon](/api-reference/materials/getMaterialIcon) | | `GET` | [List materials](/api-reference/materials/listMaterials) | | `PUT` | [Update a material](/api-reference/materials/updateMaterial) | | `POST` | [Upload material icon](/api-reference/materials/uploadMaterialIcon) | --- # Notifications Documentation: https://docs.guidelab.co/api-reference/notifications ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ------------------------------------------------------------------------------------------------------------ | | `GET` | [Get conversation unread count](/api-reference/notifications/getConversationUnreadCount) | | `GET` | [Get notification unread count](/api-reference/notifications/getNotificationUnreadCount) | | `GET` | [List notifications](/api-reference/notifications/listNotifications) | | `POST` | [Mark notifications as read](/api-reference/notifications/markNotificationsRead) | | `POST` | [One-click unsubscribe from notification emails](/api-reference/notifications/unsubscribeNotificationEmails) | --- # Order Filter Presets Documentation: https://docs.guidelab.co/api-reference/order-filter-presets ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------------------------------------ | | `GET` | [Count orders per filter preset](/api-reference/order-filter-presets/getOrderFilterPresetCounts) | | `POST` | [Create an order filter preset](/api-reference/order-filter-presets/createOrderFilterPreset) | | `DELETE` | [Delete an order filter preset](/api-reference/order-filter-presets/deleteOrderFilterPreset) | | `GET` | [List order filter presets](/api-reference/order-filter-presets/listOrderFilterPresets) | | `POST` | [Reorder order filter presets](/api-reference/order-filter-presets/reorderOrderFilterPresets) | | `PUT` | [Update an order filter preset](/api-reference/order-filter-presets/updateOrderFilterPreset) | --- # Order Tags Documentation: https://docs.guidelab.co/api-reference/order-tags ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------- | | `POST` | [Create an order tag](/api-reference/order-tags/createOrderTag) | | `DELETE` | [Deactivate an order tag](/api-reference/order-tags/deleteOrderTag) | | `GET` | [Get an order tag](/api-reference/order-tags/getOrderTag) | | `GET` | [List order tags](/api-reference/order-tags/listOrderTags) | | `PUT` | [Update an order tag](/api-reference/order-tags/updateOrderTag) | --- # Orders Documentation: https://docs.guidelab.co/api-reference/orders ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ---------------------------------------------------------------------------------------------------------- | | `POST` | [Add component to order](/api-reference/orders/addOrderComponent) | | `POST` | [Add line item to an existing order](/api-reference/orders/addOrderItem) | | `POST` | [Add tag to order](/api-reference/orders/addOrderTag) | | `POST` | [Approve surgical report (clinic only)](/api-reference/orders/approveSurgicalReport) | | `PATCH` | [Assign or unassign a work tray to a stage (lab only)](/api-reference/orders/assignOrderPhaseWorkTray) | | `POST` | [Bulk delete or cancel orders](/api-reference/orders/bulkDeleteOrders) | | `POST` | [Cancel an order with an explicit refund decision](/api-reference/orders/cancelOrderWithRefundChoice) | | `DELETE` | [Cancel order](/api-reference/orders/cancelOrder) | | `POST` | [Create draft order](/api-reference/orders/createDraftOrder) | | `DELETE` | [Delete draft order](/api-reference/orders/deleteDraftOrder) | | `GET` | [Get an order's revision-aware QC state](/api-reference/orders/getOrderQc) | | `GET` | [Get calendar data](/api-reference/orders/getOrderCalendar) | | `GET` | [Get current surgical report review state](/api-reference/orders/getCurrentSurgicalReport) | | `GET` | [Get dispatched orders](/api-reference/orders/getShippedOrders) | | `GET` | [Get filter options for orders](/api-reference/orders/getOrderFilterOptions) | | `GET` | [Get hold requirements for order](/api-reference/orders/getOrderHoldRequirements) | | `GET` | [Get most recent draft order](/api-reference/orders/getMostRecentDraft) | | `GET` | [Get order by ID](/api-reference/orders/getOrderDetail) | | `GET` | [Get order components](/api-reference/orders/getOrderComponents) | | `GET` | [Get order files](/api-reference/orders/getOrderFiles) | | `GET` | [Get order messages](/api-reference/orders/getOrderMessages) | | `GET` | [Get order print data](/api-reference/orders/getOrderPrintData) | | `GET` | [Get order status history](/api-reference/orders/getOrderStatusHistory) | | `GET` | [Get order tags](/api-reference/orders/getOrderTags) | | `GET` | [Get orders for a specific day](/api-reference/orders/getOrderCalendarDay) | | `GET` | [Get orders needing approval](/api-reference/orders/getOrdersNeedingApproval) | | `GET` | [Get specific draft order](/api-reference/orders/getDraftById) | | `GET` | [Get subscription status](/api-reference/orders/getOrderSubscription) | | `GET` | [List orders](/api-reference/orders/listOrders) | | `GET` | [List tasks of an order's current phase](/api-reference/orders/listOrderPhaseTasks) | | `POST` | [Put order on hold](/api-reference/orders/createOrderHold) | | `POST` | [Record an immutable QC inspection](/api-reference/orders/completeOrderQc) | | `DELETE` | [Remove a line item from an existing order](/api-reference/orders/deleteOrderItem) | | `DELETE` | [Remove component from order](/api-reference/orders/removeOrderComponent) | | `DELETE` | [Remove tag from order](/api-reference/orders/removeOrderTag) | | `POST` | [Request a new surgical report revision (clinic only)](/api-reference/orders/requestSurgicalReportChanges) | | `POST` | [Request phase advancement (clinic only)](/api-reference/orders/requestOrderPhaseAdvance) | | `POST` | [Review hold requirement](/api-reference/orders/reviewHoldRequirement) | | `POST` | [Submit an existing order draft](/api-reference/orders/submitDraftOrder) | | `POST` | [Submit hold requirement](/api-reference/orders/submitHoldRequirement) | | `POST` | [Subscribe to order](/api-reference/orders/subscribeToOrder) | | `DELETE` | [Unsubscribe from order](/api-reference/orders/unsubscribeFromOrder) | | `PATCH` | [Update a line item on an existing order](/api-reference/orders/updateOrderItem) | | `PATCH` | [Update draft order](/api-reference/orders/updateDraftOrder) | | `PATCH` | [Update order](/api-reference/orders/updateOrder) | | `PATCH` | [Update order status](/api-reference/orders/updateOrderStatus) | --- # Organization Documentation: https://docs.guidelab.co/api-reference/organization ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------------------------------------------------------------- | | `PATCH` | [Approve or reject a join request](/api-reference/organization/processJoinRequest) | | `GET` | [Check organization name availability](/api-reference/organization/checkOrgNameAvailability) | | `GET` | [Check organization slug availability](/api-reference/organization/checkOrgSlugAvailability) | | `POST` | [Create a new organization](/api-reference/organization/createOrganization) | | `POST` | [Create organization billing portal session](/api-reference/organization/createOrganizationBillingPortalSession) | | `POST` | [Generate or rotate the organization's join code](/api-reference/organization/createJoinCode) | | `GET` | [Get an organization by ID](/api-reference/organization/getOrganization) | | `GET` | [Get current organization subscription](/api-reference/organization/getCurrentOrganizationSubscription) | | `GET` | [Get organization closure status](/api-reference/organization/getOrganizationClosureStatus) | | `GET` | [Get public profile of an organization](/api-reference/organization/getOrganizationProfile) | | `GET` | [Get the organization's active join code](/api-reference/organization/getJoinCode) | | `GET` | [List current user's memberships](/api-reference/organization/listMyMemberships) | | `GET` | [List current user's pending join requests](/api-reference/organization/listMyPendingRequests) | | `GET` | [List members of an organization](/api-reference/organization/listOrganizationMembers) | | `GET` | [List organizations by type](/api-reference/organization/listOrganizationsByType) | | `GET` | [List pending join requests](/api-reference/organization/listJoinRequests) | | `GET` | [List retention holds](/api-reference/organization/listOrganizationRetentionHolds) | | `POST` | [Place a retention hold](/api-reference/organization/placeOrganizationRetentionHold) | | `GET` | [Public organization search](/api-reference/organization/publicSearchOrganizations) | | `POST` | [Redeem a join code to join an organization](/api-reference/organization/redeemJoinCode) | | `POST` | [Release a retention hold](/api-reference/organization/releaseOrganizationRetentionHold) | | `POST` | [Request organization closure](/api-reference/organization/requestOrganizationClosure) | | `POST` | [Request to join an organization](/api-reference/organization/createJoinRequest) | | `POST` | [Resend a join request notification](/api-reference/organization/resendJoinRequest) | | `DELETE` | [Revoke the organization's active join code](/api-reference/organization/revokeJoinCode) | | `GET` | [Search organizations](/api-reference/organization/searchOrganizations) | | `GET` | [Search organizations to join](/api-reference/organization/searchOrganizationsToJoin) | | `PUT` | [Update organization subscription storage add-on](/api-reference/organization/updateOrganizationSubscriptionStorageAddOn) | --- # Organization Onboarding Documentation: https://docs.guidelab.co/api-reference/organization-onboarding ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ---------------------------------------------------------------------------------------------------------------------- | | `POST` | [Complete Clinic Organization Onboarding](/api-reference/organization-onboarding/completeClinicOrganizationOnboarding) | | `POST` | [Create Onboarding Subscription Checkout](/api-reference/organization-onboarding/createOnboardingSubscriptionCheckout) | | `GET` | [Get Organization Onboarding](/api-reference/organization-onboarding/getOrganizationOnboarding) | | `PUT` | [Save Organization Onboarding Step](/api-reference/organization-onboarding/saveOrganizationOnboardingStep) | --- # Organization Settings Documentation: https://docs.guidelab.co/api-reference/organization-settings ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ------------------------------------------------------------------------------------------------------------------------ | | `POST` | [Initialize organization settings defaults](/api-reference/organization-settings/initializeOrganizationSettingsDefaults) | --- # Overpayments Documentation: https://docs.guidelab.co/api-reference/overpayments ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ------------------------------------------------------------------- | | `GET` | [List Overpayments](/api-reference/overpayments/listOverpayments) | | `POST` | [Refund Overpayment](/api-reference/overpayments/refundOverpayment) | --- # Partnership Payment Settings Documentation: https://docs.guidelab.co/api-reference/partnership-payment-settings ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ------------------------------------------------------------------------------------------------------------------------- | | `GET` | [Get payment settings for a partnership](/api-reference/partnership-payment-settings/getPartnershipPaymentSettings) | | `PUT` | [Update payment settings for a partnership](/api-reference/partnership-payment-settings/updatePartnershipPaymentSettings) | --- # Partnerships Documentation: https://docs.guidelab.co/api-reference/partnerships ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ----------------------------------------------------------------------------------------------------- | | `POST` | [Accept a pending partnership request](/api-reference/partnerships/acceptPartnership) | | `POST` | [Cancel a managed clinic ownership handoff](/api-reference/partnerships/cancelManagedClinicClaim) | | `POST` | [Cancel a pending partnership request](/api-reference/partnerships/cancelPartnership) | | `GET` | [Get clinic detail view for a partnership](/api-reference/partnerships/getPartnershipClinicDetail) | | `GET` | [Get partnership detail view](/api-reference/partnerships/getPartnership) | | `GET` | [Get share-all-patients setting](/api-reference/partnerships/getShareAllPatients) | | `POST` | [Invite a new clinic to GuideLab](/api-reference/partnerships/inviteClinic) | | `POST` | [Invite an owner to claim a lab-managed clinic](/api-reference/partnerships/inviteManagedClinicOwner) | | `GET` | [List partnerships for the current organization](/api-reference/partnerships/listPartnerships) | | `POST` | [Reactivate a suspended partnership](/api-reference/partnerships/reactivatePartnership) | | `POST` | [Reject a pending partnership request](/api-reference/partnerships/rejectPartnership) | | `POST` | [Request a partnership with another organization](/api-reference/partnerships/requestPartnership) | | `POST` | [Resend partnership invitation email](/api-reference/partnerships/resendPartnershipInvite) | | `GET` | [Search for potential partners](/api-reference/partnerships/searchPartners) | | `POST` | [Suspend an active partnership](/api-reference/partnerships/suspendPartnership) | | `POST` | [Terminate a partnership](/api-reference/partnerships/terminatePartnership) | | `PUT` | [Update share-all-patients setting](/api-reference/partnerships/updateShareAllPatients) | --- # Patients Documentation: https://docs.guidelab.co/api-reference/patients ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------------- | | `POST` | [Create a new patient](/api-reference/patients/createPatient) | | `DELETE` | [Erase a patient identity](/api-reference/patients/erasePatientIdentity) | | `GET` | [Get a single patient by ID](/api-reference/patients/getPatient) | | `POST` | [Grant lab access to a patient](/api-reference/patients/grantPatientLabAccess) | | `GET` | [List labs with access to a patient](/api-reference/patients/listPatientLabAccess) | | `GET` | [Paginated patient list](/api-reference/patients/listPatients) | | `DELETE` | [Revoke lab access to a patient](/api-reference/patients/revokePatientLabAccess) | | `GET` | [Search patients (autocomplete / combobox)](/api-reference/patients/searchPatients) | | `PUT` | [Update a patient's details](/api-reference/patients/updatePatient) | --- # Pickup Requests Documentation: https://docs.guidelab.co/api-reference/pickup-requests ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------------------------------------------------- | | `POST` | [Create a pickup form element](/api-reference/pickup-requests/createPickupFormElement) | | `POST` | [Create a pickup request as a partner clinic](/api-reference/pickup-requests/createPickupRequest) | | `DELETE` | [Deactivate a pickup form element](/api-reference/pickup-requests/deletePickupFormElement) | | `PUT` | [Edit a clinic pickup request before it is scheduled](/api-reference/pickup-requests/updateRequestedPickup) | | `GET` | [Get a pickup form element by ID](/api-reference/pickup-requests/getPickupFormElement) | | `GET` | [Get a pickup request and its immutable history](/api-reference/pickup-requests/getPickupRequest) | | `GET` | [Get pickup request settings](/api-reference/pickup-requests/getPickupRequestSettings) | | `GET` | [Get the current pickup form for an active partnership](/api-reference/pickup-requests/getClinicPickupRequestForm) | | `GET` | [List pickup form elements](/api-reference/pickup-requests/listPickupFormElements) | | `GET` | [List pickup requests visible to the current organization](/api-reference/pickup-requests/listPickupRequests) | | `POST` | [Record a pickup attempt](/api-reference/pickup-requests/createPickupAttempt) | | `PUT` | [Reorder pickup form elements](/api-reference/pickup-requests/reorderPickupFormElements) | | `POST` | [Schedule, assign, route, collect, reschedule, or cancel a pickup](/api-reference/pickup-requests/commandPickupRequest) | | `PUT` | [Update a pickup form element](/api-reference/pickup-requests/updatePickupFormElement) | | `PUT` | [Update pickup request settings](/api-reference/pickup-requests/updatePickupRequestSettings) | --- # Practice Groups Documentation: https://docs.guidelab.co/api-reference/practice-groups ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------------------------------------- | | `POST` | [Assign partnerships to a practice group](/api-reference/practice-groups/assignPracticeGroupPartnerships) | | `POST` | [Create a practice group](/api-reference/practice-groups/createPracticeGroup) | | `DELETE` | [Deactivate a practice group](/api-reference/practice-groups/deletePracticeGroup) | | `GET` | [Get a practice group by ID](/api-reference/practice-groups/getPracticeGroup) | | `GET` | [List partnerships in a practice group](/api-reference/practice-groups/listPracticeGroupPartnerships) | | `GET` | [List practice groups](/api-reference/practice-groups/listPracticeGroups) | | `DELETE` | [Remove a partnership from a practice group](/api-reference/practice-groups/removePracticeGroupPartnership) | | `PUT` | [Update a practice group](/api-reference/practice-groups/updatePracticeGroup) | --- # Price Lists Documentation: https://docs.guidelab.co/api-reference/price-lists ## Endpoints [#endpoints] | Method | Endpoint | | -------- | -------------------------------------------------------------------------------------------------------- | | `POST` | [Archive a stable price book](/api-reference/price-lists/archivePriceList) | | `PUT` | [Assign a stable price book to a partnership](/api-reference/price-lists/assignPartnershipPriceList) | | `POST` | [Cancel a future publication](/api-reference/price-lists/cancelPriceListVersion) | | `POST` | [Create a stable price book](/api-reference/price-lists/createPriceList) | | `POST` | [Create the one editable draft for a price book](/api-reference/price-lists/createPriceListVersion) | | `DELETE` | [Delete a draft bundle rule](/api-reference/price-lists/deletePriceListBundleRule) | | `DELETE` | [Delete a draft product rule](/api-reference/price-lists/deletePriceListProductRule) | | `GET` | [Get a version with its product and bundle rules](/api-reference/price-lists/getPriceListVersion) | | `GET` | [List stable price books and their versions](/api-reference/price-lists/listPriceLists) | | `POST` | [Preview authoritative pricing without pinning an order](/api-reference/price-lists/previewOrderPricing) | | `POST` | [Publish an immutable effective-dated version](/api-reference/price-lists/publishPriceListVersion) | | `PUT` | [Set a draft bundle rule](/api-reference/price-lists/upsertPriceListBundleRule) | | `PUT` | [Set a draft product rule](/api-reference/price-lists/upsertPriceListProductRule) | | `POST` | [Shorten an active or future publication](/api-reference/price-lists/endPriceListVersion) | | `PATCH` | [Update draft defaults with optimistic concurrency](/api-reference/price-lists/updatePriceListVersion) | | `PATCH` | [Update stable price-book metadata](/api-reference/price-lists/updatePriceList) | --- # Production Documentation: https://docs.guidelab.co/api-reference/production ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ---------------------------------------------------------------------------------------------------------- | | `GET` | [Aggregate stats for a printer over a trailing window](/api-reference/production/getPrinterHistoryStats) | | `POST` | [Assign a room to a teammate](/api-reference/production/assignTeammateRoom) | | `POST` | [Bulk update tasks](/api-reference/production/bulkUpdateProductionTasks) | | `DELETE` | [Clear assignment fields for an order phase task](/api-reference/production/clearOrderPhaseTaskAssignment) | | `POST` | [Complete a print batch](/api-reference/production/completePrintBatch) | | `POST` | [Create a print batch](/api-reference/production/createPrintBatch) | | `POST` | [Create a printer](/api-reference/production/createPrinter) | | `POST` | [Create a production room](/api-reference/production/createProductionRoom) | | `POST` | [Create a task](/api-reference/production/createProductionTask) | | `GET` | [Cronologia: list activity rows for an order](/api-reference/production/listOrderActivity) | | `DELETE` | [Delete a print batch](/api-reference/production/deletePrintBatch) | | `DELETE` | [Delete a printer](/api-reference/production/deletePrinter) | | `DELETE` | [Delete a production room](/api-reference/production/deleteProductionRoom) | | `DELETE` | [Delete a task](/api-reference/production/deleteProductionTask) | | `POST` | [Fire a task (runs trigger + side effects, logs activity)](/api-reference/production/fireProductionTask) | | `GET` | [Get a print batch](/api-reference/production/getPrintBatch) | | `GET` | [Get a printer](/api-reference/production/getPrinter) | | `GET` | [Get a production room](/api-reference/production/getProductionRoom) | | `GET` | [Get a task](/api-reference/production/getProductionTask) | | `GET` | [Get production settings](/api-reference/production/getProductionSettings) | | `GET` | [Get production statistics overview](/api-reference/production/getProductionStatisticsOverview) | | `GET` | [Get teammate production settings](/api-reference/production/getTeammateSettings) | | `GET` | [Get teammate room assignments](/api-reference/production/getTeammateRoomAssignments) | | `GET` | [Get the task plan for an order](/api-reference/production/getOrderTaskPlan) | | `GET` | [List completed and failed print batches](/api-reference/production/listPrintBatchHistory) | | `GET` | [List orders assigned to a production room](/api-reference/production/listRoomRuntimeOrders) | | `GET` | [List print batches](/api-reference/production/listPrintBatches) | | `GET` | [List printers](/api-reference/production/listPrinters) | | `GET` | [List production rooms](/api-reference/production/listProductionRooms) | | `GET` | [List production tasks](/api-reference/production/listProductionTasks) | | `GET` | [List production teammates](/api-reference/production/listProductionTeammates) | | `POST` | [Mark a print batch as failed](/api-reference/production/failPrintBatch) | | `GET` | [Per-day scheduled-stage counts for a production room](/api-reference/production/getRoomScheduleCounts) | | `DELETE` | [Remove a teammate room assignment](/api-reference/production/removeTeammateRoomAssignment) | | `PUT` | [Reorder production rooms](/api-reference/production/reorderProductionRooms) | | `POST` | [Set per-order assignee/date/notes for a task](/api-reference/production/updateOrderPhaseTaskAssignment) | | `POST` | [Start a print batch](/api-reference/production/startPrintBatch) | | `GET` | [Storico: lab-wide activity feed](/api-reference/production/listProductionActivityFeed) | | `PUT` | [Update a printer](/api-reference/production/updatePrinter) | | `PUT` | [Update a production room](/api-reference/production/updateProductionRoom) | | `PATCH` | [Update a task](/api-reference/production/updateProductionTask) | | `PUT` | [Update production settings](/api-reference/production/updateProductionSettings) | | `PUT` | [Update teammate production settings](/api-reference/production/updateTeammateSettings) | | `PUT` | [Update teammate room permissions](/api-reference/production/updateTeammateRoomPermissions) | --- # Products Documentation: https://docs.guidelab.co/api-reference/products ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------------------------ | | `POST` | [Create a product](/api-reference/products/createProduct) | | `DELETE` | [Delete a product](/api-reference/products/deleteProduct) | | `DELETE` | [Delete custom field image](/api-reference/products/deleteCustomFieldImage) | | `DELETE` | [Delete product image](/api-reference/products/deleteProductImage) | | `GET` | [Get a product](/api-reference/products/getProduct) | | `GET` | [Get custom field image](/api-reference/products/getCustomFieldImage) | | `GET` | [Get product image](/api-reference/products/getProductImage) | | `GET` | [List product picker options](/api-reference/products/listProductOptions) | | `GET` | [List products](/api-reference/products/listProducts) | | `GET` | [List recent custom field templates](/api-reference/products/listRecentCustomFields) | | `PATCH` | [Partially update a product](/api-reference/products/patchProduct) | | `PUT` | [Update a product](/api-reference/products/updateProduct) | | `POST` | [Upload custom field image](/api-reference/products/uploadCustomFieldImage) | | `POST` | [Upload product image](/api-reference/products/uploadProductImage) | --- # Push Subscriptions Documentation: https://docs.guidelab.co/api-reference/push-subscriptions ## Endpoints [#endpoints] | Method | Endpoint | | -------- | -------------------------------------------------------------------------------------------- | | `GET` | [Get VAPID public key](/api-reference/push-subscriptions/getVapidPublicKey) | | `GET` | [List push subscriptions](/api-reference/push-subscriptions/listPushSubscriptions) | | `POST` | [Register push subscription](/api-reference/push-subscriptions/registerPushSubscription) | | `DELETE` | [Unregister push subscription](/api-reference/push-subscriptions/unregisterPushSubscription) | --- # Qc Checklist Documentation: https://docs.guidelab.co/api-reference/qc-checklist ## Endpoints [#endpoints] | Method | Endpoint | | -------- | --------------------------------------------------------------------------------- | | `POST` | [Create Qc Checklist Item](/api-reference/qc-checklist/createQcChecklistItem) | | `DELETE` | [Delete Qc Checklist Item](/api-reference/qc-checklist/deleteQcChecklistItem) | | `GET` | [List Qc Checklist Items](/api-reference/qc-checklist/listQcChecklistItems) | | `POST` | [Reorder Qc Checklist Items](/api-reference/qc-checklist/reorderQcChecklistItems) | | `PUT` | [Update Qc Checklist Item](/api-reference/qc-checklist/updateQcChecklistItem) | --- # Qc Settings Documentation: https://docs.guidelab.co/api-reference/qc-settings ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ----------------------------------------------------------------- | | `GET` | [Get Qc Settings](/api-reference/qc-settings/getQcSettings) | | `PUT` | [Update Qc Settings](/api-reference/qc-settings/updateQcSettings) | --- # Quality Control Documentation: https://docs.guidelab.co/api-reference/quality-control ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ----------------------------------------------------------------------------------- | | `GET` | [Get an order's revision-aware QC state](/api-reference/quality-control/getOrderQc) | | `POST` | [Record an immutable QC inspection](/api-reference/quality-control/completeOrderQc) | --- # Receiving Documentation: https://docs.guidelab.co/api-reference/receiving ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------- | | `POST` | [Create Receiving Source](/api-reference/receiving/createReceivingSource) | | `DELETE` | [Delete Receiving Source](/api-reference/receiving/deleteReceivingSource) | | `GET` | [List Receiving Categories](/api-reference/receiving/listReceivingCategories) | | `POST` | [Reorder Receiving Sources](/api-reference/receiving/reorderReceivingSources) | | `PUT` | [Update Receiving Category](/api-reference/receiving/updateReceivingCategory) | | `PUT` | [Update Receiving Source](/api-reference/receiving/updateReceivingSource) | --- # Remake Reasons Documentation: https://docs.guidelab.co/api-reference/remake-reasons ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ---------------------------------------------------------------------------- | | `POST` | [Create Remake Reason](/api-reference/remake-reasons/createRemakeReason) | | `DELETE` | [Delete Remake Reason](/api-reference/remake-reasons/deleteRemakeReason) | | `GET` | [List Remake Reasons](/api-reference/remake-reasons/listRemakeReasons) | | `POST` | [Reorder Remake Reasons](/api-reference/remake-reasons/reorderRemakeReasons) | | `PUT` | [Update Remake Reason](/api-reference/remake-reasons/updateRemakeReason) | --- # Reports Documentation: https://docs.guidelab.co/api-reference/reports ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ---------------------------------------------------------------------------------- | | `POST` | [Create a custom report](/api-reference/reports/createReport) | | `DELETE` | [Delete a custom report](/api-reference/reports/deleteReport) | | `POST` | [Execute a report query](/api-reference/reports/executeReport) | | `POST` | [Export a report as CSV](/api-reference/reports/exportReport) | | `GET` | [Get a report by ID](/api-reference/reports/getReport) | | `GET` | [List available report data sources](/api-reference/reports/listReportDataSources) | | `GET` | [List reports](/api-reference/reports/listReports) | | `PATCH` | [Update a report](/api-reference/reports/updateReport) | --- # Scan Inbox Documentation: https://docs.guidelab.co/api-reference/scan-inbox ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ----------------------------------------------------------------------------------------- | | `POST` | [Assign scan inbox item to existing order](/api-reference/scan-inbox/assignScanInboxItem) | | `POST` | [Book scan inbox item as new order](/api-reference/scan-inbox/bookScanInboxItem) | | `POST` | [Bulk action on scan inbox items](/api-reference/scan-inbox/bulkScanInboxAction) | | `POST` | [Dismiss a scan inbox item](/api-reference/scan-inbox/dismissScanInboxItem) | | `GET` | [List scan inbox items](/api-reference/scan-inbox/listScanInboxItems) | | `POST` | [Re-run matching for a scan inbox item](/api-reference/scan-inbox/matchScanInboxItem) | | `POST` | [Sync scan inbox from scanner connections](/api-reference/scan-inbox/syncScanInbox) | --- # Scanner Connections Documentation: https://docs.guidelab.co/api-reference/scanner-connections ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------------------------- | | `POST` | [Create Scanner Connection](/api-reference/scanner-connections/createScannerConnection) | | `DELETE` | [Delete Scanner Connection](/api-reference/scanner-connections/deleteScannerConnection) | | `POST` | [Disconnect Scanner Connection](/api-reference/scanner-connections/disconnectScannerConnection) | | `GET` | [Get Scanner Connection](/api-reference/scanner-connections/getScannerConnection) | | `GET` | [Get Scanner Connection Case](/api-reference/scanner-connections/getScannerConnectionCase) | | `GET` | [Handle Itero O Auth Callback](/api-reference/scanner-connections/handleIteroOAuthCallback) | | `GET` | [Handle Medit O Auth Callback](/api-reference/scanner-connections/handleMeditOAuthCallback) | | `GET` | [Handle3 Shape O Auth Callback](/api-reference/scanner-connections/handle3ShapeOAuthCallback) | | `POST` | [Import Scanner Case](/api-reference/scanner-connections/importScannerCase) | | `POST` | [Import Scanner Files](/api-reference/scanner-connections/importScannerFiles) | | `POST` | [Initiate Scanner O Auth](/api-reference/scanner-connections/initiateScannerOAuth) | | `GET` | [List Itero Related Accounts](/api-reference/scanner-connections/listIteroRelatedAccounts) | | `GET` | [List Scanner Connection Cases](/api-reference/scanner-connections/listScannerConnectionCases) | | `GET` | [List Scanner Connections](/api-reference/scanner-connections/listScannerConnections) | | `POST` | [Pair Itero Account](/api-reference/scanner-connections/pairIteroAccount) | | `POST` | [Setup Medit Webhook](/api-reference/scanner-connections/setupMeditWebhook) | | `POST` | [Sync Scanner Connection](/api-reference/scanner-connections/syncScannerConnection) | | `POST` | [Test Scanner Connection](/api-reference/scanner-connections/testScannerConnection) | | `PUT` | [Update Scanner Connection](/api-reference/scanner-connections/updateScannerConnection) | --- # Scanner Settings Documentation: https://docs.guidelab.co/api-reference/scanner-settings ## Endpoints [#endpoints] | Method | Endpoint | | ------ | -------------------------------------------------------------------------------- | | `GET` | [Get Scanner Settings](/api-reference/scanner-settings/getScannerSettings) | | `PUT` | [Update Scanner Settings](/api-reference/scanner-settings/updateScannerSettings) | --- # Search Documentation: https://docs.guidelab.co/api-reference/search ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ----------------------------------------------------------------------- | | `GET` | [Global search across all entities](/api-reference/search/searchGlobal) | --- # Shade Systems Documentation: https://docs.guidelab.co/api-reference/shade-systems ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------------------ | | `POST` | [Create a shade system](/api-reference/shade-systems/createShadeSystem) | | `DELETE` | [Delete a shade system](/api-reference/shade-systems/deleteShadeSystem) | | `DELETE` | [Delete shade value image](/api-reference/shade-systems/deleteShadeValueImage) | | `GET` | [Get a shade system](/api-reference/shade-systems/getShadeSystem) | | `GET` | [Get shade value image](/api-reference/shade-systems/getShadeValueImage) | | `GET` | [List shade systems](/api-reference/shade-systems/listShadeSystems) | | `PATCH` | [Patch a shade system](/api-reference/shade-systems/patchShadeSystem) | | `PUT` | [Update a shade system](/api-reference/shade-systems/updateShadeSystem) | | `POST` | [Upload shade value image](/api-reference/shade-systems/uploadShadeValueImage) | --- # Shipments Documentation: https://docs.guidelab.co/api-reference/shipments ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ---------------------------------------------------------------------------------------------------------------------- | | `POST` | [Attach a manually purchased carrier label](/api-reference/shipments/createManualShipmentLabel) | | `POST` | [Create a quantity-level outbound shipment](/api-reference/shipments/createShipment) | | `GET` | [Download an authorized immutable carrier-label PDF](/api-reference/shipments/downloadShipmentLabelDocument) | | `GET` | [Get an outbound shipment](/api-reference/shipments/getShipment) | | `GET` | [Get durable provider operation status](/api-reference/shipments/getShipmentProviderOperation) | | `GET` | [List outbound shipments visible to the active organization](/api-reference/shipments/listShipments) | | `POST` | [Purchase a ShipStation label from a signed rate](/api-reference/shipments/purchaseProviderShipmentLabel) | | `POST` | [Quote bounded ShipStation rates for one shipment package](/api-reference/shipments/quoteShipmentPackageRates) | | `POST` | [Record a replay-safe package pack/unpack scan](/api-reference/shipments/recordShipmentScan) | | `POST` | [Transition an outbound shipment](/api-reference/shipments/transitionShipment) | | `POST` | [Void a ShipStation label without repeating the provider mutation](/api-reference/shipments/voidProviderShipmentLabel) | | `POST` | [Void an attached manual carrier label](/api-reference/shipments/voidShipmentLabel) | --- # Standards Documentation: https://docs.guidelab.co/api-reference/standards ## Endpoints [#endpoints] | Method | Endpoint | | ------- | -------------------------------------------------------------------------------- | | `POST` | [Create a quality standard](/api-reference/standards/createStandard) | | `GET` | [List quality standards](/api-reference/standards/listStandards) | | `PATCH` | [Toggle quality standard active status](/api-reference/standards/toggleStandard) | | `PUT` | [Update a quality standard](/api-reference/standards/updateStandard) | --- # Statements Documentation: https://docs.guidelab.co/api-reference/statements ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ----------------------------------------------------------------- | | `POST` | [Email Statement](/api-reference/statements/emailStatement) | | `POST` | [Generate Statement](/api-reference/statements/generateStatement) | | `GET` | [Get Statement](/api-reference/statements/getStatement) | | `GET` | [List Statements](/api-reference/statements/listStatements) | --- # Sticker Templates Documentation: https://docs.guidelab.co/api-reference/sticker-templates ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------------------------------------- | | `POST` | [Create Sticker Template](/api-reference/sticker-templates/createStickerTemplate) | | `POST` | [Create Sticker Template Category](/api-reference/sticker-templates/createStickerTemplateCategory) | | `DELETE` | [Delete Sticker Template](/api-reference/sticker-templates/deleteStickerTemplate) | | `DELETE` | [Delete Sticker Template Category](/api-reference/sticker-templates/deleteStickerTemplateCategory) | | `DELETE` | [Delete Sticker Template Preview Image](/api-reference/sticker-templates/deleteStickerTemplatePreviewImage) | | `POST` | [Generate Sticker Pdf](/api-reference/sticker-templates/generateStickerPdf) | | `GET` | [Get Sticker Template](/api-reference/sticker-templates/getStickerTemplate) | | `GET` | [Get Sticker Template Category](/api-reference/sticker-templates/getStickerTemplateCategory) | | `GET` | [Get Sticker Template Preview Image](/api-reference/sticker-templates/getStickerTemplatePreviewImage) | | `GET` | [List Sticker Template Categories](/api-reference/sticker-templates/listStickerTemplateCategories) | | `GET` | [List Sticker Templates](/api-reference/sticker-templates/listStickerTemplates) | | `GET` | [Preview Sticker Template](/api-reference/sticker-templates/previewStickerTemplate) | | `PUT` | [Update Sticker Template](/api-reference/sticker-templates/updateStickerTemplate) | | `PUT` | [Update Sticker Template Category](/api-reference/sticker-templates/updateStickerTemplateCategory) | | `POST` | [Upload Sticker Template Preview Image](/api-reference/sticker-templates/uploadStickerTemplatePreviewImage) | --- # Stripe Connect Documentation: https://docs.guidelab.co/api-reference/stripe-connect ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ------------------------------------------------------------------------------------------------------- | | `POST` | [Disconnect Stripe Connect](/api-reference/stripe-connect/disconnectStripeConnect) | | `GET` | [Get Stripe Connect Dashboard Link](/api-reference/stripe-connect/getStripeConnectDashboardLink) | | `GET` | [Get Stripe Connect Status](/api-reference/stripe-connect/getStripeConnectStatus) | | `GET` | [Handle Stripe Connect O Auth Callback](/api-reference/stripe-connect/handleStripeConnectOAuthCallback) | | `POST` | [Onboard Stripe Connect](/api-reference/stripe-connect/onboardStripeConnect) | | `POST` | [Refresh Stripe Connect Status](/api-reference/stripe-connect/refreshStripeConnectStatus) | | `POST` | [Start Stripe Connect O Auth](/api-reference/stripe-connect/startStripeConnectOAuth) | --- # Team Documentation: https://docs.guidelab.co/api-reference/team ## Endpoints [#endpoints] | Method | Endpoint | | -------- | -------------------------------------------------------------------------------------- | | `POST` | [Cancel a pending invitation](/api-reference/team/cancelTeamInvitation) | | `POST` | [Create and send team invitation](/api-reference/team/createTeamInvitation) | | `GET` | [List pending invitations](/api-reference/team/listPendingInvitations) | | `GET` | [List team members](/api-reference/team/listTeamMembers) | | `DELETE` | [Remove team member](/api-reference/team/removeTeamMember) | | `POST` | [Resend a pending invitation](/api-reference/team/resendTeamInvitation) | | `POST` | [Send password reset email to team member](/api-reference/team/sendPasswordResetEmail) | | `POST` | [Transfer organization ownership](/api-reference/team/transferOrganizationOwnership) | | `PATCH` | [Update team member role](/api-reference/team/updateTeamMemberRole) | --- # Transactions Documentation: https://docs.guidelab.co/api-reference/transactions ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ----------------------------------------------------------------- | | `GET` | [List Transactions](/api-reference/transactions/listTransactions) | --- # Treatment Phases Documentation: https://docs.guidelab.co/api-reference/treatment-phases ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------------------------------- | | `POST` | [Create a treatment phase](/api-reference/treatment-phases/createTreatmentPhase) | | `DELETE` | [Delete a treatment phase](/api-reference/treatment-phases/deleteTreatmentPhase) | | `GET` | [Get a treatment phase](/api-reference/treatment-phases/getTreatmentPhase) | | `GET` | [List treatment phases](/api-reference/treatment-phases/listTreatmentPhases) | | `POST` | [Reorder tasks within a treatment phase](/api-reference/treatment-phases/reorderPhaseTasks) | | `POST` | [Reorder treatment phases](/api-reference/treatment-phases/reorderTreatmentPhases) | | `PUT` | [Update a treatment phase](/api-reference/treatment-phases/updateTreatmentPhase) | --- # Users Documentation: https://docs.guidelab.co/api-reference/users ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------------------- | | `GET` | [Get notification preferences](/api-reference/users/getUserNotificationPreferences) | | `DELETE` | [Remove current user avatar](/api-reference/users/deleteUserAvatar) | | `GET` | [Serve a user avatar](/api-reference/users/getUserAvatar) | | `PUT` | [Update current user language preference](/api-reference/users/updateUserLanguage) | | `PUT` | [Update current user phone number](/api-reference/users/updateUserPhone) | | `PUT` | [Update notification preferences](/api-reference/users/updateUserNotificationPreferences) | | `POST` | [Upload current user avatar](/api-reference/users/uploadUserAvatar) | --- # Webhooks Documentation: https://docs.guidelab.co/api-reference/webhooks ## Endpoints [#endpoints] | Method | Endpoint | | ------ | ---------------------------------------------------------------------------------------------------- | | `POST` | [Handle Medit scanner webhook events](/api-reference/webhooks/handleMeditWebhook) | | `POST` | [Handle ShipEngine tracking webhook events](/api-reference/webhooks/handleShipEngineTrackingWebhook) | | `POST` | [Handle Stripe Connect webhook events](/api-reference/webhooks/handleStripeConnectWebhook) | --- # Whatsapp Templates Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ----------------------------------------------------------------------------------------------------------------- | | `POST` | [Create Whats App Template](/api-reference/whatsapp-templates/createWhatsAppTemplate) | | `DELETE` | [Delete Whats App Template](/api-reference/whatsapp-templates/deleteWhatsAppTemplate) | | `DELETE` | [Delete Whats App Template Event Override](/api-reference/whatsapp-templates/deleteWhatsAppTemplateEventOverride) | | `GET` | [Get Whats App Template](/api-reference/whatsapp-templates/getWhatsAppTemplate) | | `GET` | [List Whats App Template Event Candidates](/api-reference/whatsapp-templates/listWhatsAppTemplateEventCandidates) | | `GET` | [List Whats App Template Event Overrides](/api-reference/whatsapp-templates/listWhatsAppTemplateEventOverrides) | | `GET` | [List Whats App Templates](/api-reference/whatsapp-templates/listWhatsAppTemplates) | | `POST` | [Register Whats App Template](/api-reference/whatsapp-templates/registerWhatsAppTemplate) | | `PUT` | [Set Whats App Template Event Override](/api-reference/whatsapp-templates/setWhatsAppTemplateEventOverride) | | `POST` | [Sync All Whats App Templates](/api-reference/whatsapp-templates/syncAllWhatsAppTemplates) | | `POST` | [Sync Whats App Template](/api-reference/whatsapp-templates/syncWhatsAppTemplate) | | `POST` | [Test Whats App Template](/api-reference/whatsapp-templates/testWhatsAppTemplate) | | `PUT` | [Update Whats App Template](/api-reference/whatsapp-templates/updateWhatsAppTemplate) | --- # Work Trays Documentation: https://docs.guidelab.co/api-reference/work-trays ## Endpoints [#endpoints] | Method | Endpoint | | -------- | ------------------------------------------------------------------------- | | `POST` | [Batch Create Work Trays](/api-reference/work-trays/batchCreateWorkTrays) | | `POST` | [Create Work Tray](/api-reference/work-trays/createWorkTray) | | `DELETE` | [Delete Work Tray](/api-reference/work-trays/deleteWorkTray) | | `GET` | [List Work Trays](/api-reference/work-trays/listWorkTrays) | | `PUT` | [Update Work Tray](/api-reference/work-trays/updateWorkTray) | --- # Authentication How requests to the GuideLab API are authenticated. Documentation: https://docs.guidelab.co/authentication Almost every GuideLab endpoint requires an authenticated request. The API accepts two authentication schemes; pick whichever fits your client. ## Session cookie (web app) [#session-cookie-web-app] The GuideLab web app authenticates with [Better Auth](https://www.better-auth.com). After signing in, the browser holds a session cookie named **`__Secure-guidelab-prod.session_token`**, which is sent automatically with every request to `api.guidelab.co`. This is the scheme used by the first‑party web app — you generally don't manage it yourself; it is set by the sign‑in flow and refreshed by the auth layer. ```http GET /orders HTTP/1.1 Host: api.guidelab.co Cookie: __Secure-guidelab-prod.session_token= ``` ## Native device credential (desktop / programmatic clients) [#native-device-credential-desktop--programmatic-clients] Non-browser clients authenticate with a versioned GuideLab device credential issued by `POST /auth/device/v1/sign-in`. Send that credential in the `Authorization` header. Better Auth browser session tokens are cookie-only and are not accepted as bearer credentials. ```http GET /orders HTTP/1.1 Host: api.guidelab.co Authorization: Bearer gl_device_v1_ ``` ```bash curl "https://api.guidelab.co/orders" \ -H "Authorization: Bearer gl_device_v1_" ``` Cookie sessions and device credentials resolve to the same user and organization authorization context. `bearerAuth` in the OpenAPI document means this versioned device credential, not a Better Auth session token. ## Organization context [#organization-context] GuideLab is multi‑tenant. An authenticated session is bound to a single **organization** (a lab or a clinic) and a **role** within it (`owner` or `staff`). Endpoints automatically operate on that organization's data, and some are restricted: * **By organization type** — e.g. lab‑only or clinic‑only endpoints. * **By role** — e.g. owner‑only settings endpoints. A request that is authenticated but lacks the required type or role receives a [`403`](/errors) response. ## Unauthenticated requests [#unauthenticated-requests] Requests without a valid session cookie or native device credential receive a [`401 Unauthorized`](/errors). A small number of endpoints (such as inbound [webhooks](/webhooks) and health checks) are public and do not require authentication. --- # Errors Error response format and the status codes the API returns. Documentation: https://docs.guidelab.co/errors The GuideLab API uses conventional HTTP status codes to indicate the result of a request, and returns a consistent JSON envelope for failures. ## Error envelope [#error-envelope] Errors respond with a JSON body containing an `error` message and, optionally, a `details` field with structured context (for example, field‑level validation issues): ```json { "error": "Invalid query parameters", "details": { "limit": "Expected number, received string" } } ``` | Field | Type | Description | | --------- | ------ | ----------------------------------------------------- | | `error` | string | Human‑readable description of what went wrong. | | `details` | any? | Optional structured details (e.g. validation errors). | ## Status codes [#status-codes] | Status | Meaning | | ------ | ---------------------------------------------------------------------- | | `200` | **OK** — the request succeeded. | | `201` | **Created** — a new resource was created. | | `400` | **Bad Request** — invalid input (failed validation, malformed body). | | `401` | **Unauthorized** — invalid session or native device credential. | | `403` | **Forbidden** — authenticated, but lacking the required org type/role. | | `404` | **Not Found** — the resource does not exist or isn't in your org. | | `409` | **Conflict** — the request conflicts with current state. | | `500` | **Internal Server Error** — an unexpected error occurred. | A `401` means the request wasn't authenticated — see [Authentication](/authentication). A `403` means it **was** authenticated but the session's organization type or role isn't permitted for that endpoint. ## Validation errors [#validation-errors] Request bodies and query parameters are validated with [Zod](https://zod.dev). When validation fails, the API responds with `400` and includes the offending fields in `details` so clients can surface precise messages. --- # GuideLab API REST API for GuideLab — clinics, labs, workflows, finance, files, and integrations. Documentation: https://docs.guidelab.co/ The **GuideLab API** is a REST API for the GuideLab dental lab management platform. It powers everything the web and desktop apps do: managing orders and patients, running production workflows, handling invoicing and payments, uploading clinical files, and integrating with scanners and third‑party tools. All requests are made to **`https://api.guidelab.co`**. The full machine‑readable specification is available at [`/api/openapi`](/api/openapi). ## Conventions [#conventions] * **Protocol** — HTTPS only. Requests and responses are JSON unless an endpoint explicitly deals with file uploads or downloads. * **Authentication** — every non‑public endpoint requires an authenticated session cookie or native device credential. See [Authentication](/authentication). * **Multi‑tenant** — GuideLab is multi‑tenant. Your session is scoped to an organization (a **lab** or a **clinic**), and endpoints operate on the data for that organization. Some routes are restricted to a specific organization type or role. * **Pagination** — list endpoints share a common page/limit contract. See [Pagination](/pagination). * **Errors** — failures use a consistent JSON envelope and standard HTTP status codes. See [Errors](/errors). ## API reference [#api-reference] The [API reference](/api-reference) is generated directly from the API's OpenAPI 3.1 specification. Endpoints are grouped by area — Orders, Patients, Partnerships, Invoices, Production, Files, and many more — with the full request and response schema for each operation. ## Using the docs with AI [#using-the-docs-with-ai] Every page can be exported as Markdown for use with an LLM: * **Copy for AI** / **Open** buttons at the top of each page. * [`/llms-full.txt`](/llms-full.txt) — the entire documentation as a single plain‑text file. * Append `.mdx` to any page URL to get its Markdown source. --- # Pagination How list endpoints page, limit, and search results. Documentation: https://docs.guidelab.co/pagination List endpoints share a common pagination contract. You request a page with query parameters, and the response includes the items plus pagination metadata. ## Query parameters [#query-parameters] | Parameter | Type | Default | Description | | --------- | ------- | ------- | -------------------------------- | | `page` | integer | `1` | Page number (1‑based). | | `limit` | integer | `20` | Items per page. | | `search` | string | — | Optional free‑text search query. | ```bash curl "https://api.guidelab.co/patients?page=2&limit=50&search=smith" \ -H "Authorization: Bearer gl_device_v1_" ``` ## Response metadata [#response-metadata] Paginated responses include a `pagination` object alongside the data: ```json { "data": [ /* … items … */ ], "pagination": { "page": 2, "limit": 50, "total": 327, "totalPages": 7 } } ``` | Field | Type | Description | | ------------ | ------- | ----------------------------------------- | | `page` | integer | The current page number. | | `limit` | integer | Items per page used for this response. | | `total` | integer | Total number of items matching the query. | | `totalPages` | integer | Total number of pages. | The exact shape of the data array and any additional filters are documented per endpoint in the [API reference](/api-reference). `page`, `limit`, and `search` are consistent across all paginated list endpoints. --- # Webhooks Inbound webhooks GuideLab receives from third‑party services. Documentation: https://docs.guidelab.co/webhooks GuideLab exposes a small number of **inbound** webhook endpoints under `/webhooks`. These are called by external services — they are not events that GuideLab sends to your servers. Each is verified against the provider's signature and is therefore public (no GuideLab session required). ## Endpoints [#endpoints] | Method | Path | Source | | ------ | -------------------------- | ----------------------------------------- | | `POST` | `/webhooks/stripe-connect` | Stripe Connect — payment & account events | | `POST` | `/webhooks/medit` | Medit — scanner / case events | See the [Webhooks section of the API reference](/api-reference/webhooks) for the full payloads and responses. ## Stripe Connect [#stripe-connect] `POST /webhooks/stripe-connect` receives [Stripe Connect](https://stripe.com/connect) events (payments, payouts, and connected‑account updates) and reconciles them with GuideLab's finance records. Stripe signs each request; GuideLab verifies the signature before processing. ## Medit [#medit] `POST /webhooks/medit` receives events from the [Medit](https://www.medit.com) scanner integration, used to ingest scan data into the relevant case. These endpoints are configured in the respective provider dashboards to point at `https://api.guidelab.co/webhooks/…`. You don't call them directly — they're documented here so the behaviour of the integration is transparent. --- # List files `GET https://api-stage.guidelab.co/files` Returns a paginated list of files for the current organization. Labs see all files; clinics see only their own. Supports filtering by patient, clinic, file type, and unassigned status. Documentation: https://docs.guidelab.co/api-reference/files/listFiles ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Page number Default: `1` - `limit` (integer) (in: query): Items per page Default: `20` - `patientId` (string) (in: query): Filter by patient ID - `clinicId` (string) (in: query): Filter by clinic ID (lab only) - `type` (string) (in: query): Filter by file type: scan, photo, prescription, xray, other - `unassigned` () (in: query): Show only files not attached to an order Default: `false` - `search` (string) (in: query): Search by file name ## Responses ### 200: Paginated list of files with patient and order info - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `partnershipId` (string,null) **(required)**: - `uploadedByOrganizationId` (string) **(required)**: - `name` (string) **(required)**: - `type` (string) **(required)**: - `mimeType` (string) **(required)**: - `size` (number) **(required)**: - `url` (string) **(required)**: - `thumbnailUrl` (string,null) **(required)**: - `patientId` (string,null) **(required)**: - `patientName` (string,null) **(required)**: - `orderId` (string,null) **(required)**: - `orderDisplayId` (string,null) **(required)**: - `orderStatus` (string,null) **(required)**: - `uploadedBy` (string) **(required)**: - `createdAt` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/files" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload a file `POST https://api-stage.guidelab.co/files/upload` Uploads a small file directly via multipart form data. Large files must use the presigned upload/finalize flow. Optionally attach to a patient, order, or order item. A thumbnail can be uploaded alongside the main file. Documentation: https://docs.guidelab.co/api-reference/files/uploadFile ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 201: File uploaded and record created - `id` (string) **(required)**: - `partnershipId` (string,null) **(required)**: - `uploadedByOrganizationId` (string) **(required)**: - `name` (string) **(required)**: - `type` (string) **(required)**: - `mimeType` (string) **(required)**: - `size` (number) **(required)**: - `url` (string) **(required)**: - `thumbnailUrl` (string,null) **(required)**: - `orderId` (string,null) **(required)**: - `patientId` (string,null) **(required)**: - `orderItemId` (string,null) **(required)**: - `fileRequirementId` (string,null) **(required)**: - `createdAt` (string) **(required)**: ### 400: Missing file, invalid type, or file too large ### 401: Unauthorized — valid session required ### 409: Clinic standalone storage limit exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/files/upload" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get presigned upload URL `POST https://api-stage.guidelab.co/files/presign` Generates a presigned PUT URL so the client can upload directly to storage. No file DB row is created until the client calls finalize after a successful upload. Optionally returns a second signed PUT URL for a thumbnail. Valid for 5 minutes. Documentation: https://docs.guidelab.co/api-reference/files/presignFileUpload ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `filename` (string) **(required)**: - `contentType` (string): - `size` (integer) **(required)**: - `orderId` (string): - `patientId` (string): - `orderItemId` (string): - `fileRequirementId` (string): - `treatmentPhaseId` (string): - `orderPhaseId` (string): - `type` (string): Values: `scan`, `photo`, `prescription`, `xray`, `other` - `thumbnailSize` (integer): ## Responses ### 201: Presigned upload URL(s) and finalize token returned - `fileId` (string) **(required)**: - `uploadUrl` (string) **(required)**: - `uploadContentType` (string) **(required)**: - `thumbnailUploadUrl` (string,null) **(required)**: - `thumbnailUploadContentType` (string,null) **(required)**: - `finalizeToken` (string) **(required)**: ### 400: Missing required fields, invalid file type, or file too large ### 401: Unauthorized — valid session required ### 409: Clinic standalone storage limit exceeded ### 429: Upload issuance budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/files/presign" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "filename": "string", "size": 0 }' ``` --- # Finalize a direct file upload `POST https://api-stage.guidelab.co/files/finalize` Confirms that a previously presigned upload completed successfully, validates the stored object metadata and size, and then creates the file DB record. Documentation: https://docs.guidelab.co/api-reference/files/finalizeFileUpload ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `finalizeToken` (string) **(required)**: ## Responses ### 200: File record created or already finalized - `id` (string) **(required)**: - `partnershipId` (string,null) **(required)**: - `uploadedByOrganizationId` (string) **(required)**: - `name` (string) **(required)**: - `type` (string) **(required)**: - `mimeType` (string) **(required)**: - `size` (number) **(required)**: - `url` (string) **(required)**: - `thumbnailUrl` (string,null) **(required)**: - `orderId` (string,null) **(required)**: - `patientId` (string,null) **(required)**: - `orderItemId` (string,null) **(required)**: - `fileRequirementId` (string,null) **(required)**: - `createdAt` (string) **(required)**: ### 400: Invalid finalize token or upload is incomplete ### 401: Unauthorized — valid session required ### 403: Upload belongs to a different user ### 404: Referenced order or patient not found ### 409: Upload finalization conflicted ## Example ```bash curl -X POST "https://api-stage.guidelab.co/files/finalize" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "finalizeToken": "string" }' ``` --- # Copy files to an order `POST https://api-stage.guidelab.co/files/copy-to-order` Copies existing patient file objects to unique storage keys and associates the copies with a different order. Documentation: https://docs.guidelab.co/api-reference/files/copyFilesToOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `idempotency-key` (string) **(required)** (in: header): Stable key reused only when retrying the exact same command body ## Request Body Content-Type: `application/json` - `fileIds` (string[]) **(required)**: - `orderId` (string) **(required)**: - `patientId` (string): - `fileRequirementId` (string): - `treatmentPhaseId` (string): ## Responses ### 201: New file records created for the target order - `files` (object[]) **(required)**: - `id` (string) **(required)**: - `partnershipId` (string) **(required)**: - `uploadedByOrganizationId` (string) **(required)**: - `name` (string) **(required)**: - `type` (string) **(required)**: - `mimeType` (string) **(required)**: - `size` (number) **(required)**: - `url` (string) **(required)**: - `thumbnailUrl` (string,null) **(required)**: - `orderId` (string) **(required)**: - `patientId` (string,null) **(required)**: - `fileRequirementId` (string,null) **(required)**: - `createdAt` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized — valid session required ### 404: No matching files or order not found ### 409: A file belongs to a different partnership epoch ### 413: The requested copies exceed the aggregate byte limit ### 429: Copy budget exceeded ### 502: A source object could not be copied ## Example ```bash curl -X POST "https://api-stage.guidelab.co/files/copy-to-order" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "fileIds": [ "string" ], "orderId": "string", "patientId": "string", "fileRequirementId": "string", "treatmentPhaseId": "string" }' ``` --- # Reassign files between orders `POST https://api-stage.guidelab.co/files/reassign` Moves files from one order to another, updating order item and file requirement associations. S3 objects stay in place — only DB records are updated. Documentation: https://docs.guidelab.co/api-reference/files/reassignFiles ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `fromOrderId` (string) **(required)**: - `toOrderId` (string) **(required)**: - `assignments` (object[]) **(required)**: - `fileId` (string) **(required)**: - `orderItemId` (string,null): - `fileRequirementId` (string,null): - `treatmentPhaseId` (string,null): ## Responses ### 200: Files reassigned successfully - `success` (boolean) **(required)**: - `reassigned` (number) **(required)**: ### 400: Invalid request body ### 401: Unauthorized — valid session required ### 404: Destination order not found ### 409: A delivery-proof file cannot be reassigned ## Example ```bash curl -X POST "https://api-stage.guidelab.co/files/reassign" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "fromOrderId": "string", "toOrderId": "string", "assignments": [ { "fileId": "string", "orderItemId": "string", "fileRequirementId": "string", "treatmentPhaseId": "string" } ] }' ``` --- # Delete a file `DELETE https://api-stage.guidelab.co/files/{id}` Archives (soft-deletes) a file: the record and its R2 object are retained, and a retention job physically purges them after the retention window. Only an owner of the owning organization may archive; delivery-proof files and files attached to non-draft orders are immutable. Documentation: https://docs.guidelab.co/api-reference/files/deleteFile ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): File ID ## Responses ### 200: File archived successfully - `success` (boolean) **(required)**: ### 400: File ID is required ### 401: Unauthorized — valid session required ### 403: Forbidden — owner role required ### 404: File not found or not owned by current organization ### 409: File is retained, attached to a non-draft order, or its partnership epoch is no longer writable ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/files/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Download a file `GET https://api-stage.guidelab.co/files/{id}/download` Streams the file content directly from R2 through the Worker (R2 egress is free; this avoids presigned-URL redirects and CORS surprises). Pass `?thumbnail=true` for the thumbnail variant. Documentation: https://docs.guidelab.co/api-reference/files/downloadFile ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): File ID - `thumbnail` (string) (in: query): Return thumbnail variant Values: `true`, `false` ## Responses ### 200: File content streamed directly from R2 ### 401: Unauthorized — valid session required ### 404: File not found or not owned by current organization ## Example ```bash curl -X GET "https://api-stage.guidelab.co/files/{id}/download" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List orders `GET https://api-stage.guidelab.co/orders` Returns a paginated list of orders for the authenticated user's organization. Supports filtering by status, date range, search, and other criteria. Labs see orders where they are the lab; clinics see orders where they are the clinic. Documentation: https://docs.guidelab.co/api-reference/orders/listOrders ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Page number Default: `1` - `limit` (integer) (in: query): Items per page Default: `20` - `view` (string) (in: query): Response projection. The backward-compatible default returns the full order shape; compact omits detail-only fields for list UIs. Values: `full`, `compact` Default: `full` - `cursor` (string) (in: query): Opaque cursor returned by the previous non-search page. Send it with the matching page, filters, and sort. Search results continue to use page-based pagination. - `status` (string) (in: query): Comma-separated status filter - `type` (string) (in: query): Comma-separated order type filter (digital, physical) - `search` (string) (in: query): Search by order number, patient name, doctor name, or partner org - `sortBy` (string) (in: query): Field to sort by Values: `createdAt`, `dueDate`, `deadline`, `submittedAt`, `orderNumber`, `status` Default: `createdAt` - `sortOrder` (string) (in: query): Sort direction Values: `asc`, `desc` Default: `desc` - `clinicId` (string) (in: query): Filter by clinic ID - `patientId` (string) (in: query): Filter by patient ID - `doctorUserId` (string) (in: query): Filter by doctor user ID - `labId` (string) (in: query): Filter by lab ID - `doctorName` (string) (in: query): Filter by doctor name - `hasFiles` () (in: query): Filter orders that have files - `hasAdvanceRequest` () (in: query): Filter orders with pending phase advance requests - `includeAll` () (in: query): Include completed and cancelled orders. Archived orders are always excluded. Default: `false` - `withBadgeCounts` () (in: query): Include submittedCount and onHoldCount in response metadata (org-wide, unfiltered) Default: `false` ## Responses ### 200: Paginated list of orders with metadata - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: - `hasMore` (boolean) **(required)**: - `nextCursor` (string,null) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get filter options for orders `GET https://api-stage.guidelab.co/orders/filter-options` Returns available filter options for the order list, including distinct doctor names, partner organizations (labs for clinics, clinics for labs), and patients (clinics only). Used to populate filter dropdowns in the UI. Each list is capped; `truncated` reports which lists were cut short so the UI can offer a search instead of a partial dropdown. Documentation: https://docs.guidelab.co/api-reference/orders/getOrderFilterOptions ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Filter options including doctors, partners, and patients - `doctors` (string[]) **(required)**: - `patients` (object[]): - `id` (string) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `labs` (object[]): - `id` (string) **(required)**: - `name` (string) **(required)**: - `clinics` (object[]): - `id` (string) **(required)**: - `name` (string) **(required)**: - `truncated` (object) **(required)**: - `doctors` (boolean) **(required)**: - `patients` (boolean) **(required)**: - `partners` (boolean) **(required)**: ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/filter-options" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get orders needing approval `GET https://api-stage.guidelab.co/orders/needs-approval` Returns a paginated list of submitted orders awaiting lab approval, with line items, files, work tray assignments, and unread message counts. Lab only. Supports fuzzy search across order number, PAN number, doctor name, clinic name, and patient name. Documentation: https://docs.guidelab.co/api-reference/orders/getOrdersNeedingApproval ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (string) (in: query): Page number (default: 1) - `limit` (string) (in: query): Items per page (default: 20, max: 50) - `search` (string) (in: query): Fuzzy search term ## Responses ### 200: Paginated list of submitted orders with items, files, and unread counts - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 401: Unauthorized ### 403: Only labs can view orders needing approval ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/needs-approval" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get dispatched orders `GET https://api-stage.guidelab.co/orders/shipped` Returns orders with a dispatched shipment and every consignment associated with each order. Shipment state is independent from the canonical order lifecycle. Documentation: https://docs.guidelab.co/api-reference/orders/getShippedOrders ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `search` (string) (in: query): ## Responses ### 200: Paginated shipped orders - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: - `status` (string) **(required)**: Values: `draft`, `submitted`, `active`, `completed`, `cancelled`, `on_hold` - `type` (string) **(required)**: Values: `digital`, `physical` - `dueDate` (string,null) **(required)**: - `doctorName` (string,null) **(required)**: - `patient` (object,null) **(required)**: - `id` (string) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `clinic` (object,null) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `clinicLocation` (object,null) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `items` (object) **(required)**: - `count` (integer) **(required)**: - `productNames` (string[]) **(required)**: - `shipments` (object[]) **(required)**: - `id` (string) **(required)**: - `shipmentNumber` (integer) **(required)**: - `status` (string) **(required)**: Values: `draft`, `packing`, `ready`, `in_transit`, `delivery_exception`, `delivered`, `returned`, `cancelled` - `shippingMethod` (string) **(required)**: Values: `carrier`, `local_driver` - `labels` (object[]) **(required)**: - `id` (string) **(required)**: - `packageId` (string) **(required)**: - `packageNumber` (integer) **(required)**: - `carrier` (string,null) **(required)**: - `trackingNumber` (string,null) **(required)**: - `trackingUrl` (string,null) **(required)**: [uri] - `driverName` (string,null) **(required)**: - `driverPhone` (string,null) **(required)**: - `shippedAt` (string,null) **(required)**: - `deliveredAt` (string,null) **(required)**: - `address` (string) **(required)**: - `city` (string) **(required)**: - `postcode` (string) **(required)**: - `country` (string) **(required)**: - `contactName` (string,null) **(required)**: - `contactPhone` (string,null) **(required)**: - `signedBy` (string,null) **(required)**: - `pagination` (object) **(required)**: - `page` (integer) **(required)**: - `limit` (integer) **(required)**: - `total` (integer) **(required)**: - `totalPages` (integer) **(required)**: ### 401: Unauthorized ### 403: Only labs can view shipped orders ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/shipped" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get calendar data `GET https://api-stage.guidelab.co/orders/calendar` Returns order counts and summaries grouped by date for a given date range. Used for calendar views to show how many orders are due or have deadlines on each day. Excludes drafts and archived orders. Supports searching by order number, patient name, doctor, or partner org. Documentation: https://docs.guidelab.co/api-reference/orders/getOrderCalendar ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `startDate` (string) **(required)** (in: query): Start date (YYYY-MM-DD) - `endDate` (string) **(required)** (in: query): End date (YYYY-MM-DD) - `dateField` (string) (in: query): Date field to use: dueDate (default) or deadline - `search` (string) (in: query): Search term for order number, patient, doctor, or org name ## Responses ### 200: Calendar data grouped by date with order counts and summaries - `days` (object) **(required)**: - `total` (number) **(required)**: - `orders` (object[]) **(required)**: - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: - `patientName` (string,null) **(required)**: - `status` (string) **(required)**: ### 400: Invalid query parameters - dates must be YYYY-MM-DD format ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/calendar" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get orders for a specific day `GET https://api-stage.guidelab.co/orders/calendar/day` Returns a paginated list of orders for a specific date with full order details including phase summaries. Supports filtering by status and search. Used for the day detail view in the calendar. Documentation: https://docs.guidelab.co/api-reference/orders/getOrderCalendarDay ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `date` (string) **(required)** (in: query): Date (YYYY-MM-DD) - `dateField` (string) (in: query): Date field to use: dueDate (default) or deadline - `status` (string) (in: query): Comma-separated status filter - `search` (string) (in: query): Search term - `page` (string) (in: query): Page number (default: 1) - `limit` (string) (in: query): Items per page (default: 20, max: 100) ## Responses ### 200: Paginated list of orders for the day with phase summaries - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/calendar/day" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get most recent draft order `GET https://api-stage.guidelab.co/orders/drafts` Returns the most recent draft order created by the authenticated user within their organization. Includes related clinic, lab, patient, and line item data. Returns null if no draft exists. Documentation: https://docs.guidelab.co/api-reference/orders/getMostRecentDraft ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Most recent draft order with related data, or null if none exists - `draft` (object): ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/drafts" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create draft order `POST https://api-stage.guidelab.co/orders/drafts` Creates a new draft order with optional line items and wizard state for multi-step order creation. The draft is owned by the authenticated user and can be resumed later. Documentation: https://docs.guidelab.co/api-reference/orders/createDraftOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `clinicId` (string): - `labId` (string): - `clinicLocationId` (string): - `patientId` (string): - `doctorName` (string): - `doctorEmail` (object): - `doctorPhone` (string): - `type` (string): (default: `digital`) Values: `digital`, `physical` - `receivingSourceId` (string,null): - `scannerType` (string): - `dueDate` (string): - `notes` (string): - `hidePatientFromLab` (boolean): (default: `false`) - `items` (object[]): (default: ``) - `productId` (string) **(required)**: - `toothGroups` (object[]): (default: ``) - `id` (string) **(required)**: - `type` (string) **(required)**: Values: `single`, `bridge` - `teeth` (object[]) **(required)**: - `fdi` (integer) **(required)**: - `role` (string) **(required)**: Values: `crown`, `pontic` - `support` (string): Values: `natural`, `implant` - `implantSystemId` (string): - `implantPlatform` (string): - `quantity` (integer): (default: `1`) - `materialId` (string): - `material` (string): (default: ``) - `shadeSystemId` (string): - `shadeOcclusal` (string): (default: ``) - `shadeMiddle` (string): (default: ``) - `shadeGingival` (string): (default: ``) - `defaultImplantSystemId` (string): - `defaultImplantPlatform` (string): - `notes` (string): (default: ``) - `customFieldValues` (object): - `value` (object): - `fileIds` (string[]): - `bundleId` (string): - `bundleInstanceId` (string): - `bundleName` (string): - `bundlePrice` (string): - `wizardState` (object): - `step` (number) **(required)**: - `categoryId` (string): - `categoryName` (string): - `phasesToStart` (string[]): - `phaseNeededBy` (object): ## Responses ### 201: Created draft order ID and order number - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: ### 400: Validation failed ### 401: Unauthorized ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/drafts" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Get specific draft order `GET https://api-stage.guidelab.co/orders/drafts/{id}` Returns a specific draft order by ID, including related clinic, lab, patient, line items, and attached files. Only accessible by the draft creator within their organization. Documentation: https://docs.guidelab.co/api-reference/orders/getDraftById ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Draft order ID ## Responses ### 200: Draft order with items, files, and related data, or null if not found - `draft` (object): ### 400: Draft ID is required ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/drafts/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update draft order `PATCH https://api-stage.guidelab.co/orders/drafts/{id}` Updates an existing draft order's fields and optionally replaces all line items. Only the draft creator can update it. Supports updating wizard state for multi-step order flows. Documentation: https://docs.guidelab.co/api-reference/orders/updateDraftOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Draft order ID ## Request Body Content-Type: `application/json` - `clinicId` (string): - `labId` (string): - `clinicLocationId` (string): - `patientId` (string): - `doctorName` (string): - `doctorEmail` (object): - `doctorPhone` (string): - `type` (string): Values: `digital`, `physical` - `receivingSourceId` (string,null): - `scannerType` (string): - `dueDate` (string,null): - `notes` (string): - `hidePatientFromLab` (boolean): - `items` (object[]): - `productId` (string) **(required)**: - `toothGroups` (object[]): (default: ``) - `id` (string) **(required)**: - `type` (string) **(required)**: Values: `single`, `bridge` - `teeth` (object[]) **(required)**: - `fdi` (integer) **(required)**: - `role` (string) **(required)**: Values: `crown`, `pontic` - `support` (string): Values: `natural`, `implant` - `implantSystemId` (string): - `implantPlatform` (string): - `quantity` (integer): (default: `1`) - `materialId` (string): - `material` (string): (default: ``) - `shadeSystemId` (string): - `shadeOcclusal` (string): (default: ``) - `shadeMiddle` (string): (default: ``) - `shadeGingival` (string): (default: ``) - `defaultImplantSystemId` (string): - `defaultImplantPlatform` (string): - `notes` (string): (default: ``) - `customFieldValues` (object): - `value` (object): - `fileIds` (string[]): - `bundleId` (string): - `bundleInstanceId` (string): - `bundleName` (string): - `bundlePrice` (string): - `wizardState` (object): - `step` (number) **(required)**: - `categoryId` (string): - `categoryName` (string): - `phasesToStart` (string[]): - `phaseNeededBy` (object): ## Responses ### 200: Confirmation that the draft was updated - `success` (boolean) **(required)**: ### 400: Validation failed ### 401: Unauthorized ### 404: Draft not found or not accessible ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/orders/drafts/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Delete draft order `DELETE https://api-stage.guidelab.co/orders/drafts/{id}` Permanently deletes a draft order and archives its clinical file records for durable retention cleanup. R2 objects remain tracked until the retention worker confirms deletion. Documentation: https://docs.guidelab.co/api-reference/orders/deleteDraftOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Draft order ID ## Responses ### 200: Confirmation that the draft was deleted - `success` (boolean) **(required)**: ### 400: Draft ID is required ### 401: Unauthorized ### 404: Draft not found or not accessible ### 409: Draft changed, is scanner-booked, or contains delivery-proof evidence ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/orders/drafts/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Bulk delete or cancel orders `POST https://api-stage.guidelab.co/orders/bulk-delete` Processes a batch of order IDs in a single request. Drafts are deleted while their clinical files are archived for durable retention cleanup; non-draft orders are cancelled. Each order is processed independently. Documentation: https://docs.guidelab.co/api-reference/orders/bulkDeleteOrders ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `ids` (string[]) **(required)**: ## Responses ### 200: Counts of deleted/cancelled orders and per-id errors - `deleted` (number) **(required)**: - `cancelled` (number) **(required)**: - `total` (number) **(required)**: - `errors` (object[]) **(required)**: - `id` (string) **(required)**: - `error` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/bulk-delete" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "ids": [ "string" ] }' ``` --- # Cancel an order with an explicit refund decision `POST https://api-stage.guidelab.co/orders/{id}/cancel` Cancels an order. Paid orders require a lab owner/admin to choose a full, partial, or no refund and provide a reason. Stripe direct-charge refunds are committed only after provider confirmation. Documentation: https://docs.guidelab.co/api-reference/orders/cancelOrderWithRefundChoice ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `idempotencyKey` (string) **(required)**: - `reason` (string) **(required)**: - `refundMode` (string) **(required)**: Values: `none`, `full`, `partial` - `refundAmount` (string): ## Responses ### 200: Order cancelled - `message` (string) **(required)**: - `refund` (object) **(required)**: - `mode` (string) **(required)**: Values: `none`, `full`, `partial` - `status` (string) **(required)**: Values: `not_requested`, `pending`, `succeeded`, `failed` - `refundId` (string,null) **(required)**: - `amount` (string,null) **(required)**: - `currency` (string) **(required)**: ### 202: Refund is pending provider confirmation - `message` (string) **(required)**: - `refund` (object) **(required)**: - `mode` (string) **(required)**: Values: `none`, `full`, `partial` - `status` (string) **(required)**: Values: `not_requested`, `pending`, `succeeded`, `failed` - `refundId` (string,null) **(required)**: - `amount` (string,null) **(required)**: - `currency` (string) **(required)**: ### 400: Invalid cancellation or refund amount ### 401: Unauthorized ### 403: Lab owner or admin access is required ### 404: Order or paid receipt not found ### 409: Order or idempotency state conflicts ### 502: Stripe could not confirm the refund ### 503: Stripe is not configured safely ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/cancel" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "idempotencyKey": "string", "reason": "string", "refundMode": "none", "refundAmount": "string" }' ``` --- # Get order by ID `GET https://api-stage.guidelab.co/orders/{id}` Returns full order details including line items, phases, status history, phase step history, production tasks (lab only), and active hold information. Patient data is masked for labs when hidePatientFromLab is enabled. Documentation: https://docs.guidelab.co/api-reference/orders/getOrderDetail ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Responses ### 200: Full order details with items, phases, history, tasks, and active hold - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: - `status` (string) **(required)**: - `items` (array) **(required)**: - `phases` (array) **(required)**: - `statusHistory` (array) **(required)**: - `phaseStepHistory` (array) **(required)**: - `tasks` (array,null) **(required)**: - `activeHold` (object): ### 400: Order ID is required ### 401: Unauthorized ### 404: Order not found or not accessible by the current organization ### 500: Submitted order catalog revision is invalid ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update order `PATCH https://api-stage.guidelab.co/orders/{id}` Updates order fields such as patient, doctor, dates, notes, and assignment. Labs can update any accessible order; clinics can only update orders in draft status. Assigning a user triggers a notification and auto-subscribes them. Documentation: https://docs.guidelab.co/api-reference/orders/updateOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Request Body Content-Type: `application/json` - `clinicLocationId` (string,null): - `patientId` (string,null): - `doctorUserId` (string,null): - `doctorName` (string): - `doctorPhone` (string): - `doctorEmail` (object): - `type` (string): Values: `digital`, `physical` - `receivingSourceId` (string,null): - `scannerType` (string): - `panNumber` (string): - `manualFilePath` (string,null): - `deadline` (string,null): - `dueDate` (string,null): - `notes` (string): - `internalNotes` (string): - `assignedToMemberId` (string,null): ## Responses ### 200: Updated order record - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: - `status` (string) **(required)**: ### 400: Validation failed ### 401: Unauthorized ### 403: Only the destination lab can assign an order ### 404: Order not found or cannot be edited ### 500: Destination lab configuration is invalid ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/orders/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Cancel order `DELETE https://api-stage.guidelab.co/orders/{id}` Cancels an order by setting its status to 'cancelled' and recording a status history entry. Labs can cancel any of their orders; clinics can only cancel orders in draft status. Documentation: https://docs.guidelab.co/api-reference/orders/cancelOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Responses ### 200: Confirmation that the order was cancelled - `message` (string) **(required)**: ### 400: Order ID is required ### 401: Unauthorized ### 404: Order not found or cannot be deleted ### 409: Paid order requires the explicit cancellation flow ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/orders/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update order status `PATCH https://api-stage.guidelab.co/orders/{id}/status` Transitions an existing submitted order with validation of allowed transitions. Draft submission is owned exclusively by POST /orders/:id/submit so phase materialization and promotion remain atomic. Documentation: https://docs.guidelab.co/api-reference/orders/updateOrderStatus ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Request Body Content-Type: `application/json` - `status` (string) **(required)**: Values: `draft`, `submitted`, `active`, `completed`, `cancelled`, `on_hold` - `notes` (string): ## Responses ### 200: Updated order with full status history - `order` (object): - `statusHistory` (object[]) **(required)**: - `id` (string) **(required)**: - `fromStatus` (string,null) **(required)**: - `toStatus` (string) **(required)**: - `changedBy` (string,null) **(required)**: - `changedByName` (string,null) **(required)**: - `changedByActorKind` (string) **(required)**: Values: `system`, `user`, `anonymized_user` - `notes` (string,null) **(required)**: - `createdAt` (string) **(required)**: ### 400: Invalid status transition or incomplete phases for completion ### 401: Unauthorized ### 403: Clinics cannot perform this status transition ### 404: Order not found ### 409: Partnership/status conflict or insufficient inventory for completion ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/orders/{id}/status" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "status": "draft", "notes": "string" }' ``` --- # Submit an existing order draft `POST https://api-stage.guidelab.co/orders/{id}/submit` Atomically validates and promotes the caller-owned draft in place. Replays return the same order when submitted_at proves a prior successful submission. Documentation: https://docs.guidelab.co/api-reference/orders/submitDraftOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Existing draft order ID ## Responses ### 200: The existing order draft was submitted or replayed - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: - `replayed` (boolean) **(required)**: ### 400: Draft or catalog validation failed ### 401: Unauthorized ### 402: The destination lab cannot receive new work ### 404: Draft not found or not accessible ### 409: Draft lifecycle, partnership, or payment policy changed during submission ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/submit" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get order status history `GET https://api-stage.guidelab.co/orders/{id}/status-history` Returns the complete status transition history for an order, plus the phase-change history, sourced from the unified orderActivity log. Documentation: https://docs.guidelab.co/api-reference/orders/getOrderStatusHistory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Responses ### 200: Order status and phase change history with change details - `statusHistory` (object[]) **(required)**: - `id` (string) **(required)**: - `fromStatus` (string,null) **(required)**: - `toStatus` (string) **(required)**: - `changedBy` (string,null) **(required)**: - `changedByName` (string,null) **(required)**: - `changedByActorKind` (string) **(required)**: Values: `system`, `user`, `anonymized_user` - `notes` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `phaseStepHistory` (object[]) **(required)**: - `id` (string) **(required)**: - `phaseName` (string,null) **(required)**: - `fromPhase` (string,null) **(required)**: - `toPhase` (string) **(required)**: - `changedBy` (string,null) **(required)**: - `changedByName` (string,null) **(required)**: - `changedByActorKind` (string) **(required)**: Values: `system`, `user`, `anonymized_user` - `notes` (string,null) **(required)**: - `createdAt` (string) **(required)**: ### 400: Order ID is required ### 401: Unauthorized ### 404: Order not found or not accessible by the current organization ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/{id}/status-history" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Put order on hold `POST https://api-stage.guidelab.co/orders/{id}/hold` Places an order on hold with a specified hold reason from the lab's configured reasons. Optionally creates file reupload requirements if the hold reason requires it. Only labs can put orders on hold. Sends a notification to the clinic. Documentation: https://docs.guidelab.co/api-reference/orders/createOrderHold ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Request Body Content-Type: `application/json` - `holdReasonId` (string) **(required)**: - `notes` (string): - `fileIds` (string[]): ## Responses ### 200: Created hold record with file reupload requirements - `hold` (object): - `requirements` (array) **(required)**: ### 400: Invalid status transition or file validation failed ### 401: Unauthorized ### 403: Only labs can put orders on hold ### 404: Order or hold reason not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/hold" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "holdReasonId": "string", "notes": "string", "fileIds": [ "string" ] }' ``` --- # Get hold requirements for order `GET https://api-stage.guidelab.co/orders/{id}/hold-requirements` Returns the active hold and its file reupload requirements for an order. Accessible by both labs and clinics with access to the order. Returns null if no active hold exists. Documentation: https://docs.guidelab.co/api-reference/orders/getOrderHoldRequirements ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Responses ### 200: Active hold with file reupload requirements, or null if no active hold - `hold` (object,null) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `holdReasonName` (string) **(required)**: - `notes` (string,null) **(required)**: - `previousStatus` (string) **(required)**: - `status` (string) **(required)**: - `createdAt` (string) **(required)**: - `requirements` (array) **(required)**: - `requirements` (array) **(required)**: ### 400: Order ID is required ### 401: Unauthorized ### 404: Order not found or not accessible by the current organization ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/{id}/hold-requirements" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Review hold requirement `POST https://api-stage.guidelab.co/orders/{id}/hold-requirements/{requirementId}/review` Approves or rejects a submitted hold requirement. Only labs can review requirements. When all requirements are approved, the hold is automatically resolved and the order resumes its previous status. Documentation: https://docs.guidelab.co/api-reference/orders/reviewHoldRequirement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID - `requirementId` (string) **(required)** (in: path): Hold requirement ID ## Request Body Content-Type: `application/json` - `decision` (string) **(required)**: Values: `approved`, `rejected` - `notes` (string): ## Responses ### 200: Review result including whether all requirements are approved and order auto-resumed - `success` (boolean) **(required)**: - `allApproved` (boolean) **(required)**: - `autoResumed` (boolean) **(required)**: ### 400: Requirement is not in submitted state ### 401: Unauthorized ### 403: Only labs can review hold requirements ### 404: Order, requirement, or hold record not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/hold-requirements/{requirementId}/review" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "decision": "approved", "notes": "string" }' ``` --- # Submit hold requirement `POST https://api-stage.guidelab.co/orders/{id}/hold-requirements/{requirementId}/submit` Submits a file to fulfill a hold requirement. Only clinics can submit hold requirements. Supports resubmission after rejection. Sends a notification to the lab for review. Documentation: https://docs.guidelab.co/api-reference/orders/submitHoldRequirement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID - `requirementId` (string) **(required)** (in: path): Hold requirement ID ## Request Body Content-Type: `application/json` - `fileId` (string) **(required)**: ## Responses ### 200: Confirmation that the requirement was submitted - `success` (boolean) **(required)**: ### 400: Requirement is not in a state that accepts submissions ### 401: Unauthorized ### 403: Only clinics can submit hold requirements ### 404: Order, requirement, or file not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/hold-requirements/{requirementId}/submit" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "fileId": "string" }' ``` --- # List tasks of an order's current phase `GET https://api-stage.guidelab.co/orders/{orderId}/phase-tasks` Returns the ordered task list of the order's active phase. For clinic requesters, only clinic-visible entries are returned and labels resolve to clinicTitle when set. Documentation: https://docs.guidelab.co/api-reference/orders/listOrderPhaseTasks ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `orderId` (string) **(required)** (in: path): ## Responses ### 200: Phase tasks - `tasks` (object[]) **(required)**: - `id` (string) **(required)**: - `taskId` (string) **(required)**: - `label` (string) **(required)**: - `sortOrder` (integer) **(required)**: - `isCurrent` (boolean) **(required)**: ### 401: Unauthorized ### 404: Order not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/{orderId}/phase-tasks" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Request phase advancement (clinic only) `POST https://api-stage.guidelab.co/orders/{id}/phases/{phaseId}/request-advance` Allows a clinic to submit files for a phase and ask the lab to begin work. Sets filesSubmitted and points currentPhaseTaskId at the phase's first task. Documentation: https://docs.guidelab.co/api-reference/orders/requestOrderPhaseAdvance ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID - `phaseId` (string) **(required)** (in: path): Order phase ID ## Responses ### 200: Confirmation that the phase advance was requested - `success` (boolean) **(required)**: ### 400: Files already submitted or no tasks configured for this phase ### 401: Unauthorized ### 403: Only clinics can request phase advancement ### 404: Order or phase not found ### 409: Order or phase state changed while updating ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/phases/{phaseId}/request-advance" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Assign or unassign a work tray to a stage (lab only) `PATCH https://api-stage.guidelab.co/orders/{id}/phases/{phaseId}/work-tray` Sets orderPhase.workTrayId for one stage. A tray can occupy at most one active stage at a time; pass null workTrayId to unassign. Documentation: https://docs.guidelab.co/api-reference/orders/assignOrderPhaseWorkTray ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `phaseId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `workTrayId` (string,null) **(required)**: ## Responses ### 200: Assigned - `workTrayId` (string,null) **(required)**: - `workTray` (object,null) **(required)**: - `id` (string) **(required)**: - `code` (string) **(required)**: - `color` (string,null) **(required)**: ### 403: Only labs can assign trays ### 404: Order, stage, or tray not found ### 409: Tray already assigned to another stage - `error` (string) **(required)**: - `conflict` (object): - `orderPhaseId` (string) **(required)**: - `phaseName` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string) **(required)**: - `sameOrder` (boolean) **(required)**: ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/orders/{id}/phases/{phaseId}/work-tray" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "workTrayId": "string" }' ``` --- # Get an order's revision-aware QC state `GET https://api-stage.guidelab.co/orders/{id}/qc` Documentation: https://docs.guidelab.co/api-reference/orders/getOrderQc ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `historyLimit` (integer) (in: query): Default: `10` ## Responses ### 200: QC configuration, current gate state, and bounded history - `qcEnabled` (boolean) **(required)**: - `selectAllEnabled` (boolean) **(required)**: - `fulfillmentRevision` (integer) **(required)**: - `gatePassed` (boolean) **(required)**: - `checklist` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `sortOrder` (integer) **(required)**: - `latestInspection` (object,null) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderRevision` (integer) **(required)**: - `attemptNumber` (integer) **(required)**: - `outcome` (string) **(required)**: Values: `passed`, `failed` - `notes` (string,null) **(required)**: - `completedByUserId` (string,null) **(required)**: - `completedByName` (string,null) **(required)**: - `completedAt` (string) **(required)**: - `results` (object[]) **(required)**: - `checklistItemId` (string) **(required)**: - `itemName` (string) **(required)**: - `passed` (boolean) **(required)**: - `notes` (string,null) **(required)**: - `history` (object[]) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderRevision` (integer) **(required)**: - `attemptNumber` (integer) **(required)**: - `outcome` (string) **(required)**: Values: `passed`, `failed` - `notes` (string,null) **(required)**: - `completedByUserId` (string,null) **(required)**: - `completedByName` (string,null) **(required)**: - `completedAt` (string) **(required)**: - `results` (object[]) **(required)**: - `checklistItemId` (string) **(required)**: - `itemName` (string) **(required)**: - `passed` (boolean) **(required)**: - `notes` (string,null) **(required)**: ### 401: Unauthorized ### 403: Lab access required ### 404: Order not found ### 409: QC checklist exceeds its bounded execution limit ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/{id}/qc" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Record an immutable QC inspection `POST https://api-stage.guidelab.co/orders/{id}/qc` Documentation: https://docs.guidelab.co/api-reference/orders/completeOrderQc ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `results` (object[]) **(required)**: - `checklistItemId` (string) **(required)**: - `passed` (boolean) **(required)**: - `notes` (string,null): - `notes` (string,null): ## Responses ### 201: QC inspection recorded - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderRevision` (integer) **(required)**: - `attemptNumber` (integer) **(required)**: - `outcome` (string) **(required)**: Values: `passed`, `failed` - `notes` (string,null) **(required)**: - `completedByUserId` (string,null) **(required)**: - `completedByName` (string,null) **(required)**: - `completedAt` (string) **(required)**: - `results` (object[]) **(required)**: - `checklistItemId` (string) **(required)**: - `itemName` (string) **(required)**: - `passed` (boolean) **(required)**: - `notes` (string,null) **(required)**: ### 400: Checklist result set is incomplete or invalid ### 401: Unauthorized ### 403: Lab access required ### 404: Order not found ### 409: QC is disabled or order is not active ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/qc" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "results": [ { "checklistItemId": "string", "passed": true, "notes": "string" } ], "notes": "string" }' ``` --- # Get current surgical report review state `GET https://api-stage.guidelab.co/orders/{id}/surgical-report` Returns the immutable report revisions and review timeline for the active surgical-report hold. Documentation: https://docs.guidelab.co/api-reference/orders/getCurrentSurgicalReport ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Current surgical report state - `blockedByOtherHold` (boolean) **(required)**: - `review` (object,null) **(required)**: - `reviewId` (string) **(required)**: - `holdId` (string) **(required)**: - `orderPhaseId` (string) **(required)**: - `orderPhaseTaskId` (string) **(required)**: - `status` (string) **(required)**: Values: `pending_review`, `changes_requested`, `approved` - `currentRevisionNumber` (integer) **(required)**: - `reviewNotes` (string,null) **(required)**: - `bookingUrl` (string,null) **(required)**: - `reviewedAt` (string,null) **(required)**: - `currentRevision` (object) **(required)**: - `id` (string) **(required)**: - `revisionNumber` (integer) **(required)**: - `projectUrl` (string,null) **(required)**: - `submittedByMemberId` (string) **(required)**: - `submittedAt` (string) **(required)**: - `files` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `type` (string) **(required)**: - `category` (string) **(required)**: Values: `report`, `extra` - `sortOrder` (integer) **(required)**: - `revisions` (object[]) **(required)**: - `id` (string) **(required)**: - `revisionNumber` (integer) **(required)**: - `projectUrl` (string,null) **(required)**: - `submittedByMemberId` (string) **(required)**: - `submittedAt` (string) **(required)**: - `files` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `type` (string) **(required)**: - `category` (string) **(required)**: Values: `report`, `extra` - `sortOrder` (integer) **(required)**: - `events` (object[]) **(required)**: - `id` (string) **(required)**: - `sequence` (integer) **(required)**: - `eventType` (string) **(required)**: Values: `submitted`, `resubmitted`, `changes_requested`, `approved` - `revisionId` (string) **(required)**: - `actorMemberId` (string) **(required)**: - `notes` (string,null) **(required)**: - `createdAt` (string) **(required)**: ### 401: Unauthorized ### 404: Order not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/{id}/surgical-report" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Approve surgical report (clinic only) `POST https://api-stage.guidelab.co/orders/{id}/surgical-report/{reviewId}/approve` Approves the current immutable revision, completes the approval task, resolves its hold, and resumes production. Documentation: https://docs.guidelab.co/api-reference/orders/approveSurgicalReport ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `reviewId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `commandId` (string) **(required)**: [uuid] ## Responses ### 200: Approval result - `success` (boolean) **(required)**: - `autoResumed` (boolean) **(required)**: - `replayed` (boolean) **(required)**: ### 401: Unauthorized ### 403: Only clinic members can approve reports ### 404: Order or review not found ### 409: Review or command conflict ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/surgical-report/{reviewId}/approve" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "commandId": "string" }' ``` --- # Request a new surgical report revision (clinic only) `POST https://api-stage.guidelab.co/orders/{id}/surgical-report/{reviewId}/request-changes` Keeps the approval task and hold open while requiring the lab to submit a new immutable revision. Documentation: https://docs.guidelab.co/api-reference/orders/requestSurgicalReportChanges ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `reviewId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `commandId` (string) **(required)**: [uuid] - `notes` (string) **(required)**: ## Responses ### 200: Changes requested - `success` (boolean) **(required)**: - `replayed` (boolean) **(required)**: ### 401: Unauthorized ### 403: Only clinic members can request changes ### 404: Order or review not found ### 409: Review or command conflict ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/surgical-report/{reviewId}/request-changes" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "commandId": "string", "notes": "string" }' ``` --- # Get order files `GET https://api-stage.guidelab.co/orders/{id}/files` Returns all files attached to an order along with product file requirements. Requirements define what file types each product expects (scans, photos, prescriptions, etc.) and their upload rules. Documentation: https://docs.guidelab.co/api-reference/orders/getOrderFiles ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Responses ### 200: List of order files and product file requirements - `files` (object[]) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `name` (string) **(required)**: - `type` (string) **(required)**: - `mimeType` (string) **(required)**: - `size` (number) **(required)**: - `url` (string) **(required)**: - `thumbnailUrl` (string,null) **(required)**: - `fileRequirementId` (string,null) **(required)**: - `orderPhaseId` (string,null) **(required)**: - `uploadedBy` (string,null) **(required)**: - `uploaderName` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `requirements` (array) **(required)**: ### 400: Order ID is required ### 401: Unauthorized ### 404: Order not found or not accessible by the current organization ### 500: Submitted order catalog revision is invalid ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/{id}/files" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get order components `GET https://api-stage.guidelab.co/orders/{id}/components` Returns all components (e.g., implant components, materials with lot numbers) attached to an order. Accessible by both labs and clinics that have access to the order. Documentation: https://docs.guidelab.co/api-reference/orders/getOrderComponents ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Responses ### 200: List of order components with lot numbers and catalog references - `components` (object[]) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `labComponentId` (string,null) **(required)**: - `itemName` (string) **(required)**: - `lotNumber` (string) **(required)**: - `notes` (string,null) **(required)**: - `addedBy` (string) **(required)**: - `addedByName` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Order ID is required ### 401: Unauthorized ### 403: Access denied - organization does not have access to this order ### 404: Order not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/{id}/components" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Add component to order `POST https://api-stage.guidelab.co/orders/{id}/components` Adds a component to an order with item name, lot number, and optional reference to the lab's component catalog. Only labs can add components to their orders. Documentation: https://docs.guidelab.co/api-reference/orders/addOrderComponent ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Request Body Content-Type: `application/json` - `lotNumber` (string) **(required)**: - `itemName` (string) **(required)**: - `labComponentId` (string): - `notes` (string): ## Responses ### 201: Created component record with user details - `component` (object) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `labComponentId` (string,null) **(required)**: - `itemName` (string) **(required)**: - `lotNumber` (string) **(required)**: - `notes` (string,null) **(required)**: - `addedBy` (string) **(required)**: - `addedByName` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized ### 403: Only labs can add components to orders ### 404: Order or catalog component not found ### 409: Order is closed, unavailable, or payment-fenced ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/components" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "lotNumber": "string", "itemName": "string", "labComponentId": "string", "notes": "string" }' ``` --- # Remove component from order `DELETE https://api-stage.guidelab.co/orders/{id}/components` Removes a component from an order. Only labs can remove components from their orders. The component ID is passed as a query parameter. Documentation: https://docs.guidelab.co/api-reference/orders/removeOrderComponent ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID - `componentId` (string) **(required)** (in: query): Component ID to remove ## Responses ### 200: Confirmation that the component was removed - `message` (string) **(required)**: ### 400: Order ID and component ID are required ### 401: Unauthorized ### 403: Only labs can remove components from orders ### 404: Order or component not found ### 409: Order is closed, unavailable, or payment-fenced ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/orders/{id}/components" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Add line item to an existing order `POST https://api-stage.guidelab.co/orders/{id}/items` Adds a new line item to a draft order. Pricing is resolved from the lab's authoritative price-list publication and catalog at insertion time. Documentation: https://docs.guidelab.co/api-reference/orders/addOrderItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Request Body Content-Type: `application/json` - `productId` (string) **(required)**: Product ID to add as a line item (example: `550e8400-e29b-41d4-a716-446655440000`) - `quantity` (integer): (default: `1`) (example: `1`) - `toothGroups` (object[]): - `id` (string) **(required)**: - `type` (string) **(required)**: Values: `single`, `bridge` - `teeth` (object[]) **(required)**: - `fdi` (integer) **(required)**: - `role` (string) **(required)**: Values: `crown`, `pontic` - `support` (string): Values: `natural`, `implant` - `implantSystemId` (string): - `implantPlatform` (string): - `materialId` (string): - `material` (string): - `shadeSystemId` (string): - `shadeOcclusal` (string): - `shadeMiddle` (string): - `shadeGingival` (string): - `shadeNotes` (string): - `defaultImplantSystemId` (string): - `defaultImplantPlatform` (string): - `notes` (string): - `customFieldValues` (object): - `value` (object): - `fileIds` (string[]): ## Responses ### 201: Created order item - `item` (object): ### 400: Validation failed ### 401: Unauthorized ### 403: Only labs can add items, or order is in a closed state ### 404: Order or product not found ### 409: Canonical product revision unavailable ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/items" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "productId": "550e8400-e29b-41d4-a716-446655440000" }' ``` --- # Update a line item on an existing order `PATCH https://api-stage.guidelab.co/orders/{id}/items/{itemId}` Updates the configuration of an existing draft line item and re-resolves authoritative pricing. Price-affecting fields are frozen after submission. Documentation: https://docs.guidelab.co/api-reference/orders/updateOrderItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID - `itemId` (string) **(required)** (in: path): Order item ID ## Request Body Content-Type: `application/json` - `quantity` (integer): - `toothGroups` (object[]): - `id` (string) **(required)**: - `type` (string) **(required)**: Values: `single`, `bridge` - `teeth` (object[]) **(required)**: - `fdi` (integer) **(required)**: - `role` (string) **(required)**: Values: `crown`, `pontic` - `support` (string): Values: `natural`, `implant` - `implantSystemId` (string): - `implantPlatform` (string): - `materialId` (string): - `material` (string): - `shadeSystemId` (string): - `shadeOcclusal` (string): - `shadeMiddle` (string): - `shadeGingival` (string): - `shadeNotes` (string): - `defaultImplantSystemId` (string): - `defaultImplantPlatform` (string): - `notes` (string): - `customFieldValues` (object): - `value` (object): - `fileIds` (string[]): ## Responses ### 200: Updated order item - `item` (object): ### 400: Validation failed ### 401: Unauthorized ### 403: Only labs can edit items, or order is in a closed state ### 404: Order or item not found ### 409: Canonical product revision unavailable ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/orders/{id}/items/{itemId}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Remove a line item from an existing order `DELETE https://api-stage.guidelab.co/orders/{id}/items/{itemId}` Removes a line item from a draft order. Order items are frozen after submission. Documentation: https://docs.guidelab.co/api-reference/orders/deleteOrderItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID - `itemId` (string) **(required)** (in: path): Order item ID ## Responses ### 200: Item removed - `success` (boolean) **(required)**: ### 401: Unauthorized ### 403: Only labs can remove items, or order is in a closed state ### 404: Order or item not found ### 409: Bundle members must be removed as a whole bundle ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/orders/{id}/items/{itemId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get order messages `GET https://api-stage.guidelab.co/orders/{id}/messages` Returns messages for an order, filterable by type (all, notes, replies). Internal messages are visible only to the organization that authored them. Results are ordered by newest first. Documentation: https://docs.guidelab.co/api-reference/orders/getOrderMessages ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID - `type` (string) (in: query): Message type filter: all, notes, replies ## Responses ### 200: List of order messages with sender details Array of: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `senderUserId` (string) **(required)**: - `senderOrgId` (string) **(required)**: - `senderName` (string,null) **(required)**: - `senderOrgName` (string,null) **(required)**: - `content` (string) **(required)**: - `isInternal` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Order ID is required ### 401: Unauthorized ### 404: Order not found or not accessible by the current organization ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/{id}/messages" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get order print data `GET https://api-stage.guidelab.co/orders/{id}/print-data` Returns comprehensive order data formatted for document generation and printing, including lab/clinic addresses, line items with custom fields, patient details, and document settings (title, terms, footer). Patient data is masked for labs when hidePatientFromLab is enabled. Documentation: https://docs.guidelab.co/api-reference/orders/getOrderPrintData ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Responses ### 200: Complete print-ready order data with lab, clinic, items, and document settings - `order` (object): - `lab` (object): - `clinic` (object): - `clinicLocation` (object): - `items` (array) **(required)**: - `documentSettings` (object): ### 400: Order ID is required ### 401: Unauthorized ### 404: Order not found or not accessible by the current organization ### 500: Submitted order catalog revision is invalid ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/{id}/print-data" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get subscription status `GET https://api-stage.guidelab.co/orders/{id}/subscribe` Checks whether the authenticated user is subscribed to notifications for a specific order. Documentation: https://docs.guidelab.co/api-reference/orders/getOrderSubscription ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Responses ### 200: Subscription status boolean - `subscribed` (boolean) **(required)**: ### 400: Order ID is required ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/{id}/subscribe" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Subscribe to order `POST https://api-stage.guidelab.co/orders/{id}/subscribe` Subscribes the authenticated user to receive notifications for a specific order. The user must belong to an organization (lab or clinic) that has access to the order. Documentation: https://docs.guidelab.co/api-reference/orders/subscribeToOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Responses ### 200: Confirmation that the user is now subscribed - `subscribed` (boolean) **(required)**: ### 400: Order ID is required ### 401: Unauthorized ### 404: Order not found or not accessible by the current organization ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/subscribe" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Unsubscribe from order `DELETE https://api-stage.guidelab.co/orders/{id}/subscribe` Unsubscribes the authenticated user from notifications for a specific order. Documentation: https://docs.guidelab.co/api-reference/orders/unsubscribeFromOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Responses ### 200: Confirmation that the user is now unsubscribed - `subscribed` (boolean) **(required)**: ### 400: Order ID is required ### 401: Unauthorized ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/orders/{id}/subscribe" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get order tags `GET https://api-stage.guidelab.co/orders/{id}/tags` Returns all tags applied to an order. Accessible by both labs and clinics that have access to the order. Documentation: https://docs.guidelab.co/api-reference/orders/getOrderTags ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Responses ### 200: List of tags applied to the order with tag details - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `tagId` (string) **(required)**: - `appliedBy` (string) **(required)**: - `createdAt` (string) **(required)**: - `tag` (object): ### 400: Order ID is required ### 401: Unauthorized ### 403: Access denied - organization does not have access to this order ### 404: Order not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/{id}/tags" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Add tag to order `POST https://api-stage.guidelab.co/orders/{id}/tags` Applies an existing tag from the lab's tag catalog to an order. The tag must be active and belong to the order's lab. Prevents duplicate tag applications. Documentation: https://docs.guidelab.co/api-reference/orders/addOrderTag ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID ## Request Body Content-Type: `application/json` - `tagId` (string) **(required)**: ## Responses ### 201: Created tag application with full tag details - `orderTag` (object) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `tagId` (string) **(required)**: - `appliedBy` (string) **(required)**: - `createdAt` (string) **(required)**: - `tag` (object): ### 400: Invalid request body ### 401: Unauthorized ### 403: Access denied - organization does not have access to this order ### 404: Order or tag not found ### 409: Tag is already applied to this order ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/tags" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "tagId": "string" }' ``` --- # Remove tag from order `DELETE https://api-stage.guidelab.co/orders/{id}/tags` Removes a tag from an order. The tag ID is passed as a query parameter. Accessible by both labs and clinics with access to the order. Documentation: https://docs.guidelab.co/api-reference/orders/removeOrderTag ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Order ID - `tagId` (string) **(required)** (in: query): Tag ID to remove ## Responses ### 200: Confirmation that the tag was removed from the order - `message` (string) **(required)**: ### 400: Order ID and tag ID are required ### 401: Unauthorized ### 403: Access denied - organization does not have access to this order ### 404: Order not found or tag not applied to this order ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/orders/{id}/tags" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get an order's revision-aware QC state `GET https://api-stage.guidelab.co/orders/{id}/qc` Documentation: https://docs.guidelab.co/api-reference/quality-control/getOrderQc ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `historyLimit` (integer) (in: query): Default: `10` ## Responses ### 200: QC configuration, current gate state, and bounded history - `qcEnabled` (boolean) **(required)**: - `selectAllEnabled` (boolean) **(required)**: - `fulfillmentRevision` (integer) **(required)**: - `gatePassed` (boolean) **(required)**: - `checklist` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `sortOrder` (integer) **(required)**: - `latestInspection` (object,null) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderRevision` (integer) **(required)**: - `attemptNumber` (integer) **(required)**: - `outcome` (string) **(required)**: Values: `passed`, `failed` - `notes` (string,null) **(required)**: - `completedByUserId` (string,null) **(required)**: - `completedByName` (string,null) **(required)**: - `completedAt` (string) **(required)**: - `results` (object[]) **(required)**: - `checklistItemId` (string) **(required)**: - `itemName` (string) **(required)**: - `passed` (boolean) **(required)**: - `notes` (string,null) **(required)**: - `history` (object[]) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderRevision` (integer) **(required)**: - `attemptNumber` (integer) **(required)**: - `outcome` (string) **(required)**: Values: `passed`, `failed` - `notes` (string,null) **(required)**: - `completedByUserId` (string,null) **(required)**: - `completedByName` (string,null) **(required)**: - `completedAt` (string) **(required)**: - `results` (object[]) **(required)**: - `checklistItemId` (string) **(required)**: - `itemName` (string) **(required)**: - `passed` (boolean) **(required)**: - `notes` (string,null) **(required)**: ### 401: Unauthorized ### 403: Lab access required ### 404: Order not found ### 409: QC checklist exceeds its bounded execution limit ## Example ```bash curl -X GET "https://api-stage.guidelab.co/orders/{id}/qc" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Record an immutable QC inspection `POST https://api-stage.guidelab.co/orders/{id}/qc` Documentation: https://docs.guidelab.co/api-reference/quality-control/completeOrderQc ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `results` (object[]) **(required)**: - `checklistItemId` (string) **(required)**: - `passed` (boolean) **(required)**: - `notes` (string,null): - `notes` (string,null): ## Responses ### 201: QC inspection recorded - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderRevision` (integer) **(required)**: - `attemptNumber` (integer) **(required)**: - `outcome` (string) **(required)**: Values: `passed`, `failed` - `notes` (string,null) **(required)**: - `completedByUserId` (string,null) **(required)**: - `completedByName` (string,null) **(required)**: - `completedAt` (string) **(required)**: - `results` (object[]) **(required)**: - `checklistItemId` (string) **(required)**: - `itemName` (string) **(required)**: - `passed` (boolean) **(required)**: - `notes` (string,null) **(required)**: ### 400: Checklist result set is incomplete or invalid ### 401: Unauthorized ### 403: Lab access required ### 404: Order not found ### 409: QC is disabled or order is not active ## Example ```bash curl -X POST "https://api-stage.guidelab.co/orders/{id}/qc" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "results": [ { "checklistItemId": "string", "passed": true, "notes": "string" } ], "notes": "string" }' ``` --- # List outbound shipments visible to the active organization `GET https://api-stage.guidelab.co/shipments` Documentation: https://docs.guidelab.co/api-reference/shipments/listShipments ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `status` (string) (in: query): Values: `draft`, `packing`, `ready`, `in_transit`, `delivery_exception`, `delivered`, `returned`, `cancelled` - `partnershipId` (string) (in: query): - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `25` ## Responses ### 200: Paginated shipments ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/shipments" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a quantity-level outbound shipment `POST https://api-stage.guidelab.co/shipments` Documentation: https://docs.guidelab.co/api-reference/shipments/createShipment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `commandId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `method` (string) **(required)**: Values: `carrier`, `local_driver` - `destination` (object): - `name` (string) **(required)**: - `addressLine1` (string) **(required)**: - `addressLine2` (string): - `city` (string) **(required)**: - `region` (string): - `postcode` (string) **(required)**: - `country` (string) **(required)**: - `contactName` (string): - `contactPhone` (string): - `destinationLocationId` (string): - `driverName` (string): - `driverPhone` (string): - `scheduledDate` (string): - `notes` (string): - `items` (object[]) **(required)**: - `clientReference` (string) **(required)**: - `orderItemId` (string) **(required)**: - `quantity` (integer) **(required)**: - `kind` (string): (default: `fulfillment`) Values: `fulfillment`, `replacement` - `replacementForShipmentItemId` (string): - `notes` (string): - `packages` (object[]): - `clientReference` (string) **(required)**: - `weightGrams` (integer): - `lengthMm` (integer): - `widthMm` (integer): - `heightMm` (integer): - `items` (object[]) **(required)**: - `allocationReference` (string) **(required)**: - `quantity` (integer) **(required)**: ## Responses ### 201: Shipment created ### 400: Invalid shipment allocation ### 401: Unauthorized ### 403: Lab access required ### 409: Command identity or allocation conflict ## Example ```bash curl -X POST "https://api-stage.guidelab.co/shipments" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "commandId": "string", "partnershipId": "string", "method": "carrier", "items": [ { "clientReference": "string", "orderItemId": "string", "quantity": 0, "kind": "fulfillment", "replacementForShipmentItemId": "string", "notes": "string" } ] }' ``` --- # Transition an outbound shipment `POST https://api-stage.guidelab.co/shipments/{id}/transition` Documentation: https://docs.guidelab.co/api-reference/shipments/transitionShipment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `commandId` (string) **(required)**: - `toStatus` (string) **(required)**: Values: `draft`, `packing`, `ready`, `in_transit`, `delivery_exception`, `delivered`, `returned`, `cancelled` - `expectedVersion` (integer) **(required)**: - `occurredAt` (string): - `details` (object): - `deliveryProof` (object): - `recipientName` (string) **(required)**: - `proofType` (string) **(required)**: Values: `signature`, `photo`, `manual` - `fileId` (string): ## Responses ### 200: Shipment transitioned ### 400: Invalid transition ### 404: Shipment not found ### 409: Stale version or command identity conflict ## Example ```bash curl -X POST "https://api-stage.guidelab.co/shipments/{id}/transition" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "commandId": "string", "toStatus": "draft", "expectedVersion": 0, "occurredAt": "string", "details": {}, "deliveryProof": { "recipientName": "string", "proofType": "signature", "fileId": "string" } }' ``` --- # Attach a manually purchased carrier label `POST https://api-stage.guidelab.co/shipments/{id}/labels/manual` Documentation: https://docs.guidelab.co/api-reference/shipments/createManualShipmentLabel ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `commandId` (string) **(required)**: - `expectedVersion` (integer) **(required)**: - `packageId` (string) **(required)**: - `carrier` (string) **(required)**: - `serviceCode` (string): - `trackingNumber` (string) **(required)**: - `trackingUrl` (string): [uri] - `cost` (string): - `currency` (string) **(required)**: Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` ## Responses ### 200: Manual label attached ### 404: Shipment or package not found ### 409: Stale shipment or command identity conflict ## Example ```bash curl -X POST "https://api-stage.guidelab.co/shipments/{id}/labels/manual" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "commandId": "string", "expectedVersion": 0, "packageId": "string", "carrier": "string", "trackingNumber": "string", "currency": "GBP" }' ``` --- # Void an attached manual carrier label `POST https://api-stage.guidelab.co/shipments/{id}/labels/{labelId}/void` Documentation: https://docs.guidelab.co/api-reference/shipments/voidShipmentLabel ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `labelId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `commandId` (string) **(required)**: - `expectedVersion` (integer) **(required)**: - `reason` (string): ## Responses ### 200: Label voided ### 404: Shipment or label not found ### 409: Stale shipment or provider void required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/shipments/{id}/labels/{labelId}/void" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "commandId": "string", "expectedVersion": 0, "reason": "string" }' ``` --- # Record a replay-safe package pack/unpack scan `POST https://api-stage.guidelab.co/shipments/{id}/scans` Documentation: https://docs.guidelab.co/api-reference/shipments/recordShipmentScan ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `commandId` (string) **(required)**: - `expectedVersion` (integer) **(required)**: - `packageId` (string) **(required)**: - `shipmentItemId` (string) **(required)**: - `action` (string) **(required)**: Values: `pack`, `unpack` - `quantity` (integer) **(required)**: - `barcode` (string): ## Responses ### 200: Scan recorded ### 400: Scan violates the package allocation ### 404: Shipment or package allocation not found ### 409: Stale shipment or command identity conflict ## Example ```bash curl -X POST "https://api-stage.guidelab.co/shipments/{id}/scans" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "commandId": "string", "expectedVersion": 0, "packageId": "string", "shipmentItemId": "string", "action": "pack", "quantity": 0 }' ``` --- # Get an outbound shipment `GET https://api-stage.guidelab.co/shipments/{id}` Documentation: https://docs.guidelab.co/api-reference/shipments/getShipment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Shipment detail ### 404: Shipment not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/shipments/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Quote bounded ShipStation rates for one shipment package `POST https://api-stage.guidelab.co/shipments/{id}/rates` Documentation: https://docs.guidelab.co/api-reference/shipments/quoteShipmentPackageRates ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `packageId` (string) **(required)**: - `carrierIds` (string[]): ## Responses ### 200: Signed, short-lived rate choices ### 400: Shipment address or package data is incomplete ### 404: Shipment package not found ### 409: Shipment or shipping integration is not eligible ### 429: Provider operation budget exhausted ### 502: Rate provider failed safely ### 503: Provider integration disabled ## Example ```bash curl -X POST "https://api-stage.guidelab.co/shipments/{id}/rates" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "packageId": "string", "carrierIds": [ "string" ] }' ``` --- # Purchase a ShipStation label from a signed rate `POST https://api-stage.guidelab.co/shipments/{id}/labels/provider` Documentation: https://docs.guidelab.co/api-reference/shipments/purchaseProviderShipmentLabel ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `commandId` (string) **(required)**: - `expectedVersion` (integer) **(required)**: - `rateToken` (string) **(required)**: ## Responses ### 200: Existing label command replayed ### 201: Provider label purchased and stored ### 202: Provider outcome is being recovered or finalized ### 404: Shipment package not found ### 409: Stale or conflicting shipment command ### 429: Paid provider budget exhausted ### 503: Provider integration disabled ## Example ```bash curl -X POST "https://api-stage.guidelab.co/shipments/{id}/labels/provider" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "commandId": "string", "expectedVersion": 0, "rateToken": "string" }' ``` --- # Void a ShipStation label without repeating the provider mutation `POST https://api-stage.guidelab.co/shipments/{id}/labels/{labelId}/provider-void` Documentation: https://docs.guidelab.co/api-reference/shipments/voidProviderShipmentLabel ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `labelId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `commandId` (string) **(required)**: - `expectedVersion` (integer) **(required)**: - `reason` (string): ## Responses ### 200: Existing void command replayed ### 201: Provider label voided ### 202: Provider outcome is being recovered or finalized ### 404: Provider label not found ### 409: Stale or conflicting shipment command ### 429: Provider mutation budget exhausted ### 503: Provider integration disabled ## Example ```bash curl -X POST "https://api-stage.guidelab.co/shipments/{id}/labels/{labelId}/provider-void" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "commandId": "string", "expectedVersion": 0, "reason": "string" }' ``` --- # Get durable provider operation status `GET https://api-stage.guidelab.co/shipments/{id}/provider-operations/{operationId}` Documentation: https://docs.guidelab.co/api-reference/shipments/getShipmentProviderOperation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `operationId` (string) **(required)** (in: path): ## Responses ### 200: Provider operation status ### 404: Provider operation not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/shipments/{id}/provider-operations/{operationId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Download an authorized immutable carrier-label PDF `GET https://api-stage.guidelab.co/shipments/{id}/labels/{labelId}/document` Documentation: https://docs.guidelab.co/api-reference/shipments/downloadShipmentLabelDocument ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `labelId` (string) **(required)** (in: path): ## Responses ### 200: Carrier-label PDF ### 404: Stored provider label not found ### 413: Stored provider label exceeds its fixed limit ### 429: Download budget exhausted ## Example ```bash curl -X GET "https://api-stage.guidelab.co/shipments/{id}/labels/{labelId}/document" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List order tags `GET https://api-stage.guidelab.co/order-tags` Returns a paginated list of order tags for the organization. Labs see their own tags; clinics must provide a labId to see a partner lab's tags. Documentation: https://docs.guidelab.co/api-reference/order-tags/listOrderTags ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` (string) (in: query): Include inactive tags - `search` (string) (in: query): Search term - `page` (string) (in: query): Page number - `limit` (string) (in: query): Items per page - `labId` (string) (in: query): Lab ID (required for clinic users) ## Responses ### 200: Paginated list of order tags - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters or missing labId for clinic ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/order-tags" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create an order tag `POST https://api-stage.guidelab.co/order-tags` Creates a new order tag with a name, color, and optional description. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/order-tags/createOrderTag ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `color` (string): (default: `#6366f1`) - `description` (string): - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Tag created successfully - `tag` (object): ### 400: Invalid request body ### 401: Unauthorized — valid session required ### 403: Forbidden — only lab organizations can create tags ## Example ```bash curl -X POST "https://api-stage.guidelab.co/order-tags" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "color": "string", "description": "string", "sortOrder": 0, "isActive": true }' ``` --- # Get an order tag `GET https://api-stage.guidelab.co/order-tags/{id}` Returns a single order tag by ID. Clinics can only view tags from their partner labs. Documentation: https://docs.guidelab.co/api-reference/order-tags/getOrderTag ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Tag ID ## Responses ### 200: Tag details - `tag` (object): ### 400: Tag ID is required ### 401: Unauthorized — valid session required ### 404: Tag not found or no partnership access ## Example ```bash curl -X GET "https://api-stage.guidelab.co/order-tags/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Deactivate an order tag `DELETE https://api-stage.guidelab.co/order-tags/{id}` Soft-deletes an order tag by setting it to inactive. The tag remains in the database for historical reference. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/order-tags/deleteOrderTag ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Tag ID ## Responses ### 200: Tag deactivated successfully - `tag` (object): - `message` (string) **(required)**: ### 400: Tag ID is required ### 401: Unauthorized — valid session required ### 403: Forbidden — only lab organizations can delete tags ### 404: Tag not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/order-tags/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update an order tag `PUT https://api-stage.guidelab.co/order-tags/{id}` Updates an existing order tag's name, color, description, active status, or sort order. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/order-tags/updateOrderTag ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Tag ID ## Request Body Content-Type: `application/json` - `name` (string): - `color` (string): (default: `#6366f1`) - `description` (string): - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 200: Tag updated successfully - `tag` (object): ### 400: Invalid request body ### 401: Unauthorized — valid session required ### 403: Forbidden — only lab organizations can update tags ### 404: Tag not found ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/order-tags/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "color": "string", "description": "string", "sortOrder": 0, "isActive": true }' ``` --- # List order filter presets `GET https://api-stage.guidelab.co/order-filter-presets` Returns the organization's persisted order filter presets, ordered by display position. Defaults are initialized during organization creation or by the explicit settings-defaults command. Documentation: https://docs.guidelab.co/api-reference/order-filter-presets/listOrderFilterPresets ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` (string) (in: query): Include inactive presets ## Responses ### 200: List of order filter presets - `data` (array) **(required)**: ### 401: Unauthorized — valid session required ### 409: Preset capacity exceeded ## Example ```bash curl -X GET "https://api-stage.guidelab.co/order-filter-presets" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create an order filter preset `POST https://api-stage.guidelab.co/order-filter-presets` Documentation: https://docs.guidelab.co/api-reference/order-filter-presets/createOrderFilterPreset ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `icon` (string,null): - `filters` (object): (default: `[object Object]`) - `statuses` (string[]): - `types` (string[]): - `doctorName` (string,null): - `patientId` (string,null): - `labId` (string,null): - `hasFiles` (boolean,null): - `hasAdvanceRequest` (boolean,null): - `sort` (object): (default: `[object Object]`) - `field` (string): (default: `createdAt`) Values: `createdAt`, `dueDate`, `submittedAt`, `orderNumber`, `status` - `direction` (string): (default: `desc`) Values: `asc`, `desc` - `columns` (string[]): (default: ``) - `layout` (string): (default: `table`) Values: `table` - `isDefault` (boolean): (default: `false`) ## Responses ### 201: Preset created - `preset` (object): ### 400: Invalid request body ### 401: Unauthorized — valid session required ### 409: Preset capacity exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/order-filter-presets" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string" }' ``` --- # Count orders per filter preset `GET https://api-stage.guidelab.co/order-filter-presets/counts` Returns the number of orders matching each active preset's filter, keyed by preset id. Powers the stat cards on the orders page. Documentation: https://docs.guidelab.co/api-reference/order-filter-presets/getOrderFilterPresetCounts ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Counts keyed by preset id - `counts` (object) **(required)**: ### 401: Unauthorized — valid session required ### 409: Preset capacity exceeded ## Example ```bash curl -X GET "https://api-stage.guidelab.co/order-filter-presets/counts" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Reorder order filter presets `POST https://api-stage.guidelab.co/order-filter-presets/reorder` Documentation: https://docs.guidelab.co/api-reference/order-filter-presets/reorderOrderFilterPresets ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `presetIds` (string[]) **(required)**: ## Responses ### 200: Presets reordered - `success` (boolean) **(required)**: ### 400: Invalid request body ### 401: Unauthorized — valid session required ### 404: One or more presets not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/order-filter-presets/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "presetIds": [ "string" ] }' ``` --- # Delete an order filter preset `DELETE https://api-stage.guidelab.co/order-filter-presets/{id}` Documentation: https://docs.guidelab.co/api-reference/order-filter-presets/deleteOrderFilterPreset ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Filter preset ID ## Responses ### 200: Preset deleted - `success` (boolean) **(required)**: ### 401: Unauthorized — valid session required ### 404: Preset not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/order-filter-presets/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update an order filter preset `PUT https://api-stage.guidelab.co/order-filter-presets/{id}` Documentation: https://docs.guidelab.co/api-reference/order-filter-presets/updateOrderFilterPreset ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Filter preset ID ## Request Body Content-Type: `application/json` - `name` (string): - `icon` (string,null): - `filters` (object): (default: `[object Object]`) - `statuses` (string[]): - `types` (string[]): - `doctorName` (string,null): - `patientId` (string,null): - `labId` (string,null): - `hasFiles` (boolean,null): - `hasAdvanceRequest` (boolean,null): - `sort` (object): (default: `[object Object]`) - `field` (string): (default: `createdAt`) Values: `createdAt`, `dueDate`, `submittedAt`, `orderNumber`, `status` - `direction` (string): (default: `desc`) Values: `asc`, `desc` - `columns` (string[]): (default: ``) - `layout` (string): (default: `table`) Values: `table` - `isDefault` (boolean): (default: `false`) ## Responses ### 200: Preset updated - `preset` (object): ### 400: Invalid request body ### 401: Unauthorized — valid session required ### 404: Preset not found ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/order-filter-presets/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Search patients (autocomplete / combobox) `GET https://api-stage.guidelab.co/patients` Search patients with fuzzy matching for autocomplete/combobox use. Labs see patients from partnered clinics (respecting share-all-patients and lab access settings). Clinics see only their own patients. Anonymized patients are masked for labs. Documentation: https://docs.guidelab.co/api-reference/patients/searchPatients ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `q` (string) (in: query): Search query for patient name, code, or external ID Default: `` - `clinicId` (string) (in: query): Filter patients by clinic ID - `limit` (integer) (in: query): Maximum number of results to return Default: `50` ## Responses ### 200: List of matching patients - `patients` (object[]) **(required)**: - `id` (string) **(required)**: - `clinicId` (string) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `gender` (string,null) **(required)**: - `dateOfBirth` (string,null) **(required)**: - `phone` (string,null) **(required)**: - `email` (string,null) **(required)**: - `externalId` (string,null) **(required)**: - `clinicName` (string,null) **(required)**: - `patientCode` (string,null) **(required)**: - `fullName` (string) **(required)**: - `clinic` (object,null) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `isAnonymized` (boolean) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized ### 403: Access denied to clinic's patients ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/patients" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a new patient `POST https://api-stage.guidelab.co/patients` Create a new patient record. Clinics can only create patients for themselves. Labs can create patients for partnered clinics and automatically get lab access granted. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/patients/createPatient ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `clinicId` (string) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `gender` (string): Values: `male`, `female`, `other`, `prefer_not_to_say` - `dateOfBirth` (string,null): - `phone` (string): - `email` (object): - `externalId` (string): - `notes` (string): ## Responses ### 201: Patient created successfully - `patient` (object) **(required)**: - `id` (string) **(required)**: - `clinicId` (string) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `fullName` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized ### 403: Cannot create patient for this clinic ### 409: A patient with this external ID already exists for this clinic ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/patients" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "clinicId": "string", "firstName": "string", "lastName": "string" }' ``` --- # Paginated patient list `GET https://api-stage.guidelab.co/patients/list` Retrieve a paginated list of patients with order counts. Labs see patients from partnered clinics (respecting share-all-patients and lab access settings). Clinics see only their own. Supports search, sorting, and clinic filtering. Documentation: https://docs.guidelab.co/api-reference/patients/listPatients ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Page number Default: `1` - `limit` (integer) (in: query): Items per page Default: `20` - `search` (string) (in: query): Search term for patient name or external ID - `clinicId` (string) (in: query): Filter by clinic ID - `sortBy` (string) (in: query): Field to sort by Values: `name`, `practice`, `dateOfBirth`, `orders`, `createdAt` Default: `name` - `sortOrder` (string) (in: query): Sort direction Values: `asc`, `desc` Default: `asc` ## Responses ### 200: Paginated list of patients with order counts - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `fullName` (string) **(required)**: - `dateOfBirth` (string,null) **(required)**: - `phone` (string,null) **(required)**: - `email` (string,null) **(required)**: - `externalId` (string,null) **(required)**: - `clinicId` (string) **(required)**: - `clinicName` (string,null) **(required)**: - `orderCount` (number) **(required)**: - `createdAt` (string) **(required)**: - `patientCode` (string,null) **(required)**: - `isAnonymized` (boolean) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/patients/list" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get a single patient by ID `GET https://api-stage.guidelab.co/patients/{id}` Retrieve a patient's details. Labs can access patients from partnered clinics (subject to lab access and share-all-patients settings). Anonymized patients return masked data for labs. Clinics can only access their own patients. Documentation: https://docs.guidelab.co/api-reference/patients/getPatient ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Patient ID ## Responses ### 200: Patient details (may be anonymized for labs) - `patient` (object) **(required)**: - `id` (string) **(required)**: - `clinicId` (string) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `gender` (string,null) **(required)**: - `dateOfBirth` (string,null) **(required)**: - `phone` (string,null) **(required)**: - `email` (string,null) **(required)**: - `externalId` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `clinicName` (string,null) **(required)**: - `fullName` (string) **(required)**: - `patientCode` (string,null) **(required)**: - `isAnonymized` (boolean) **(required)**: ### 401: Unauthorized ### 403: Access denied to this patient ### 404: Patient not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/patients/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Erase a patient identity `DELETE https://api-stage.guidelab.co/patients/{id}` Immediately pseudonymizes a clinic-owned patient and starts bounded cleanup of retained identity copies. Replays are idempotent. Documentation: https://docs.guidelab.co/api-reference/patients/erasePatientIdentity ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 202: Identity erasure accepted or already in progress - `status` (string) **(required)**: Values: `requested`, `already_requested` ### 401: Unauthorized ### 403: Clinic manager access required ### 404: Patient not found ### 409: Controller retention hold blocks identity erasure ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/patients/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a patient's details `PUT https://api-stage.guidelab.co/patients/{id}` Update an existing patient's details. Clinics can only update their own patients. Labs can update patients from partnered clinics they have access to (subject to lab access and share-all-patients settings). Anonymized/hidden patients cannot be edited. The patient's clinic and patient code cannot be changed. Documentation: https://docs.guidelab.co/api-reference/patients/updatePatient ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Patient ID ## Request Body Content-Type: `application/json` - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `gender` (string): Values: `male`, `female`, `other`, `prefer_not_to_say` - `dateOfBirth` (string,null): - `phone` (string): - `email` (object): - `externalId` (string): - `notes` (string): ## Responses ### 200: Patient updated successfully - `patient` (object) **(required)**: - `id` (string) **(required)**: - `clinicId` (string) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `fullName` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized ### 403: Access denied to this patient ### 404: Patient not found ### 409: A patient with this external ID already exists for this clinic ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/patients/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "firstName": "string", "lastName": "string" }' ``` --- # List labs with access to a patient `GET https://api-stage.guidelab.co/patients/{id}/lab-access` List labs with effective access through either an explicit live grant or the active partnership's share-all-patients policy. Clinic only - the patient must belong to the current clinic. Documentation: https://docs.guidelab.co/api-reference/patients/listPatientLabAccess ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Patient ID ## Responses ### 200: List of labs with effective access and its source - `labs` (object[]) **(required)**: - `labId` (string) **(required)**: - `labName` (string,null) **(required)**: - `grantedAt` (object): - `accessSource` (string) **(required)**: Values: `explicit`, `partnership` - `grantSource` (string,null) **(required)**: Values: `manual`, `order`, `patient_creation`, `null` - `sourceOrderId` (string,null) **(required)**: ### 401: Unauthorized ### 403: Forbidden - clinic only ### 404: Patient not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/patients/{id}/lab-access" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Grant lab access to a patient `POST https://api-stage.guidelab.co/patients/{id}/lab-access` Grant a specific lab explicit access to a patient record. The lab must have an active partnership with the clinic. Clinic only - the patient must belong to the current clinic. Idempotent - granting access twice is a no-op. Documentation: https://docs.guidelab.co/api-reference/patients/grantPatientLabAccess ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Patient ID ## Request Body Content-Type: `application/json` - `labId` (string) **(required)**: ## Responses ### 201: Lab access granted to patient - `success` (boolean) **(required)**: Values: `true` ### 400: Invalid request body ### 401: Unauthorized ### 403: No active partnership with this lab ### 404: Patient not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/patients/{id}/lab-access" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "labId": "string" }' ``` --- # Revoke lab access to a patient `DELETE https://api-stage.guidelab.co/patients/{id}/lab-access` Revoke a lab's effective access while retaining grant and revocation audit evidence. Under partnership-wide sharing this creates a per-patient exclusion. Active and suspended partnership epochs are supported. Clinic only. Documentation: https://docs.guidelab.co/api-reference/patients/revokePatientLabAccess ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Patient ID ## Request Body Content-Type: `application/json` - `labId` (string) **(required)**: ## Responses ### 200: Lab access revoked from patient - `success` (boolean) **(required)**: Values: `true` ### 400: Invalid request body ### 401: Unauthorized ### 403: Forbidden - clinic only ### 404: Patient not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/patients/{id}/lab-access" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "labId": "string" }' ``` --- # List partnerships for the current organization `GET https://api-stage.guidelab.co/partnerships` Retrieve a paginated list of partnerships with order statistics. Labs see clinic partners, clinics see lab partners. Supports search, status filtering, practice group filtering, and configurable sorting. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/partnerships/listPartnerships ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Page number Default: `1` - `limit` (integer) (in: query): Items per page Default: `20` - `search` (string) (in: query): Search term for partner name, email, or city - `status` () (in: query): Filter by partnership status Default: `all` - `practiceGroupId` (string) (in: query): Filter by practice group ID - `sortBy` (string) (in: query): Field to sort by Values: `name`, `totalOrders`, `activeOrders`, `lastOrderDate`, `createdAt` Default: `name` - `sortOrder` (string) (in: query): Sort direction Values: `asc`, `desc` Default: `asc` ## Responses ### 200: Paginated list of partnerships with order statistics - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `partnerId` (string) **(required)**: - `partnerName` (string,null) **(required)**: - `partnerEmail` (string,null) **(required)**: - `partnerPhone` (string,null) **(required)**: - `partnerCity` (string,null) **(required)**: - `partnerLogo` (string,null) **(required)**: - `status` (string) **(required)**: - `initiatedBy` (string,null) **(required)**: - `totalOrders` (number) **(required)**: - `activeOrders` (number) **(required)**: - `lastOrderDate` (string,null) **(required)**: - `practiceGroupId` (string,null) **(required)**: - `practiceGroupName` (string,null) **(required)**: - `billingOwnerId` (string,null) **(required)**: - `partnerProvisioningStatus` (string) **(required)**: Values: `claimed`, `pending_claim`, `managed`, `abandoned` - `claimKind` (string,null) **(required)**: Values: `provisional_owner`, `managed_owner`, `null` - `createdAt` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/partnerships" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Search for potential partners `GET https://api-stage.guidelab.co/partnerships/search` Search for discoverable organizations to form new partnerships with. Excludes existing partners. Supports text search, organization type filtering, and geographic bounding box filtering. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/partnerships/searchPartners ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `q` (string) (in: query): Search query for organization name - `type` (string) **(required)** (in: query): Organization type to search for Values: `lab`, `clinic` - `minLat` (number) (in: query): Minimum latitude for geographic bounding box - `maxLat` (number) (in: query): Maximum latitude for geographic bounding box - `minLng` (number) (in: query): Minimum longitude for geographic bounding box - `maxLng` (number) (in: query): Maximum longitude for geographic bounding box - `limit` (integer) (in: query): Maximum number of results to return Default: `50` - `page` (integer) (in: query): Page number Default: `1` - `categories` (string) (in: query): Comma-separated list of service/category name fragments to filter by (lab search only). Each fragment is matched case-insensitively against the lab's product category names. - `sortBy` (string) (in: query): Sort order. 'distance' requires clinicLat and clinicLng; falls back to 'name' otherwise. Values: `name`, `distance` Default: `name` - `clinicLat` (number) (in: query): Requesting organization's latitude (for distance sort). - `clinicLng` (number) (in: query): Requesting organization's longitude (for distance sort). ## Responses ### 200: Paginated search results of potential partner organizations - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string,null) **(required)**: - `city` (string,null) **(required)**: - `country` (string,null) **(required)**: - `logo` (string,null) **(required)**: - `latitude` (string,null) **(required)**: - `longitude` (string,null) **(required)**: - `description` (string,null) **(required)**: - `hasCoverImage` (boolean) **(required)**: - `categories` (string[]) **(required)**: - `partnershipStatus` (string,null) **(required)**: - `partnershipId` (string,null) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/partnerships/search" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Invite a new clinic to GuideLab `POST https://api-stage.guidelab.co/partnerships/invite` Create a new clinic organization and pending partnership in one step. Sends an invitation email to the clinic manager. Lab only. Documentation: https://docs.guidelab.co/api-reference/partnerships/inviteClinic ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `clinicName` (string) **(required)**: - `address` (string): - `city` (string): - `postcode` (string): - `country` (string): - `managerEmail` (string) **(required)**: [email] - `managerName` (string) **(required)**: ## Responses ### 201: Clinic organization created and partnership established - `organization` (object): - `partnership` (object): ### 400: Invalid request or clinic name already exists ### 401: Unauthorized ### 403: Forbidden - lab only ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/partnerships/invite" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "clinicName": "string", "managerEmail": "string", "managerName": "string" }' ``` --- # Invite an owner to claim a lab-managed clinic `POST https://api-stage.guidelab.co/partnerships/{id}/invite-owner` Starts an ownership handoff for an imported clinic while preserving its existing active partnership and history. Documentation: https://docs.guidelab.co/api-reference/partnerships/inviteManagedClinicOwner ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `managerEmail` (string) **(required)**: [email] - `managerName` (string): ## Responses ### 201: Ownership claim invitation created - `success` (boolean) **(required)**: Values: `true` - `organizationId` (string) **(required)**: ### 400: Invalid ownership handoff ### 401: Unauthorized ### 403: Lab manager required ### 404: Managed clinic partnership not found ### 409: Clinic state changed concurrently ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/partnerships/{id}/invite-owner" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "managerEmail": "string", "managerName": "string" }' ``` --- # Cancel a managed clinic ownership handoff `POST https://api-stage.guidelab.co/partnerships/{id}/claim/cancel` Documentation: https://docs.guidelab.co/api-reference/partnerships/cancelManagedClinicClaim ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Ownership handoff canceled ### 401: Unauthorized ### 403: Lab manager required ### 404: Pending managed claim not found ### 409: Claim resolved concurrently ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/partnerships/{id}/claim/cancel" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Request a partnership with another organization `POST https://api-stage.guidelab.co/partnerships/request` Send a partnership request to another organization. The target must be a different type (lab requests clinic, clinic requests lab). Sends a notification to the target organization's owners. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/partnerships/requestPartnership ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `targetOrgId` (string) **(required)**: ## Responses ### 201: Partnership request created with pending status - `partnership` (object): ### 400: Invalid request or same organization type ### 401: Unauthorized ### 404: Target organization not found ### 409: Partnership already exists between these organizations ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/partnerships/request" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "targetOrgId": "string" }' ``` --- # Get partnership detail view `GET https://api-stage.guidelab.co/partnerships/{id}` Retrieve full partnership details including partner organization info, order/patient statistics, practice group, and gallery images. Only accessible by organizations that are part of the partnership. Documentation: https://docs.guidelab.co/api-reference/partnerships/getPartnership ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Partnership ID ## Responses ### 200: Full partnership detail with partner info and statistics - `partnershipId` (string) **(required)**: - `partnerId` (string) **(required)**: - `partnerType` (string) **(required)**: Values: `lab`, `clinic` - `status` (string) **(required)**: - `initiatedBy` (string,null) **(required)**: - `practiceGroupName` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `partner` (object) **(required)**: - `name` (string,null) **(required)**: - `logo` (string,null) **(required)**: - `email` (string,null) **(required)**: - `phone` (string,null) **(required)**: - `billingEmail` (string,null) **(required)**: - `address` (string,null) **(required)**: - `addressLine2` (string,null) **(required)**: - `city` (string,null) **(required)**: - `postcode` (string,null) **(required)**: - `country` (string,null) **(required)**: - `website` (string,null) **(required)**: - `companyNumber` (string,null) **(required)**: - `taxRegistrationNumber` (string,null) **(required)**: - `description` (string,null) **(required)**: - `hasCoverImage` (boolean) **(required)**: - `latitude` (string,null) **(required)**: - `longitude` (string,null) **(required)**: - `stats` (object) **(required)**: - `totalOrders` (number) **(required)**: - `activeOrders` (number) **(required)**: - `totalPatients` (number,null) **(required)**: - `gallery` (object[]) **(required)**: - `id` (string) **(required)**: - `sortOrder` (number,null) **(required)**: ### 401: Unauthorized ### 404: Partnership not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/partnerships/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get clinic detail view for a partnership `GET https://api-stage.guidelab.co/partnerships/{id}/detail` Retrieve detailed clinic information for a partnership, including clinic contact info, order statistics, and patient count. Lab only - uses the partnership ID as the path parameter. Documentation: https://docs.guidelab.co/api-reference/partnerships/getPartnershipClinicDetail ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Partnership ID ## Responses ### 200: Clinic detail with contact info, order and patient stats - `id` (string) **(required)**: - `clinicId` (string) **(required)**: - `status` (string) **(required)**: - `practiceGroupName` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `clinic` (object) **(required)**: - `name` (string,null) **(required)**: - `email` (string,null) **(required)**: - `phone` (string,null) **(required)**: - `address` (string,null) **(required)**: - `addressLine2` (string,null) **(required)**: - `city` (string,null) **(required)**: - `postcode` (string,null) **(required)**: - `country` (string,null) **(required)**: - `website` (string,null) **(required)**: - `billingEmail` (string,null) **(required)**: - `companyNumber` (string,null) **(required)**: - `taxRegistrationNumber` (string,null) **(required)**: - `stats` (object) **(required)**: - `totalOrders` (number) **(required)**: - `activeOrders` (number) **(required)**: - `totalPatients` (number) **(required)**: ### 401: Unauthorized ### 403: Forbidden ### 404: Partnership not found ### 409: Partnership invitation was resolved concurrently ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/partnerships/{id}/detail" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Accept a pending partnership request `POST https://api-stage.guidelab.co/partnerships/{id}/accept` Accept a pending partnership request. Only the receiving party can accept (e.g., if a lab initiated, only the clinic can accept). Sends a notification to the initiating party. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/partnerships/acceptPartnership ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Partnership ID ## Responses ### 200: Partnership accepted and activated - `partnership` (object): ### 400: Partnership is not pending ### 401: Unauthorized ### 403: Forbidden ### 404: Partnership not found ### 409: Partnership invitation was resolved concurrently ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/partnerships/{id}/accept" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Cancel a pending partnership request `POST https://api-stage.guidelab.co/partnerships/{id}/cancel` Cancel a pending partnership request. Only the initiating party can cancel. Also cancels any associated pending invitations. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/partnerships/cancelPartnership ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Partnership ID ## Responses ### 200: Partnership request cancelled and deleted - `success` (boolean) **(required)**: Values: `true` - `message` (string) **(required)**: ### 400: Partnership is not pending ### 401: Unauthorized ### 403: Forbidden ### 404: Partnership not found ### 409: Partnership invitation was resolved concurrently ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/partnerships/{id}/cancel" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Reject a pending partnership request `POST https://api-stage.guidelab.co/partnerships/{id}/reject` Reject a pending partnership request. Only the receiving party can reject. Sends a notification to the initiating party and retains the rejected relationship epoch as immutable history. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/partnerships/rejectPartnership ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Partnership ID ## Responses ### 200: Partnership rejected and retained as history - `success` (boolean) **(required)**: Values: `true` - `message` (string) **(required)**: ### 400: Partnership is not pending ### 401: Unauthorized ### 403: Forbidden ### 404: Partnership not found ### 409: Partnership status changed concurrently ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/partnerships/{id}/reject" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Reactivate a suspended partnership `POST https://api-stage.guidelab.co/partnerships/{id}/reactivate` Reactivate a suspended partnership back to active status. Either party in the partnership can reactivate it. Sends a notification to the other party. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/partnerships/reactivatePartnership ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Partnership ID ## Responses ### 200: Partnership reactivated to active status - `partnership` (object): ### 400: Partnership is not suspended ### 401: Unauthorized ### 403: Forbidden ### 404: Partnership not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/partnerships/{id}/reactivate" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Resend partnership invitation email `POST https://api-stage.guidelab.co/partnerships/{id}/resend` Resend the invitation email for a pending partnership. Extends the invitation expiry by 30 days. Lab only - only the lab that initiated the partnership can resend. Documentation: https://docs.guidelab.co/api-reference/partnerships/resendPartnershipInvite ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Partnership ID ## Responses ### 200: Invitation email resent with extended expiry - `success` (boolean) **(required)**: Values: `true` ### 400: Partnership is not pending ### 401: Unauthorized ### 403: Forbidden ### 404: Partnership or invitation not found ### 429: Partnership invitation send budget exceeded ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/partnerships/{id}/resend" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get share-all-patients setting `GET https://api-stage.guidelab.co/partnerships/{id}/share-all-patients` Check whether the share-all-patients setting is enabled for a partnership. Both parties of the partnership can read this setting. Documentation: https://docs.guidelab.co/api-reference/partnerships/getShareAllPatients ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Partnership ID ## Responses ### 200: Current share-all-patients boolean value - `shareAllPatients` (boolean) **(required)**: ### 401: Unauthorized ### 403: Forbidden ### 404: Partnership not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/partnerships/{id}/share-all-patients" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update share-all-patients setting `PUT https://api-stage.guidelab.co/partnerships/{id}/share-all-patients` Toggle whether all patients are automatically shared with the lab partner. When disabled, labs only see patients with explicit lab access grants. Clinic only. Documentation: https://docs.guidelab.co/api-reference/partnerships/updateShareAllPatients ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Partnership ID ## Request Body Content-Type: `application/json` - `shareAllPatients` (boolean) **(required)**: ## Responses ### 200: Setting updated - `shareAllPatients` (boolean) **(required)**: ### 401: Unauthorized ### 403: Forbidden ### 404: Partnership not found ### 409: Partnership is not active or changed concurrently ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/partnerships/{id}/share-all-patients" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "shareAllPatients": true }' ``` --- # Suspend an active partnership `POST https://api-stage.guidelab.co/partnerships/{id}/suspend` Suspend an active partnership. Either party can suspend. Sends a notification to the other party. The partnership can later be reactivated. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/partnerships/suspendPartnership ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Partnership ID ## Responses ### 200: Partnership suspended - `partnership` (object): ### 400: Partnership is not active ### 401: Unauthorized ### 403: Forbidden ### 404: Partnership not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/partnerships/{id}/suspend" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Terminate a partnership `POST https://api-stage.guidelab.co/partnerships/{id}/terminate` Permanently terminate a partnership. Either party can terminate. Sends a notification to the other party. This action is not reversible. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/partnerships/terminatePartnership ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Partnership ID ## Responses ### 200: Partnership terminated permanently - `partnership` (object): ### 400: Partnership is already terminated ### 401: Unauthorized ### 403: Forbidden ### 404: Partnership not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/partnerships/{id}/terminate" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get payment settings for a partnership `GET https://api-stage.guidelab.co/partnership-payment-settings/{partnershipId}` Retrieve payment policy settings for a partnership, including the effective policy (partnership override or lab default) and Stripe Connect status. Available to both parties of the partnership. Documentation: https://docs.guidelab.co/api-reference/partnership-payment-settings/getPartnershipPaymentSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `partnershipId` (string) **(required)** (in: path): Partnership ID ## Responses ### 200: Payment settings with effective policy and Stripe Connect info - `paymentPolicy` (string,null) **(required)**: - `invoiceDuePolicy` (string,null) **(required)**: Values: `net_days`, `day_of_month`, `null` - `invoiceTermDays` (integer,null) **(required)**: - `invoiceDueDay` (integer,null) **(required)**: - `invoiceDueMonthRule` (string,null) **(required)**: Values: `next_occurrence`, `following_month`, `null` - `creditHoldEnabled` (boolean,null) **(required)**: - `effectivePolicy` (string) **(required)**: - `paymentUnavailable` (boolean) **(required)**: - `effectiveInvoiceDuePolicy` (object) **(required)**: - `effectiveInvoiceTermDays` (integer,null) **(required)**: - `effectiveCreditHoldEnabled` (boolean) **(required)**: - `creditHoldActive` (boolean) **(required)**: - `labDefault` (string) **(required)**: - `labDefaultInvoiceDuePolicy` (object) **(required)**: - `labDefaultInvoiceTermDays` (integer,null) **(required)**: - `labDefaultCreditHoldEnabled` (boolean) **(required)**: - `labStripeAccountId` (string,null) **(required)**: - `autopayEnabled` (boolean) **(required)**: - `autopayConsentedAt` (string,null) **(required)**: [date-time] ### 401: Unauthorized ### 404: Partnership not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/partnership-payment-settings/{partnershipId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update payment settings for a partnership `PUT https://api-stage.guidelab.co/partnership-payment-settings/{partnershipId}` Set or clear a payment policy override for a partnership. Setting to null removes the override and falls back to the lab's default policy. Only the lab owner of the partnership may change it. Documentation: https://docs.guidelab.co/api-reference/partnership-payment-settings/updatePartnershipPaymentSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `partnershipId` (string) **(required)** (in: path): Partnership ID ## Request Body Content-Type: `application/json` - `paymentPolicy` (string,null): Values: `pay_on_invoice`, `pay_in_advance`, `null` - `invoiceDuePolicy` (string,null): Values: `net_days`, `day_of_month`, `null` - `invoiceTermDays` (integer,null): - `invoiceDueDay` (integer,null): - `invoiceDueMonthRule` (string,null): Values: `next_occurrence`, `following_month`, `null` - `creditHoldEnabled` (boolean,null): ## Responses ### 200: Settings updated - `success` (boolean) **(required)**: Values: `true` ### 400: Invalid payment policy ### 401: Unauthorized ### 403: Forbidden ### 404: Partnership not found ### 409: Partnership is not active ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/partnership-payment-settings/{partnershipId}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "paymentPolicy": "pay_on_invoice", "invoiceDuePolicy": "net_days", "invoiceTermDays": "string", "invoiceDueDay": "string", "invoiceDueMonthRule": "next_occurrence", "creditHoldEnabled": "string" }' ``` --- # List practice groups `GET https://api-stage.guidelab.co/practice-groups` Retrieve a paginated list of practice groups for the current lab. Optionally includes partnership counts and inactive groups. Lab only. Documentation: https://docs.guidelab.co/api-reference/practice-groups/listPracticeGroups ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` () (in: query): Default: `false` - `includePartnershipCount` () (in: query): Default: `true` - `search` (string) (in: query): - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `50` ## Responses ### 200: List of practice groups - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `useCustomExport` (boolean) **(required)**: - `exportConfig` (object): - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `partnershipCount` (number): - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized ### 403: Forbidden ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/practice-groups" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a practice group `POST https://api-stage.guidelab.co/practice-groups` Create a new practice group to organize clinic partnerships. Supports custom export configurations. Lab only. Documentation: https://docs.guidelab.co/api-reference/practice-groups/createPracticeGroup ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `description` (string): - `useCustomExport` (boolean): (default: `false`) - `exportConfig` (object): - `fields` (object[]): (default: ``) - `key` (string) **(required)**: - `label` (string) **(required)**: - `enabled` (boolean): (default: `true`) - `sortOrder` (integer): (default: `0`) - `format` (string): (default: `csv`) Values: `csv`, `xlsx`, `pdf` - `includeHeaders` (boolean): (default: `true`) - `dateFormat` (string): (default: `YYYY-MM-DD`) - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Practice group created - `practiceGroup` (object): ### 400: Invalid request body ### 401: Unauthorized ### 403: Forbidden ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/practice-groups" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "useCustomExport": true, "exportConfig": { "fields": [ { "key": "string", "label": "string", "enabled": true, "sortOrder": 0 } ], "format": "csv", "includeHeaders": true, "dateFormat": "string" }, "sortOrder": 0, "isActive": true }' ``` --- # Get a practice group by ID `GET https://api-stage.guidelab.co/practice-groups/{id}` Retrieve a practice group with partnership count. Optionally includes the full list of partnerships in the group. Lab only. Documentation: https://docs.guidelab.co/api-reference/practice-groups/getPracticeGroup ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `includePartnerships` (string) (in: query): ## Responses ### 200: Practice group - `practiceGroup` (object): ### 401: Unauthorized ### 403: Forbidden ### 404: Practice group not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/practice-groups/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Deactivate a practice group `DELETE https://api-stage.guidelab.co/practice-groups/{id}` Soft-delete a practice group by setting it to inactive. Active partnerships in the group are unassigned first; terminal epochs retain their historical grouping. Lab manager only. Documentation: https://docs.guidelab.co/api-reference/practice-groups/deletePracticeGroup ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Practice group deactivated - `practiceGroup` (object): - `message` (string) **(required)**: ### 401: Unauthorized ### 403: Forbidden ### 404: Practice group not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/practice-groups/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a practice group `PUT https://api-stage.guidelab.co/practice-groups/{id}` Update one or more fields of a practice group. Supports partial updates. Lab only. Documentation: https://docs.guidelab.co/api-reference/practice-groups/updatePracticeGroup ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `name` (string): - `description` (string): - `useCustomExport` (boolean): (default: `false`) - `exportConfig` (object): - `fields` (object[]): (default: ``) - `key` (string) **(required)**: - `label` (string) **(required)**: - `enabled` (boolean): (default: `true`) - `sortOrder` (integer): (default: `0`) - `format` (string): (default: `csv`) Values: `csv`, `xlsx`, `pdf` - `includeHeaders` (boolean): (default: `true`) - `dateFormat` (string): (default: `YYYY-MM-DD`) - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 200: Practice group updated - `practiceGroup` (object): ### 400: Invalid request body ### 401: Unauthorized ### 403: Forbidden ### 404: Practice group not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/practice-groups/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "useCustomExport": true, "exportConfig": { "fields": [ { "key": "string", "label": "string", "enabled": true, "sortOrder": 0 } ], "format": "csv", "includeHeaders": true, "dateFormat": "string" }, "sortOrder": 0, "isActive": true }' ``` --- # List partnerships in a practice group `GET https://api-stage.guidelab.co/practice-groups/{id}/partnerships` Retrieve active partnerships assigned to a specific practice group, including clinic names and logos. Lab only. Documentation: https://docs.guidelab.co/api-reference/practice-groups/listPracticeGroupPartnerships ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: List of partnerships - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `clinicId` (string) **(required)**: - `status` (string) **(required)**: - `initiatedBy` (string,null) **(required)**: - `practiceGroupId` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `clinicName` (string,null) **(required)**: - `clinicLogo` (string,null) **(required)**: ### 401: Unauthorized ### 403: Forbidden ### 404: Practice group not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/practice-groups/{id}/partnerships" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Assign partnerships to a practice group `POST https://api-stage.guidelab.co/practice-groups/{id}/partnerships` Assign one or more active partnerships to an active practice group. All partnerships must belong to the current lab. Lab manager only. Documentation: https://docs.guidelab.co/api-reference/practice-groups/assignPracticeGroupPartnerships ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `partnershipIds` (string[]) **(required)**: ## Responses ### 200: Partnerships assigned - `data` (array) **(required)**: - `message` (string) **(required)**: ### 400: Invalid request or partnerships not found ### 401: Unauthorized ### 403: Forbidden ### 404: Practice group not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/practice-groups/{id}/partnerships" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "partnershipIds": [ "string" ] }' ``` --- # Remove a partnership from a practice group `DELETE https://api-stage.guidelab.co/practice-groups/{id}/partnerships/{partnershipId}` Remove a single active partnership from a practice group by setting its practiceGroupId to null. The partnership itself is not deleted. Lab manager only. Documentation: https://docs.guidelab.co/api-reference/practice-groups/removePracticeGroupPartnership ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `partnershipId` (string) **(required)** (in: path): ## Responses ### 200: Partnership removed from group - `partnership` (object): - `message` (string) **(required)**: ### 401: Unauthorized ### 403: Forbidden ### 404: Practice group or partnership not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/practice-groups/{id}/partnerships/{partnershipId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Organization Onboarding `GET https://api-stage.guidelab.co/organization/onboarding` Documentation: https://docs.guidelab.co/api-reference/organization-onboarding/getOrganizationOnboarding ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Persisted onboarding snapshot - `onboarding` (object): ### 403: Organization owner required ### 404: Onboarding is not required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/onboarding" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Save Organization Onboarding Step `PUT https://api-stage.guidelab.co/organization/onboarding/step` Documentation: https://docs.guidelab.co/api-reference/organization-onboarding/saveOrganizationOnboardingStep ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `step` (string) **(required)**: Values: `identity`, `regional`, `location`, `tax`, `subscription` - `direction` (string) **(required)**: Values: `forward`, `back` - `data` (object): ## Responses ### 200: Updated onboarding snapshot - `onboarding` (object): ### 400: Invalid or out-of-order onboarding step ### 403: Organization owner required ### 404: Onboarding is not required ### 409: Organization identity conflicts ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/organization/onboarding/step" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "step": "identity", "direction": "forward", "data": "string" }' ``` --- # Complete Clinic Organization Onboarding `POST https://api-stage.guidelab.co/organization/onboarding/complete` Documentation: https://docs.guidelab.co/api-reference/organization-onboarding/completeClinicOrganizationOnboarding ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Clinic onboarding completed ### 400: Required clinic details are incomplete ### 403: Clinic owner required ### 404: Onboarding is not required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/organization/onboarding/complete" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Onboarding Subscription Checkout `POST https://api-stage.guidelab.co/organization/onboarding/subscription-checkout` Documentation: https://docs.guidelab.co/api-reference/organization-onboarding/createOnboardingSubscriptionCheckout ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `plan` (string) **(required)**: Values: `base`, `growth`, `scale` - `interval` (string) **(required)**: Values: `month`, `year` - `returnUrl` (string) **(required)**: [uri] - `cancelUrl` (string) **(required)**: [uri] ## Responses ### 200: Stripe Checkout URL - `url` (string) **(required)**: [uri] ### 400: Plan selection is not persisted ### 403: Lab owner required ### 404: Onboarding is not required ### 409: The lab already has an active or unreviewed platform subscription ### 502: Stripe Checkout could not be created ### 503: Billing verification is temporarily unavailable ## Example ```bash curl -X POST "https://api-stage.guidelab.co/organization/onboarding/subscription-checkout" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "plan": "base", "interval": "month", "returnUrl": "https://example.com", "cancelUrl": "https://example.com" }' ``` --- # Check organization name availability `GET https://api-stage.guidelab.co/organization/check-availability` Check whether an organization name is already taken. No authentication required. Used during onboarding. Documentation: https://docs.guidelab.co/api-reference/organization/checkOrgNameAvailability ## Parameters - `name` (string) (in: query): - `type` (string) (in: query): ## Responses ### 200: Availability result - `available` (boolean) **(required)**: - `name` (string): - `message` (string): ### 400: Invalid input ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/check-availability" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Check organization slug availability `GET https://api-stage.guidelab.co/organization/check-slug` Check whether an organization slug is already taken. Requires user authentication. Used during onboarding. Documentation: https://docs.guidelab.co/api-reference/organization/checkOrgSlugAvailability ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `slug` (string) (in: query): ## Responses ### 200: Slug availability - `available` (boolean) **(required)**: ### 400: Invalid input ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/check-slug" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a new organization `POST https://api-stage.guidelab.co/organization/create` Create a new lab or clinic organization. The current user becomes the owner. Labs get default treatment phases and steps. Sets the new org as the user's active organization. Documentation: https://docs.guidelab.co/api-reference/organization/createOrganization ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `slug` (string): - `type` (string) **(required)**: Values: `clinic`, `lab` - `phone` (string): - `address` (string): - `city` (string): - `postcode` (string): - `website` (object): ## Responses ### 200: Organization created - `success` (boolean) **(required)**: - `organization` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `slug` (string) **(required)**: - `organizationType` (string) **(required)**: ### 400: Invalid input ### 401: Unauthorized ### 409: Organization slug already exists ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/organization/create" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "type": "clinic" }' ``` --- # List pending join requests `GET https://api-stage.guidelab.co/organization/join-request` List all pending join requests for the current organization. Only organization owners can view these. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/organization/listJoinRequests ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of join requests - `requests` (object[]) **(required)**: - `id` (string) **(required)**: - `userId` (string) **(required)**: - `status` (string) **(required)**: - `message` (string,null) **(required)**: - `createdAt` (object): - `userName` (string) **(required)**: - `userEmail` (string) **(required)**: ### 401: Unauthorized ### 403: Forbidden ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/join-request" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Request to join an organization `POST https://api-stage.guidelab.co/organization/join-request` Submit a request to join an organization. Sends a notification to the organization's owners. Prevents duplicate requests. Documentation: https://docs.guidelab.co/api-reference/organization/createJoinRequest ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `organizationId` (string) **(required)**: - `message` (string): ## Responses ### 201: Join request created - `success` (boolean) **(required)**: - `joinRequest` (object) **(required)**: - `id` (string) **(required)**: - `status` (string) **(required)**: - `createdAt` (object): ### 400: Invalid input ### 401: Unauthorized ### 404: Organization not found ### 409: Already a member or request pending ### 429: Join request creation budget exceeded ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/organization/join-request" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "organizationId": "string", "message": "string" }' ``` --- # Approve or reject a join request `PATCH https://api-stage.guidelab.co/organization/join-request/{id}` Approve or reject a pending join request. Approved users become staff members. Sends a notification to the requester. Owner only. Documentation: https://docs.guidelab.co/api-reference/organization/processJoinRequest ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `action` (string) **(required)**: Values: `approve`, `reject` ## Responses ### 200: Join request processed - `success` (boolean) **(required)**: - `message` (string) **(required)**: ### 400: Invalid action ### 401: Unauthorized ### 403: Forbidden ### 404: Join request not found ### 500: Internal server error ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/organization/join-request/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "action": "approve" }' ``` --- # Resend a join request notification `POST https://api-stage.guidelab.co/organization/join-request/{id}/resend` Resend notification emails to organization owners about a pending join request. Only the request author can resend. Documentation: https://docs.guidelab.co/api-reference/organization/resendJoinRequest ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Notification resent - `success` (boolean) **(required)**: ### 401: Unauthorized ### 404: Join request not found ### 429: Join request reminder budget exceeded ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/organization/join-request/{id}/resend" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Search organizations to join `GET https://api-stage.guidelab.co/organization/join-search` Search for organizations the current user could request to join. Includes existing request and membership status for each result. Used during onboarding. Documentation: https://docs.guidelab.co/api-reference/organization/searchOrganizationsToJoin ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `q` (string) (in: query): - `type` (string) (in: query): - `limit` (string) (in: query): ## Responses ### 200: Search results - `organizations` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `city` (string,null) **(required)**: - `organizationType` (string,null) **(required)**: - `latitude` (string,null) **(required)**: - `longitude` (string,null) **(required)**: - `hasRequest` (boolean) **(required)**: - `isMember` (boolean) **(required)**: ### 400: Invalid input ### 401: Unauthorized ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/join-search" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List organizations by type `GET https://api-stage.guidelab.co/organization/list-by-type` List all organizations of a given type (lab or clinic). Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/organization/listOrganizationsByType ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `type` (string) (in: query): ## Responses ### 200: List of organizations - `organizations` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `slug` (string,null) **(required)**: - `city` (string,null) **(required)**: - `organizationType` (string,null) **(required)**: ### 400: Invalid type ### 401: Unauthorized ### 403: Forbidden ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/list-by-type" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List current user's memberships `GET https://api-stage.guidelab.co/organization/my-memberships` List all organizations the current user is a member of, including role, type, and logo. Used for org switching. Documentation: https://docs.guidelab.co/api-reference/organization/listMyMemberships ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of memberships - `memberships` (object[]) **(required)**: - `organizationId` (string) **(required)**: - `organizationName` (string) **(required)**: - `organizationType` (string,null) **(required)**: - `slug` (string,null) **(required)**: - `logo` (string,null) **(required)**: - `city` (string,null) **(required)**: - `role` (string) **(required)**: ### 401: Unauthorized ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/my-memberships" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List current user's pending join requests `GET https://api-stage.guidelab.co/organization/my-pending-requests` List all pending join requests submitted by the current user. Used for the org picker page. Documentation: https://docs.guidelab.co/api-reference/organization/listMyPendingRequests ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of pending join requests - `requests` (object[]) **(required)**: - `id` (string) **(required)**: - `orgName` (string) **(required)**: - `orgType` (string,null) **(required)**: - `createdAt` (object): ### 401: Unauthorized ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/my-pending-requests" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Public organization search `GET https://api-stage.guidelab.co/organization/public-search` Search organizations by name and type without authentication. Returns minimal info (id, name, city). Requires at least 2 characters. Used for pre-auth flows. Documentation: https://docs.guidelab.co/api-reference/organization/publicSearchOrganizations ## Parameters - `q` (string) (in: query): - `type` (string) (in: query): ## Responses ### 200: Search results - `organizations` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `city` (string,null) **(required)**: ### 400: Invalid input ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/public-search" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Search organizations `GET https://api-stage.guidelab.co/organization/search` Search organizations by name with fuzzy matching. Can filter to only partnered organizations. Includes pending join request status. Requires user authentication. Documentation: https://docs.guidelab.co/api-reference/organization/searchOrganizations ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `q` (string) (in: query): - `type` (string) (in: query): - `partneredWith` (string) (in: query): - `limit` (string) (in: query): - `includePending` (string) (in: query): ## Responses ### 200: Search results - `organizations` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `city` (string,null) **(required)**: - `slug` (string,null) **(required)**: - `currency` (string) **(required)**: - `hasRequest` (boolean) **(required)**: - `partnershipStatus` (string,null): Values: `active`, `pending`, `null` - `provisioningStatus` (string) **(required)**: Values: `claimed`, `pending_claim`, `managed`, `abandoned` ### 400: Invalid input ### 401: Unauthorized ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/search" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get an organization by ID `GET https://api-stage.guidelab.co/organization/{id}` Retrieve basic organization info. Access is limited to your own organization or partner organizations. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/organization/getOrganization ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Organization - `organization` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `slug` (string,null) **(required)**: - `type` (string,null) **(required)**: - `city` (string,null) **(required)**: ### 401: Unauthorized ### 403: Forbidden ### 404: Organization not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List members of an organization `GET https://api-stage.guidelab.co/organization/{id}/members` Retrieve members of an organization. Accessible to the org itself or active partner organizations. Supports search and role filtering. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/organization/listOrganizationMembers ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `q` (string) (in: query): - `role` (string) (in: query): ## Responses ### 200: List of members - `members` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `email` (string) **(required)**: - `role` (string) **(required)**: ### 401: Unauthorized ### 403: Forbidden ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/{id}/members" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get public profile of an organization `GET https://api-stage.guidelab.co/organization/{id}/profile` Retrieve the public-facing profile of a discoverable organization, including description, cover image, gallery, and product categories (for labs). Requires authentication. Documentation: https://docs.guidelab.co/api-reference/organization/getOrganizationProfile ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Organization profile - `id` (string) **(required)**: - `name` (string) **(required)**: - `organizationType` (string,null) **(required)**: - `logo` (string,null) **(required)**: - `description` (string,null) **(required)**: - `hasCoverImage` (boolean) **(required)**: - `email` (string,null) **(required)**: - `phone` (string,null) **(required)**: - `website` (string,null) **(required)**: - `latitude` (string,null) **(required)**: - `longitude` (string,null) **(required)**: - `gallery` (array) **(required)**: - `categories` (array) **(required)**: ### 401: Unauthorized ### 404: Organization not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/{id}/profile" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get current organization subscription `GET https://api-stage.guidelab.co/organization/subscription` Returns the latest subscription record for the active lab organization. Read-only and available even when billing is past due. Documentation: https://docs.guidelab.co/api-reference/organization/getCurrentOrganizationSubscription ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Latest organization subscription or null - `subscription` (object,null) **(required)**: - `id` (string) **(required)**: - `plan` (string) **(required)**: - `status` (string,null) **(required)**: - `periodStart` (string,null) **(required)**: - `periodEnd` (string,null) **(required)**: - `cancelAtPeriodEnd` (boolean,null) **(required)**: - `seats` (number,null) **(required)**: - `trialStart` (string,null) **(required)**: - `trialEnd` (string,null) **(required)**: - `hasBillingCustomer` (boolean) **(required)**: - `billingInterval` (string,null) **(required)**: - `billingCurrency` (string,null) **(required)**: - `catalogVersion` (string,null) **(required)**: - `storageAddOnUnits` (integer) **(required)**: - `pastDueAt` (string,null) **(required)**: - `pastDueGraceEndsAt` (string,null) **(required)**: - `pendingStorageAddOnUnits` (integer,null) **(required)**: - `pendingStorageAddOnAt` (string,null) **(required)**: - `pendingPlan` (string,null) **(required)**: Values: `base`, `growth`, `scale`, `null` - `pendingPlanBillingInterval` (string,null) **(required)**: Values: `month`, `year`, `null` - `pendingPlanAt` (string,null) **(required)**: - `usage` (object) **(required)**: - `cases` (object) **(required)**: - `windowStart` (string) **(required)**: - `windowEnd` (string) **(required)**: - `used` (integer) **(required)**: - `included` (integer,null) **(required)**: - `alert` (string) **(required)**: Values: `normal`, `warning`, `critical`, `over` - `nonBlocking` (boolean) **(required)**: Values: `true` - `storage` (object) **(required)**: - `usedBytes` (number) **(required)**: - `includedBytes` (number) **(required)**: - `addOnBytes` (number) **(required)**: - `alert` (string) **(required)**: Values: `normal`, `warning`, `critical`, `over` - `nonBlocking` (boolean) **(required)**: Values: `true` ### 401: Unauthorized ### 403: Lab organizations only ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/subscription" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update organization subscription storage add-on `PUT https://api-stage.guidelab.co/organization/subscription/storage-add-on` Applies storage increases immediately with proration and schedules decreases for the next subscription renewal. GuideLab, not the Stripe portal, owns add-on quantity changes. Documentation: https://docs.guidelab.co/api-reference/organization/updateOrganizationSubscriptionStorageAddOn ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `idempotency-key` (string) **(required)** (in: header): Stable key reused only when retrying the exact same command body ## Request Body Content-Type: `application/json` - `units` (integer) **(required)**: ## Responses ### 200: Updated or scheduled storage quantity - `storageAddOnUnits` (integer) **(required)**: - `pendingStorageAddOnUnits` (integer,null) **(required)**: - `pendingStorageAddOnAt` (string,null) **(required)**: - `change` (string) **(required)**: Values: `unchanged`, `immediate_increase`, `scheduled_decrease`, `scheduled_decrease_cancelled` ### 401: Unauthorized ### 403: Lab owners only ### 409: No mutable platform subscription found ### 500: Stripe or catalog configuration unavailable ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/organization/subscription/storage-add-on" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "units": 0 }' ``` --- # Create organization billing portal session `POST https://api-stage.guidelab.co/organization/subscription/billing-portal` Creates a Stripe billing portal session for the active lab organization so owners can update cards and manage subscription billing. Documentation: https://docs.guidelab.co/api-reference/organization/createOrganizationBillingPortalSession ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `returnUrl` (string): [uri] ## Responses ### 200: Billing portal URL - `url` (string) **(required)**: [uri] ### 401: Unauthorized ### 403: Lab owners only ### 404: No billing customer found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/organization/subscription/billing-portal" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "returnUrl": "https://example.com" }' ``` --- # Get the organization's active join code `GET https://api-stage.guidelab.co/organization/join-code` Returns the current active shareable join code for the organization, or null if none exists. Owners and admins only. Documentation: https://docs.guidelab.co/api-reference/organization/getJoinCode ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: The active join code, or null - `joinCode` (object,null) **(required)**: - `code` (string) **(required)**: - `role` (string) **(required)**: Values: `staff`, `admin` - `expiresAt` (string,null) **(required)**: - `maxUses` (integer,null) **(required)**: - `useCount` (integer) **(required)**: - `createdAt` (string) **(required)**: ### 401: Unauthorized ### 403: Forbidden ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/join-code" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Generate or rotate the organization's join code `POST https://api-stage.guidelab.co/organization/join-code` Generates a fresh shareable join code, revoking any previous active code. Owners and admins only. Documentation: https://docs.guidelab.co/api-reference/organization/createJoinCode ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `role` (string): (default: `staff`) Values: `staff`, `admin` - `expiresInDays` (integer,null): - `maxUses` (integer,null): ## Responses ### 201: Join code created - `joinCode` (object) **(required)**: - `code` (string) **(required)**: - `role` (string) **(required)**: Values: `staff`, `admin` - `expiresAt` (string,null) **(required)**: - `maxUses` (integer,null) **(required)**: - `useCount` (integer) **(required)**: - `createdAt` (string) **(required)**: ### 400: Invalid input ### 401: Unauthorized ### 403: Forbidden ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/organization/join-code" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "role": "staff", "expiresInDays": "string", "maxUses": "string" }' ``` --- # Revoke the organization's active join code `DELETE https://api-stage.guidelab.co/organization/join-code` Revokes the current active join code so it can no longer be redeemed. Owners and admins only. Documentation: https://docs.guidelab.co/api-reference/organization/revokeJoinCode ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Join code revoked - `success` (boolean) **(required)**: ### 401: Unauthorized ### 403: Forbidden ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/organization/join-code" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Redeem a join code to join an organization `POST https://api-stage.guidelab.co/organization/join-code/redeem` Redeems a shareable join code and adds the current user as a member of the organization. Returns 404 with error 'invalid_code' for unknown codes so clients can fall back to invitation-id acceptance. Documentation: https://docs.guidelab.co/api-reference/organization/redeemJoinCode ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `code` (string) **(required)**: ## Responses ### 200: Joined (or already a member) - `success` (boolean) **(required)**: - `organizationId` (string) **(required)**: - `organizationType` (string) **(required)**: Values: `lab`, `clinic` - `alreadyMember` (boolean): ### 400: Invalid input ### 401: Unauthorized ### 404: Invalid code ### 409: Code revoked or usage limit reached ### 410: Code expired ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/organization/join-code/redeem" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "code": "string" }' ``` --- # Get organization closure status `GET https://api-stage.guidelab.co/organization/closure` Returns the durable closure receipt for an active or closing organization. A narrow owner-membership check remains available after the organization is fenced. Documentation: https://docs.guidelab.co/api-reference/organization/getOrganizationClosureStatus ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Organization closure status - `organizationId` (string) **(required)**: - `lifecycleStatus` (string) **(required)**: Values: `active`, `closing`, `closed` - `closureRequestedAt` (string,null) **(required)**: - `closureReason` (string,null) **(required)**: - `closedAt` (string,null) **(required)**: - `profileRedactionDueAt` (string,null) **(required)**: - `profileRedactedAt` (string,null) **(required)**: - `job` (object,null) **(required)**: - `status` (string) **(required)**: Values: `pending`, `processing`, `failed`, `completed` - `stage` (string) **(required)**: - `attempts` (number) **(required)**: - `availableAt` (string) **(required)**: - `lastError` (string,null) **(required)**: - `completedAt` (string,null) **(required)**: - `failedAt` (string,null) **(required)**: ### 401: Unauthorized ### 403: Organization owner access required ### 404: Organization not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/closure" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Request organization closure `POST https://api-stage.guidelab.co/organization/closure` Fences the organization immediately and starts its bounded, resumable closure workflow. Replays are idempotent. Documentation: https://docs.guidelab.co/api-reference/organization/requestOrganizationClosure ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `reason` (string) **(required)**: ## Responses ### 202: Closure accepted or already in progress - `status` (string) **(required)**: Values: `requested`, `already_requested` ### 400: Invalid closure reason ### 401: Unauthorized ### 403: Organization owner access required ### 404: Organization not found ### 409: In-flight orders or shipments block closure ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/organization/closure" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "reason": "string" }' ``` --- # List retention holds `GET https://api-stage.guidelab.co/organization/retention-holds` Lists a bounded set of immutable retention-hold evidence placed by the active organization. Documentation: https://docs.guidelab.co/api-reference/organization/listOrganizationRetentionHolds ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `status` (string) (in: query): Values: `live`, `released`, `all` Default: `live` - `limit` (integer) (in: query): Default: `50` ## Responses ### 200: Retention holds - `holds` (object[]) **(required)**: - `id` (string) **(required)**: - `holdingOrganizationId` (string) **(required)**: - `matterKey` (string) **(required)**: - `operation` (string) **(required)**: Values: `all`, `identity_erasure`, `object_retirement`, `organization_closure`, `conversation_deletion` - `reason` (string) **(required)**: - `scope` (object) **(required)**: - `kind` (string) **(required)**: Values: `organization`, `partnership`, `patient`, `order`, `invoice`, `statement`, `file`, `conversation`, `conversation_attachment`, `scan_inbox_item` - `id` (string) **(required)**: - `placedAt` (string) **(required)**: [date-time] - `placedBy` (string) **(required)**: - `releasedAt` (string,null) **(required)**: [date-time] - `releasedBy` (string,null) **(required)**: - `reviewDueAt` (string,null) **(required)**: [date-time] - `platformCustodyAt` (string,null) **(required)**: [date-time] ### 401: Unauthorized ### 403: Organization manager access required ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/organization/retention-holds" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Place a retention hold `POST https://api-stage.guidelab.co/organization/retention-holds` Places immutable, controller-authorized hold evidence. Matter-key replays are idempotent only when the evidence is identical. Documentation: https://docs.guidelab.co/api-reference/organization/placeOrganizationRetentionHold ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `matterKey` (string) **(required)**: - `operation` (string) **(required)**: Values: `all`, `identity_erasure`, `object_retirement`, `organization_closure`, `conversation_deletion` - `reason` (string) **(required)**: - `scope` (object) **(required)**: - `kind` (string) **(required)**: Values: `organization`, `partnership`, `patient`, `order`, `invoice`, `statement`, `file`, `conversation`, `conversation_attachment`, `scan_inbox_item` - `id` (string) **(required)**: - `reviewDueAt` (string,null): [date-time] ## Responses ### 200: Retention hold placed or replayed - `status` (string) **(required)**: Values: `placed`, `already_placed` - `hold` (object) **(required)**: - `id` (string) **(required)**: - `holdingOrganizationId` (string) **(required)**: - `matterKey` (string) **(required)**: - `operation` (string) **(required)**: Values: `all`, `identity_erasure`, `object_retirement`, `organization_closure`, `conversation_deletion` - `reason` (string) **(required)**: - `scope` (object) **(required)**: - `kind` (string) **(required)**: Values: `organization`, `partnership`, `patient`, `order`, `invoice`, `statement`, `file`, `conversation`, `conversation_attachment`, `scan_inbox_item` - `id` (string) **(required)**: - `placedAt` (string) **(required)**: [date-time] - `placedBy` (string) **(required)**: - `releasedAt` (string,null) **(required)**: [date-time] - `releasedBy` (string,null) **(required)**: - `reviewDueAt` (string,null) **(required)**: [date-time] - `platformCustodyAt` (string,null) **(required)**: [date-time] ### 400: Invalid hold evidence or review date ### 401: Unauthorized ### 403: Organization does not control the requested scope ### 409: Matter key is bound to different evidence ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/organization/retention-holds" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "matterKey": "string", "operation": "all", "reason": "string", "scope": { "kind": "organization", "id": "string" }, "reviewDueAt": "string" }' ``` --- # Release a retention hold `POST https://api-stage.guidelab.co/organization/retention-holds/{id}/release` Releases a hold owned by the active organization while preserving its immutable placement and release evidence. Documentation: https://docs.guidelab.co/api-reference/organization/releaseOrganizationRetentionHold ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Retention hold released or already released - `status` (string) **(required)**: Values: `released`, `already_released` ### 401: Unauthorized ### 403: Organization manager access required ### 404: Retention hold not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/organization/retention-holds/{id}/release" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Initialize organization settings defaults `POST https://api-stage.guidelab.co/settings-defaults/initialize` Idempotently applies any unapplied settings-default revision using stable keys. The organization type and revision are read from a locked database row. New organizations run the same initializer during creation; this manager command repairs legacy or partially initialized organizations without recreating defaults intentionally removed after a revision was applied. Documentation: https://docs.guidelab.co/api-reference/organization-settings/initializeOrganizationSettingsDefaults ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Settings defaults initialized - `initialized` (object) **(required)**: - `shadeSystems` (number) **(required)**: - `implantSystems` (number) **(required)**: - `orderFilterPresets` (number) **(required)**: - `reports` (number) **(required)**: - `qcSettings` (number) **(required)**: - `productionSettings` (number) **(required)**: - `receivingCategories` (number) **(required)**: - `receivingSources` (number) **(required)**: - `inventoryCategories` (number) **(required)**: - `inventoryAdjustmentReasons` (number) **(required)**: ### 401: Unauthorized ### 403: Organization owner or admin required ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/settings-defaults/initialize" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List team members `GET https://api-stage.guidelab.co/team/members` Returns all members of the current organization with their name, email, role, and avatar. Documentation: https://docs.guidelab.co/api-reference/team/listTeamMembers ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of team members with user details - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `userId` (string) **(required)**: - `name` (string) **(required)**: - `email` (string) **(required)**: - `image` (string,null) **(required)**: - `role` (string) **(required)**: - `createdAt` (string) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/team/members" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update team member role `PATCH https://api-stage.guidelab.co/team/members/{id}` Changes a team member's non-owner role. Organization owners and admins may update roles; doctor is clinic-only. Ownership moves only through the transfer endpoint. Documentation: https://docs.guidelab.co/api-reference/team/updateTeamMemberRole ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Member ID ## Request Body Content-Type: `application/json` - `role` (string) **(required)**: Values: `admin`, `staff`, `doctor` ## Responses ### 200: Member role updated successfully - `member` (object) **(required)**: - `id` (string) **(required)**: - `userId` (string) **(required)**: - `organizationId` (string) **(required)**: - `role` (string) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request, cannot change owner role, or cannot change own role ### 401: Unauthorized — valid session required ### 403: Forbidden — organization manager required ### 404: Member not found in this organization ### 429: Password reset email budget exceeded ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/team/members/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "role": "admin" }' ``` --- # Remove team member `DELETE https://api-stage.guidelab.co/team/members/{id}` Removes a member from the organization. Organization owners and admins may remove non-owner members, but cannot remove themselves. Documentation: https://docs.guidelab.co/api-reference/team/removeTeamMember ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Member ID ## Responses ### 200: Member removed successfully - `success` (boolean) **(required)**: ### 400: Cannot remove owner or yourself ### 401: Unauthorized — valid session required ### 403: Forbidden — organization manager required ### 404: Member not found in this organization ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/team/members/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Transfer organization ownership `POST https://api-stage.guidelab.co/team/members/{id}/transfer-ownership` Atomically promotes the selected member to owner and demotes the current owner to admin. Only the current owner may transfer ownership. Documentation: https://docs.guidelab.co/api-reference/team/transferOrganizationOwnership ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Member ID ## Responses ### 200: Ownership transferred - `ownerMemberId` (string) **(required)**: - `previousOwnerMemberId` (string) **(required)**: ### 400: Invalid ownership target ### 401: Unauthorized ### 403: Current organization owner required ### 404: Target member not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/team/members/{id}/transfer-ownership" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Send password reset email to team member `POST https://api-stage.guidelab.co/team/members/{id}/send-password-reset` Triggers a password reset email for the specified team member via Better Auth. Organization owners and admins may send password resets. Documentation: https://docs.guidelab.co/api-reference/team/sendPasswordResetEmail ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Member ID ## Responses ### 200: Password reset email sent - `success` (boolean) **(required)**: ### 401: Unauthorized — valid session required ### 403: Forbidden — organization manager required ### 404: Member not found in this organization ## Example ```bash curl -X POST "https://api-stage.guidelab.co/team/members/{id}/send-password-reset" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List pending invitations `GET https://api-stage.guidelab.co/team/invitations` Returns all pending team invitations for the current organization, including the inviter's name and expiration date. Documentation: https://docs.guidelab.co/api-reference/team/listPendingInvitations ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of pending invitations - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `email` (string) **(required)**: - `role` (string) **(required)**: - `status` (string) **(required)**: - `inviterId` (string) **(required)**: - `inviterName` (string) **(required)**: - `expiresAt` (string) **(required)**: - `createdAt` (string) **(required)**: ### 401: Unauthorized — valid session required ### 403: Forbidden — organization manager required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/team/invitations" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create and send team invitation `POST https://api-stage.guidelab.co/team/invitations` Sends an invitation for an assignable organization role. Owners and admins may invite; doctor is clinic-only. Documentation: https://docs.guidelab.co/api-reference/team/createTeamInvitation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `email` (string) **(required)**: [email] - `role` (string) **(required)**: Values: `admin`, `staff`, `doctor` ## Responses ### 201: Invitation created and email sent - `success` (boolean) **(required)**: - `invitation` (object): ### 400: Invalid request, user already a member, or pending invitation exists ### 401: Unauthorized — valid session required ### 403: Forbidden — organization manager required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/team/invitations" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "email": "string", "role": "admin" }' ``` --- # Cancel a pending invitation `POST https://api-stage.guidelab.co/team/invitations/{id}/cancel` Cancels a pending invitation so the recipient can no longer accept it. Organization owners and admins may cancel pending invitations. Documentation: https://docs.guidelab.co/api-reference/team/cancelTeamInvitation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Invitation ID ## Responses ### 200: Invitation canceled - `success` (boolean) **(required)**: ### 400: Invitation is not in pending status ### 401: Unauthorized — valid session required ### 403: Forbidden — organization manager required ### 404: Invitation not found in this organization ## Example ```bash curl -X POST "https://api-stage.guidelab.co/team/invitations/{id}/cancel" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Resend a pending invitation `POST https://api-stage.guidelab.co/team/invitations/{id}/resend` Re-sends a pending invitation. Organization owners and admins may resend invitations whose role is still assignable to the organization. Documentation: https://docs.guidelab.co/api-reference/team/resendTeamInvitation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Invitation ID ## Responses ### 200: Invitation email resent - `success` (boolean) **(required)**: - `invitation` (object): ### 400: Invitation is not in pending status ### 401: Unauthorized — valid session required ### 403: Forbidden — organization manager required ### 404: Invitation not found in this organization ### 409: Invitation role is no longer assignable ### 429: Invitation email budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/team/invitations/{id}/resend" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update current user phone number `PUT https://api-stage.guidelab.co/user/phone` Updates the authenticated user's phone number. Validates and stores in E.164 format. Pass an empty string to remove. Documentation: https://docs.guidelab.co/api-reference/users/updateUserPhone ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `phoneNumber` (string) **(required)**: ## Responses ### 200: Phone number updated successfully - `success` (boolean) **(required)**: ### 400: Invalid phone number format ### 401: Unauthorized — valid session required ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/user/phone" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "phoneNumber": "string" }' ``` --- # Update current user language preference `PUT https://api-stage.guidelab.co/user/language` Sets the authenticated user's preferred UI language. Supported: en, es, it, zh. Documentation: https://docs.guidelab.co/api-reference/users/updateUserLanguage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `language` (string) **(required)**: Values: `en`, `es`, `it`, `zh` ## Responses ### 200: Language preference updated - `success` (boolean) **(required)**: ### 400: Invalid language code ### 401: Unauthorized — valid session required ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/user/language" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "language": "en" }' ``` --- # Serve a user avatar `GET https://api-stage.guidelab.co/user/avatar` Serve a user's avatar image from R2 storage. Defaults to the authenticated user. Accessible by self, members of shared organizations, and users in partnership-linked organizations. Documentation: https://docs.guidelab.co/api-reference/users/getUserAvatar ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `userId` (string) (in: query): ## Responses ### 200: Avatar image binary ### 403: Not allowed to view this avatar ### 404: User or avatar not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/user/avatar" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload current user avatar `POST https://api-stage.guidelab.co/user/avatar` Upload a new avatar image for the authenticated user. Replaces any existing avatar. Accepts JPEG, PNG, WebP, or GIF up to 5MB. Documentation: https://docs.guidelab.co/api-reference/users/uploadUserAvatar ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Avatar uploaded successfully - `image` (string) **(required)**: ### 400: Invalid file type or file too large ### 401: Unauthorized — valid session required ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/user/avatar" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Remove current user avatar `DELETE https://api-stage.guidelab.co/user/avatar` Remove the authenticated user's avatar from storage and clear the image reference on the user record. Documentation: https://docs.guidelab.co/api-reference/users/deleteUserAvatar ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Avatar removed successfully - `success` (boolean) **(required)**: ### 400: No avatar to delete ### 401: Unauthorized — valid session required ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/user/avatar" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get notification preferences `GET https://api-stage.guidelab.co/user/notification-preferences` Returns the authenticated user's notification channel preferences for orders, partnerships, and chat. Returns defaults if no custom preferences have been set. Documentation: https://docs.guidelab.co/api-reference/users/getUserNotificationPreferences ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Notification preferences object - `preferences` (object) **(required)**: - `orders` (object): - `partnerships` (object): - `chat` (object): - `finance` (object): - `team` (object): - `inventory` (object): ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/user/notification-preferences" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update notification preferences `PUT https://api-stage.guidelab.co/user/notification-preferences` Sets the authenticated user's notification channel preferences for orders (including per-event overrides), partnerships, and chat. Supports email, SMS, WhatsApp, and push channels. Documentation: https://docs.guidelab.co/api-reference/users/updateUserNotificationPreferences ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `preferences` (object) **(required)**: - `orders` (object) **(required)**: - `email` (boolean) **(required)**: - `sms` (boolean) **(required)**: - `whatsapp` (boolean) **(required)**: - `push` (boolean) **(required)**: - `events` (object): - `order.status_changed` (object): - `email` (boolean) **(required)**: - `sms` (boolean) **(required)**: - `whatsapp` (boolean) **(required)**: - `push` (boolean) **(required)**: - `order.assigned` (object): - `email` (boolean) **(required)**: - `sms` (boolean) **(required)**: - `whatsapp` (boolean) **(required)**: - `push` (boolean) **(required)**: - `order.task_assigned` (object): - `email` (boolean) **(required)**: - `sms` (boolean) **(required)**: - `whatsapp` (boolean) **(required)**: - `push` (boolean) **(required)**: - `order.phase_advance_requested` (object): - `email` (boolean) **(required)**: - `sms` (boolean) **(required)**: - `whatsapp` (boolean) **(required)**: - `push` (boolean) **(required)**: - `order.files_reminder` (object): - `email` (boolean) **(required)**: - `sms` (boolean) **(required)**: - `whatsapp` (boolean) **(required)**: - `push` (boolean) **(required)**: - `partnerships` (object) **(required)**: - `email` (boolean) **(required)**: - `sms` (boolean) **(required)**: - `whatsapp` (boolean) **(required)**: - `push` (boolean) **(required)**: - `chat` (object) **(required)**: - `email` (boolean) **(required)**: - `sms` (boolean) **(required)**: - `whatsapp` (boolean) **(required)**: - `push` (boolean) **(required)**: - `finance` (object) **(required)**: - `email` (boolean) **(required)**: - `sms` (boolean) **(required)**: - `whatsapp` (boolean) **(required)**: - `push` (boolean) **(required)**: - `team` (object) **(required)**: - `email` (boolean) **(required)**: - `sms` (boolean) **(required)**: - `whatsapp` (boolean) **(required)**: - `push` (boolean) **(required)**: - `inventory` (object): - `email` (boolean) **(required)**: - `sms` (boolean) **(required)**: - `whatsapp` (boolean) **(required)**: - `push` (boolean) **(required)**: ## Responses ### 200: Preferences saved successfully - `success` (boolean) **(required)**: ### 400: Invalid preferences structure ### 401: Unauthorized — valid session required ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/user/notification-preferences" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "preferences": { "orders": { "email": true, "sms": true, "whatsapp": true, "push": true, "events": { "order.status_changed": { "email": true, "sms": true, "whatsapp": true, "push": true }, "order.assigned": { "email": true, "sms": true, "whatsapp": true, "push": true }, "order.task_assigned": { "email": true, "sms": true, "whatsapp": true, "push": true }, "order.phase_advance_requested": { "email": true, "sms": true, "whatsapp": true, "push": true }, "order.files_reminder": { "email": true, "sms": true, "whatsapp": true, "push": true } } }, "partnerships": { "email": true, "sms": true, "whatsapp": true, "push": true }, "chat": { "email": true, "sms": true, "whatsapp": true, "push": true }, "finance": { "email": true, "sms": true, "whatsapp": true, "push": true }, "team": { "email": true, "sms": true, "whatsapp": true, "push": true }, "inventory": { "email": true, "sms": true, "whatsapp": true, "push": true } } }' ``` --- # List all users `GET https://api-stage.guidelab.co/admin/users` Retrieve a paginated list of all platform users with their organization memberships. Platform admin access required. Supports search by email and role filtering. Documentation: https://docs.guidelab.co/api-reference/admin/adminListUsers ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `limit` (string) (in: query): - `offset` (string) (in: query): - `search` (string) (in: query): - `role` (string) (in: query): - `sortDirection` (string) (in: query): ## Responses ### 200: Paginated list of users with organization memberships - `users` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `email` (string) **(required)**: - `image` (string,null) **(required)**: - `role` (string) **(required)**: - `banned` (boolean,null) **(required)**: - `createdAt` (object): - `organizations` (array) **(required)**: - `total` (number) **(required)**: ### 401: Unauthorized ### 403: Forbidden - platform admin only ## Example ```bash curl -X GET "https://api-stage.guidelab.co/admin/users" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get user by ID `GET https://api-stage.guidelab.co/admin/users/{id}` Retrieve a single user's full details including all organization memberships. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminGetUser ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: User details with memberships - `user` (object): - `memberships` (array) **(required)**: ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: User not found ### 409: Organization ownership must be transferred first ## Example ```bash curl -X GET "https://api-stage.guidelab.co/admin/users/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Send password reset email for a user `POST https://api-stage.guidelab.co/admin/users/{id}/send-password-reset` Trigger a password reset email for a specific user via Better Auth's forget-password flow. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminSendPasswordReset ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Password reset email sent - `success` (boolean) **(required)**: ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: User not found ### 409: Organization ownership must be transferred first ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/users/{id}/send-password-reset" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Anonymize (GDPR-erase) a user `POST https://api-stage.guidelab.co/admin/users/{id}/anonymize` Scrub a user's PII and revoke all access while retaining their records — orders, invoices, files, and messages reference the user and cannot be deleted. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminAnonymizeUser ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: User anonymized - `success` (boolean) **(required)**: ### 400: Invalid request ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: User not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/users/{id}/anonymize" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List all organizations `GET https://api-stage.guidelab.co/admin/organizations` Retrieve a paginated list of all organizations with member counts. Platform admin access required. Supports search and type filtering. Documentation: https://docs.guidelab.co/api-reference/admin/adminListOrganizations ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (string) (in: query): - `limit` (string) (in: query): - `search` (string) (in: query): - `type` (string) (in: query): ## Responses ### 200: Paginated list of organizations with member counts - `organizations` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 401: Unauthorized ### 403: Forbidden - platform admin only ## Example ```bash curl -X GET "https://api-stage.guidelab.co/admin/organizations" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get organization by ID `GET https://api-stage.guidelab.co/admin/organizations/{id}` Retrieve a single organization's full details including all members and subscription info. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminGetOrganization ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Organization details with members and subscription - `organization` (object): - `members` (array) **(required)**: - `subscription` (object,null) **(required)**: - `id` (string) **(required)**: - `plan` (string) **(required)**: - `status` (string,null) **(required)**: - `periodStart` (string,null) **(required)**: - `periodEnd` (string,null) **(required)**: - `cancelAtPeriodEnd` (boolean,null) **(required)**: - `seats` (number,null) **(required)**: - `trialStart` (string,null) **(required)**: - `trialEnd` (string,null) **(required)**: - `hasBillingCustomer` (boolean) **(required)**: ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Organization not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/admin/organizations/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update an organization `PUT https://api-stage.guidelab.co/admin/organizations/{id}` Update organization fields (name, slug, type, contact info, etc.). Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminUpdateOrganization ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `name` (string): - `slug` (string): - `city` (string,null): - `email` (string,null): [email] - `phone` (string,null): - `address` (string,null): - `addressLine2` (string,null): - `postcode` (string,null): - `country` (string): - `state` (string,null): - `website` (string,null): [uri] - `companyNumber` (object): - `taxRegistrationNumber` (string,null): - `billingEmail` (string,null): [email] ## Responses ### 200: Updated organization - `organization` (object): ### 400: No valid fields to update ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Organization not found ### 409: Organization identity conflict ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/admin/organizations/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Create organization subscription checkout session `POST https://api-stage.guidelab.co/admin/organizations/{id}/subscription/checkout` Create a Stripe Checkout session for a lab organization's subscription. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminCreateOrganizationSubscriptionCheckout ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `plan` (string) **(required)**: Values: `base`, `growth`, `scale` - `annual` (boolean): - `returnUrl` (string): [uri] ## Responses ### 200: Checkout session URL - `url` (string) **(required)**: [uri] ### 400: Invalid request or unsupported organization ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Organization not found ### 409: Checkout is already in progress or completed ### 502: Stripe returned an invalid response ### 503: Stripe Checkout is temporarily unavailable ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/organizations/{id}/subscription/checkout" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "plan": "base", "annual": true, "returnUrl": "https://example.com" }' ``` --- # Create organization billing portal session `POST https://api-stage.guidelab.co/admin/organizations/{id}/subscription/billing-portal` Create a Stripe billing portal session for a lab organization's subscription. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminCreateOrganizationBillingPortal ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `returnUrl` (string): [uri] ## Responses ### 200: Billing portal URL - `url` (string) **(required)**: [uri] ### 400: Invalid request or unsupported organization ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Organization or billing customer not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/organizations/{id}/subscription/billing-portal" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "returnUrl": "https://example.com" }' ``` --- # Audit Stripe subscriptions GuideLab does not track `GET https://api-stage.guidelab.co/admin/organizations/{id}/subscription/provider-audit` Reports live Stripe subscriptions for a lab organization's customer that have no local subscription row. Bounded to one indexed customer lookup and one subscription page. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminAuditOrganizationProviderSubscriptions ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Untracked provider subscriptions - `stripeCustomerId` (string,null) **(required)**: - `truncated` (boolean) **(required)**: - `untracked` (object[]) **(required)**: - `stripeSubscriptionId` (string) **(required)**: - `status` (string) **(required)**: - `plan` (string,null) **(required)**: - `billingInterval` (string,null) **(required)**: - `billingCurrency` (string,null) **(required)**: - `trialEnd` (string,null) **(required)**: - `currentPeriodEnd` (string,null) **(required)**: - `adoptable` (boolean) **(required)**: ### 400: Unsupported organization ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Organization not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/admin/organizations/{id}/subscription/provider-audit" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Adopt an untracked Stripe subscription `POST https://api-stage.guidelab.co/admin/organizations/{id}/subscription/provider-audit/adopt` Publishes an untracked Stripe subscription as the lab organization's local subscription row so the duplicate-billing guards can see it. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminAdoptUntrackedProviderSubscription ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `stripeSubscriptionId` (string) **(required)**: ## Responses ### 200: Adopted subscription - `subscriptionId` (string) **(required)**: ### 400: Unsupported organization ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Organization or untracked subscription not found ### 409: The subscription cannot be modelled by GuideLab ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/organizations/{id}/subscription/provider-audit/adopt" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "stripeSubscriptionId": "string" }' ``` --- # List duplicate subscription compensations `GET https://api-stage.guidelab.co/admin/subscription-quarantines` List recent unexpected Stripe Checkout completions and their cancellation/refund state. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminListSubscriptionQuarantines ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Subscription quarantine records - `quarantines` (object[]) **(required)**: - `eventId` (string) **(required)**: - `organizationId` (string) **(required)**: - `stripeCheckoutSessionId` (string) **(required)**: - `stripeSubscriptionId` (string) **(required)**: - `stripeInvoiceId` (string,null) **(required)**: - `status` (string) **(required)**: Values: `pending`, `refunded`, `no_payment`, `needs_review` - `refundIds` (string[]) **(required)**: - `errorCode` (string,null) **(required)**: - `notifiedAt` (string,null) **(required)**: [date-time] - `resolvedAt` (string,null) **(required)**: [date-time] - `createdAt` (string) **(required)**: [date-time] - `updatedAt` (string) **(required)**: [date-time] ### 401: Unauthorized ### 403: Forbidden - platform admin only ## Example ```bash curl -X GET "https://api-stage.guidelab.co/admin/subscription-quarantines" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Retry duplicate subscription compensation `POST https://api-stage.guidelab.co/admin/subscription-quarantines/{eventId}/retry` Retry the idempotent cancellation/refund workflow for an unexpected Stripe Checkout completion. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminRetrySubscriptionQuarantine ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `eventId` (string) **(required)** (in: path): ## Responses ### 200: Updated subscription quarantine - `quarantine` (object) **(required)**: - `eventId` (string) **(required)**: - `organizationId` (string) **(required)**: - `stripeCheckoutSessionId` (string) **(required)**: - `stripeSubscriptionId` (string) **(required)**: - `stripeInvoiceId` (string,null) **(required)**: - `status` (string) **(required)**: Values: `pending`, `refunded`, `no_payment`, `needs_review` - `refundIds` (string[]) **(required)**: - `errorCode` (string,null) **(required)**: - `notifiedAt` (string,null) **(required)**: [date-time] - `resolvedAt` (string,null) **(required)**: [date-time] - `createdAt` (string) **(required)**: [date-time] - `updatedAt` (string) **(required)**: [date-time] ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Quarantine record not found ### 503: Stripe compensation is temporarily unavailable ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/subscription-quarantines/{eventId}/retry" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Remove a member from an organization `DELETE https://api-stage.guidelab.co/admin/organizations/{id}/members/{memberId}` Remove a member from an organization by member ID. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminRemoveOrganizationMember ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `memberId` (string) **(required)** (in: path): ## Responses ### 200: Member removed successfully - `success` (boolean) **(required)**: ### 400: Missing required IDs ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Member not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/admin/organizations/{id}/members/{memberId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Set admin viewing organization `POST https://api-stage.guidelab.co/admin/set-viewing-org` Set a cookie to impersonate/view a specific organization's data. Used by platform admins to inspect organization dashboards. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminSetViewingOrg ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `organizationId` (string) **(required)**: ## Responses ### 200: Viewing organization cookie set - `success` (boolean) **(required)**: - `organizationType` (string,null) **(required)**: ### 400: organizationId is required ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Organization not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/set-viewing-org" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "organizationId": "string" }' ``` --- # Clear admin viewing organization `DELETE https://api-stage.guidelab.co/admin/set-viewing-org` Remove the admin viewing organization cookie, returning to the admin's own context. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminClearViewingOrg ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Viewing organization cookie cleared - `success` (boolean) **(required)**: ### 401: Unauthorized ### 403: Forbidden - platform admin only ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/admin/set-viewing-org" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Preview a notification template `POST https://api-stage.guidelab.co/admin/notifications/preview` Preview how a notification will render across channels (email, SMS, WhatsApp). Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminPreviewNotification ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `eventType` (string) **(required)**: Values: `order.status_changed`, `order.assigned`, `order.task_assigned`, `order.message_added`, `order.phase_advance_requested`, `order.created`, `order.due_soon`, `order.overdue`, `order.files_reminder`, `order.hold_created`, `order.hold_file_submitted`, `order.hold_requirement_approved`, `order.hold_requirement_rejected`, `order.hold_resolved`, `order.surgical_report_sent`, `order.surgical_report_approved`, `order.surgical_report_changes_requested`, `partnership.requested`, `partnership.accepted`, `partnership.rejected`, `partnership.suspended`, `partnership.reactivated`, `partnership.terminated`, `invoice.sent`, `payment.received`, `payment.failed`, `payment.reconciliation_required`, `finance.late_fee_currency_unconfigured`, `org.join_request`, `org.join_request_approved`, `org.join_request_rejected`, `org.member_joined_via_code`, `inventory.low_stock` - `channel` (string) **(required)**: Values: `email`, `sms`, `whatsapp` - `data` (object) **(required)**: - `title` (string) **(required)**: - `body` (string) **(required)**: - `entityUrl` (string): - `orderId` (string): - `orderNumber` (string): ## Responses ### 200: Rendered notification preview - `subject` (string): - `html` (string): - `text` (string): - `charCount` (integer): ### 400: Invalid request body ### 401: Unauthorized ### 403: Forbidden - platform admin only ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/notifications/preview" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "eventType": "order.status_changed", "channel": "email", "data": { "title": "string", "body": "string", "entityUrl": "string", "orderId": "string", "orderNumber": "string" } }' ``` --- # Send a test notification `POST https://api-stage.guidelab.co/admin/notifications/test` Send a test notification through the selected delivery channel. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminTestNotification ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `eventType` (string) **(required)**: Values: `order.status_changed`, `order.assigned`, `order.task_assigned`, `order.message_added`, `order.phase_advance_requested`, `order.created`, `order.due_soon`, `order.overdue`, `order.files_reminder`, `order.hold_created`, `order.hold_file_submitted`, `order.hold_requirement_approved`, `order.hold_requirement_rejected`, `order.hold_resolved`, `order.surgical_report_sent`, `order.surgical_report_approved`, `order.surgical_report_changes_requested`, `partnership.requested`, `partnership.accepted`, `partnership.rejected`, `partnership.suspended`, `partnership.reactivated`, `partnership.terminated`, `invoice.sent`, `payment.received`, `payment.failed`, `payment.reconciliation_required`, `finance.late_fee_currency_unconfigured`, `org.join_request`, `org.join_request_approved`, `org.join_request_rejected`, `org.member_joined_via_code`, `inventory.low_stock` - `channel` (string) **(required)**: Values: `email`, `sms`, `whatsapp` - `data` (object) **(required)**: - `title` (string) **(required)**: - `body` (string) **(required)**: - `entityUrl` (string): - `orderId` (string): - `orderNumber` (string): - `recipient` (string) **(required)**: ## Responses ### 200: Notification accepted for delivery - `success` (boolean) **(required)**: ### 400: Invalid request body ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 429: Paid test-notification rate limit exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/notifications/test" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "eventType": "order.status_changed", "channel": "email", "data": { "title": "string", "body": "string", "entityUrl": "string", "orderId": "string", "orderNumber": "string" }, "recipient": "string" }' ``` --- # Requeue a failed organization closure `POST https://api-stage.guidelab.co/admin/privacy/organization-closures/{organizationId}/requeue` Resets only a terminal failed closure job and writes an attributable intervention receipt. Replays against active or completed jobs are read-only. Documentation: https://docs.guidelab.co/api-reference/admin/adminRequeueOrganizationClosure ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `organizationId` (string) **(required)** (in: path): ## Responses ### 200: Closure requeue result - `status` (string) **(required)**: Values: `requeued`, `already_active`, `completed` ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Closure job not found ### 409: Organization is no longer closing ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/privacy/organization-closures/{organizationId}/requeue" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Requeue a failed patient erasure `POST https://api-stage.guidelab.co/admin/privacy/patient-erasures/{patientId}/requeue` Resets only a terminal failed patient-erasure job and writes an attributable intervention receipt. Replays against active or completed jobs are read-only. Documentation: https://docs.guidelab.co/api-reference/admin/adminRequeuePatientErasure ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `patientId` (string) **(required)** (in: path): ## Responses ### 200: Patient-erasure requeue result - `status` (string) **(required)**: Values: `requeued`, `already_active`, `completed` ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Patient-erasure job not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/privacy/patient-erasures/{patientId}/requeue" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List platform-custody retention holds `GET https://api-stage.guidelab.co/admin/retention-holds` Lists a bounded set of holds transferred to platform legal custody during organization closure. Documentation: https://docs.guidelab.co/api-reference/admin/adminListPlatformCustodyRetentionHolds ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `status` (string) (in: query): Values: `live`, `released`, `all` Default: `live` - `limit` (integer) (in: query): Default: `50` - `holdingOrganizationId` (string) (in: query): ## Responses ### 200: Platform-custody retention holds - `holds` (object[]) **(required)**: - `id` (string) **(required)**: - `holdingOrganizationId` (string) **(required)**: - `matterKey` (string) **(required)**: - `operation` (string) **(required)**: Values: `all`, `identity_erasure`, `object_retirement`, `organization_closure`, `conversation_deletion` - `reason` (string) **(required)**: - `scope` (object) **(required)**: - `kind` (string) **(required)**: Values: `organization`, `partnership`, `patient`, `order`, `invoice`, `statement`, `file`, `conversation`, `conversation_attachment`, `scan_inbox_item` - `id` (string) **(required)**: - `placedAt` (string) **(required)**: [date-time] - `placedBy` (string) **(required)**: - `releasedAt` (string,null) **(required)**: [date-time] - `releasedBy` (string,null) **(required)**: - `reviewDueAt` (string,null) **(required)**: [date-time] - `platformCustodyAt` (string,null) **(required)**: [date-time] ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/admin/retention-holds" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Release a platform-custody retention hold `POST https://api-stage.guidelab.co/admin/retention-holds/{id}/release` Releases a hold after its original organization has closed, preserving the original holder and evidence. Documentation: https://docs.guidelab.co/api-reference/admin/adminReleasePlatformCustodyRetentionHold ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Retention hold released or already released - `status` (string) **(required)**: Values: `released`, `already_released` ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Retention hold not found ### 409: Retention hold is not in platform legal custody ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/retention-holds/{id}/release" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Authorize whole-conversation deletion as platform legal `POST https://api-stage.guidelab.co/admin/conversations/{id}/deletion-override` Authorizes permanent placeholder conversion without participant approvals. Platform admin access and immutable database evidence are required. Documentation: https://docs.guidelab.co/api-reference/admin/adminOverrideConversationDeletion ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 202: Deletion authorized or already authorized - `data` (object) **(required)**: - `conversationId` (string) **(required)**: - `status` (string) **(required)**: Values: `pending`, `authorized`, `completed` - `authorizationKind` (string,null) **(required)**: - `requestedAt` (string) **(required)**: - `authorizedAt` (string,null) **(required)**: - `completedAt` (string,null) **(required)**: - `approvedOrganizationIds` (string[]) **(required)**: ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Conversation not found ### 409: A correlated notification delivery is in flight ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/conversations/{id}/deletion-override" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List platform billing commands requiring or retaining review `GET https://api-stage.guidelab.co/admin/platform-billing-command-reviews` Lists the bounded platform billing review queue and its immutable normalized resolution evidence. Platform admin access required. Documentation: https://docs.guidelab.co/api-reference/admin/adminListPlatformBillingCommandReviews ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `state` (string) (in: query): Values: `unresolved`, `resolved`, `all` Default: `unresolved` - `kind` (string) (in: query): Values: `plan_change`, `storage_add_on` - `cursor` (string) (in: query): - `limit` (integer) (in: query): Default: `50` ## Responses ### 200: Platform billing review queue - `items` (object[]) **(required)**: - `commandId` (string) **(required)**: - `organizationId` (string) **(required)**: - `subscriptionId` (string) **(required)**: - `kind` (string) **(required)**: Values: `plan_change`, `storage_add_on` - `status` (string) **(required)**: - `errorCode` (string,null) **(required)**: - `reviewRequiredAt` (string) **(required)**: [date-time] - `createdAt` (string) **(required)**: [date-time] - `recoveryAttempts` (integer) **(required)**: - `targetPlan` (string,null) **(required)**: Values: `base`, `growth`, `scale`, `null` - `targetBillingInterval` (string,null) **(required)**: Values: `month`, `year`, `null` - `application` (string,null) **(required)**: Values: `immediate`, `scheduled`, `null` - `targetUnits` (integer,null) **(required)**: - `baseUnits` (integer,null) **(required)**: - `billingInterval` (string,null) **(required)**: Values: `month`, `year`, `null` - `change` (string,null) **(required)**: - `resolution` (object,null) **(required)**: - `outcome` (string) **(required)**: Values: `confirmed_provider_target`, `accepted_current_provider_state` - `resultStatus` (string) **(required)**: Values: `completed`, `scheduled`, `failed` - `reviewerUserId` (string) **(required)**: - `reason` (string) **(required)**: - `reviewRequiredAt` (string) **(required)**: [date-time] - `reviewedAt` (string) **(required)**: [date-time] - `sourceErrorCode` (string) **(required)**: - `providerReadAt` (string) **(required)**: [date-time] - `providerSubscriptionStatus` (string) **(required)**: - `providerScheduleId` (string,null) **(required)**: - `activePlan` (string) **(required)**: Values: `base`, `growth`, `scale` - `activeBillingInterval` (string) **(required)**: Values: `month`, `year` - `activeStorageUnits` (integer) **(required)**: - `scheduledPlan` (string,null) **(required)**: Values: `base`, `growth`, `scale`, `null` - `scheduledBillingInterval` (string,null) **(required)**: Values: `month`, `year`, `null` - `scheduledStorageUnits` (integer) **(required)**: - `scheduledAt` (string,null) **(required)**: [date-time] - `nextCursor` (string,null) **(required)**: ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/admin/platform-billing-command-reviews" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Resolve one ambiguous platform billing command `POST https://api-stage.guidelab.co/admin/platform-billing-command-reviews/{commandId}/resolve` Performs at most one Stripe subscription read and one optional schedule read, never writes to Stripe, and closes the command with immutable normalized evidence. Documentation: https://docs.guidelab.co/api-reference/admin/adminResolvePlatformBillingCommandReview ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `commandId` (string) **(required)** (in: path): - `idempotency-key` (string) **(required)** (in: header): Stable key reused only when retrying the exact same command body ## Request Body Content-Type: `application/json` - `outcome` (string) **(required)**: Values: `confirmed_provider_target`, `accepted_current_provider_state` - `reason` (string) **(required)**: ## Responses ### 200: Review resolved or exact resolution replayed - `data` (object) **(required)**: - `commandId` (string) **(required)**: - `organizationId` (string) **(required)**: - `subscriptionId` (string) **(required)**: - `kind` (string) **(required)**: Values: `plan_change`, `storage_add_on` - `status` (string) **(required)**: - `errorCode` (string,null) **(required)**: - `reviewRequiredAt` (string) **(required)**: [date-time] - `createdAt` (string) **(required)**: [date-time] - `recoveryAttempts` (integer) **(required)**: - `targetPlan` (string,null) **(required)**: Values: `base`, `growth`, `scale`, `null` - `targetBillingInterval` (string,null) **(required)**: Values: `month`, `year`, `null` - `application` (string,null) **(required)**: Values: `immediate`, `scheduled`, `null` - `targetUnits` (integer,null) **(required)**: - `baseUnits` (integer,null) **(required)**: - `billingInterval` (string,null) **(required)**: Values: `month`, `year`, `null` - `change` (string,null) **(required)**: - `resolution` (object,null) **(required)**: - `outcome` (string) **(required)**: Values: `confirmed_provider_target`, `accepted_current_provider_state` - `resultStatus` (string) **(required)**: Values: `completed`, `scheduled`, `failed` - `reviewerUserId` (string) **(required)**: - `reason` (string) **(required)**: - `reviewRequiredAt` (string) **(required)**: [date-time] - `reviewedAt` (string) **(required)**: [date-time] - `sourceErrorCode` (string) **(required)**: - `providerReadAt` (string) **(required)**: [date-time] - `providerSubscriptionStatus` (string) **(required)**: - `providerScheduleId` (string,null) **(required)**: - `activePlan` (string) **(required)**: Values: `base`, `growth`, `scale` - `activeBillingInterval` (string) **(required)**: Values: `month`, `year` - `activeStorageUnits` (integer) **(required)**: - `scheduledPlan` (string,null) **(required)**: Values: `base`, `growth`, `scale`, `null` - `scheduledBillingInterval` (string,null) **(required)**: Values: `month`, `year`, `null` - `scheduledStorageUnits` (integer) **(required)**: - `scheduledAt` (string,null) **(required)**: [date-time] - `replayed` (boolean) **(required)**: ### 400: Invalid review request or idempotency header ### 401: Unauthorized ### 403: Forbidden - platform admin only ### 404: Billing review not found ### 409: Review is in progress, already resolved, idempotency-conflicted, or provider state does not satisfy the chosen outcome ### 429: Per-command provider-read budget or backoff reached ### 500: Stripe catalog configuration unavailable ### 503: Provider state could not be read ## Example ```bash curl -X POST "https://api-stage.guidelab.co/admin/platform-billing-command-reviews/{commandId}/resolve" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "outcome": "confirmed_provider_target", "reason": "string" }' ``` --- # List conversations `GET https://api-stage.guidelab.co/conversations` Retrieve paginated conversations for the current organization. Supports filtering by all/unread/waiting/responded and text search across partner names and message previews. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/conversations/listConversations ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `filter` (string) (in: query): Values: `all`, `unread`, `waiting`, `responded` - `search` (string) (in: query): - `limit` (string) (in: query): - `offset` (string) (in: query): ## Responses ### 200: Paginated list of conversations with unread counts - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `partnershipId` (string) **(required)**: - `orderId` (string,null) **(required)**: - `title` (string,null) **(required)**: - `lastMessageId` (string,null) **(required)**: - `lastMessageAt` (string,null) **(required)**: - `lastMessagePreview` (string,null) **(required)**: - `lastMessageSenderId` (string,null) **(required)**: - `unreadCounts` (object,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `partner` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `nameMissing` (boolean) **(required)**: - `logo` (string,null) **(required)**: - `order` (object,null) **(required)**: - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: - `status` (string) **(required)**: - `patientId` (string,null) **(required)**: - `hidePatientFromLab` (boolean) **(required)**: - `patient` (object,null) **(required)**: - `id` (string) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `patientCode` (string,null) **(required)**: - `lastMessageSender` (object,null) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `image` (string,null) **(required)**: - `totalUnread` (number) **(required)**: - `pagination` (object) **(required)**: - `total` (number) **(required)**: - `limit` (number) **(required)**: - `offset` (number) **(required)**: - `hasMore` (boolean) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/conversations" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a conversation `POST https://api-stage.guidelab.co/conversations` Create a new conversation within a partnership. Optionally link it to an order and include an initial message. If a conversation already exists for the same partnership+order, returns the existing one. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/conversations/createConversation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `partnershipId` (string) **(required)**: - `orderId` (string): - `title` (string): - `initialMessage` (string): - `initialMessageId` (string): [uuid] ## Responses ### 200: Existing conversation returned - `data` (object) **(required)**: - `id` (string) **(required)**: - `partnershipId` (string) **(required)**: - `orderId` (string,null) **(required)**: - `title` (string,null) **(required)**: - `lastMessageId` (string,null) **(required)**: - `lastMessageAt` (string,null) **(required)**: - `lastMessagePreview` (string,null) **(required)**: - `lastMessageSenderId` (string,null) **(required)**: - `unreadCounts` (object,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `existing` (boolean) **(required)**: ### 201: Conversation created - `data` (object) **(required)**: - `id` (string) **(required)**: - `partnershipId` (string) **(required)**: - `orderId` (string,null) **(required)**: - `title` (string,null) **(required)**: - `lastMessageId` (string,null) **(required)**: - `lastMessageAt` (string,null) **(required)**: - `lastMessagePreview` (string,null) **(required)**: - `lastMessageSenderId` (string,null) **(required)**: - `unreadCounts` (object,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `existing` (boolean) **(required)**: ### 400: Invalid request body ### 401: Unauthorized ### 403: Not authorized for this partnership ### 404: Partnership not found ### 409: Conversation or initial-message idempotency conflict ## Example ```bash curl -X POST "https://api-stage.guidelab.co/conversations" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "partnershipId": "string", "orderId": "string", "title": "string", "initialMessage": "string", "initialMessageId": "string" }' ``` --- # Get conversation by ID `GET https://api-stage.guidelab.co/conversations/{id}` Retrieve a single conversation with its partner organization, linked order, and last message sender details. Only accessible by organizations that are part of the conversation's partnership. Documentation: https://docs.guidelab.co/api-reference/conversations/getConversation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Conversation details with partner and order info - `data` (object) **(required)**: - `id` (string) **(required)**: - `partnershipId` (string) **(required)**: - `orderId` (string,null) **(required)**: - `title` (string,null) **(required)**: - `lastMessageId` (string,null) **(required)**: - `lastMessageAt` (string,null) **(required)**: - `lastMessagePreview` (string,null) **(required)**: - `lastMessageSenderId` (string,null) **(required)**: - `unreadCounts` (object,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `partner` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `nameMissing` (boolean) **(required)**: - `logo` (string,null) **(required)**: - `order` (object,null) **(required)**: - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: - `status` (string) **(required)**: - `lastMessageSender` (object,null) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `image` (string,null) **(required)**: - `draftContext` (object,null) **(required)**: - `clinicName` (string) **(required)**: - `clinicNameMissing` (boolean) **(required)**: - `doctorName` (string,null) **(required)**: - `patientInitials` (string) **(required)**: - `targetDeliveryDate` (string,null) **(required)**: - `items` (object[]) **(required)**: - `id` (string) **(required)**: - `productName` (string) **(required)**: - `materialName` (string,null) **(required)**: - `quantity` (number) **(required)**: - `teethCount` (number) **(required)**: ### 401: Unauthorized ### 403: Not authorized for this conversation ### 404: Conversation not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/conversations/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List messages in a conversation `GET https://api-stage.guidelab.co/conversations/{id}/messages` Retrieve paginated messages for a conversation with sender info, org details, and attachments. Internal notes are only visible to the org that sent them. Supports cursor-based pagination via before/after message IDs. Documentation: https://docs.guidelab.co/api-reference/conversations/listConversationMessages ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `limit` (string) (in: query): - `before` (string) (in: query): - `after` (string) (in: query): ## Responses ### 200: Paginated list of messages with sender and attachment details - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `conversationId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `orderId` (string,null) **(required)**: - `senderUserId` (string) **(required)**: - `senderOrgId` (string) **(required)**: - `content` (string) **(required)**: - `messageType` (string) **(required)**: - `sequence` (number) **(required)**: - `isInternal` (boolean) **(required)**: - `replyToId` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `sender` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `nameMissing` (boolean) **(required)**: - `image` (string,null) **(required)**: - `senderOrg` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `nameMissing` (boolean) **(required)**: - `organizationType` (string) **(required)**: - `attachments` (object[]) **(required)**: - `id` (string) **(required)**: - `messageId` (string) **(required)**: - `name` (string) **(required)**: - `mimeType` (string) **(required)**: - `size` (number) **(required)**: - `duration` (number,null) **(required)**: - `hasThumbnail` (boolean) **(required)**: - `transcript` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `replyTo` (object): - `readState` (object) **(required)**: - `partnerOrganizationId` (string) **(required)**: - `partnerLastReadSequence` (number) **(required)**: - `pagination` (object) **(required)**: - `hasMore` (boolean) **(required)**: - `oldestId` (string): - `newestId` (string): ### 400: Invalid query parameters ### 401: Unauthorized ### 403: Not authorized for this conversation ### 404: Conversation not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/conversations/{id}/messages" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Send a message in a conversation `POST https://api-stage.guidelab.co/conversations/{id}/messages` Send a text, image, voice, or file message in a conversation. The client-generated message ID makes exact retries idempotent within the conversation and sender scope. Supports attachments, internal notes (visible only to your org), and reply threads. Updates unread counts and broadcasts to connected WebSocket clients. Documentation: https://docs.guidelab.co/api-reference/conversations/sendMessage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `clientMessageId` (string) **(required)**: [uuid] - `content` (string): (default: ``) - `messageType` (string): (default: `text`) Values: `text`, `image`, `voice`, `file` - `isInternal` (boolean): (default: `false`) - `replyToId` (string): - `attachments` (object[]): - `attachmentId` (string) **(required)**: - `duration` (integer): ## Responses ### 201: Message sent with sender and attachment details - `data` (object) **(required)**: - `id` (string) **(required)**: - `conversationId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `orderId` (string,null) **(required)**: - `senderUserId` (string) **(required)**: - `senderOrgId` (string) **(required)**: - `content` (string) **(required)**: - `messageType` (string) **(required)**: - `isInternal` (boolean) **(required)**: - `replyToId` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `sender` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `nameMissing` (boolean) **(required)**: - `image` (string,null) **(required)**: - `senderOrg` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `nameMissing` (boolean) **(required)**: - `organizationType` (string) **(required)**: - `attachments` (object[]) **(required)**: - `id` (string) **(required)**: - `messageId` (string) **(required)**: - `name` (string) **(required)**: - `mimeType` (string) **(required)**: - `size` (number) **(required)**: - `duration` (number,null) **(required)**: - `hasThumbnail` (boolean) **(required)**: - `transcript` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `replyTo` (object): ### 400: Invalid request body ### 401: Unauthorized ### 403: Not authorized for this conversation ### 404: Conversation not found ### 409: Client message ID is already in use ### 422: Client message ID was reused with different data ## Example ```bash curl -X POST "https://api-stage.guidelab.co/conversations/{id}/messages" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "clientMessageId": "string", "content": "string", "messageType": "text", "isInternal": true, "replyToId": "string", "attachments": [ { "attachmentId": "string", "duration": 0 } ] }' ``` --- # Mark conversation as read `POST https://api-stage.guidelab.co/conversations/{id}/read` Advance the current organization's conversation read cursor to the latest committed message sequence. Broadcasts the organization-wide cursor to connected clients. Documentation: https://docs.guidelab.co/api-reference/conversations/markConversationRead ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Conversation marked as read - `success` (boolean) **(required)**: - `lastReadSequence` (number) **(required)**: ### 401: Unauthorized ### 403: Not authorized for this conversation ### 404: Conversation not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/conversations/{id}/read" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Approve whole-conversation deletion `POST https://api-stage.guidelab.co/conversations/{id}/deletion-approval` Records the current participant organization's immutable approval. Deletion is authorized only after both the lab and clinic approve; platform legal has a separate admin override. Documentation: https://docs.guidelab.co/api-reference/conversations/approveConversationDeletion ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 202: Deletion approval recorded or deletion already authorized - `data` (object) **(required)**: - `conversationId` (string) **(required)**: - `status` (string) **(required)**: Values: `pending`, `authorized`, `completed` - `authorizationKind` (string,null) **(required)**: - `requestedAt` (string) **(required)**: - `authorizedAt` (string,null) **(required)**: - `completedAt` (string,null) **(required)**: - `approvedOrganizationIds` (string[]) **(required)**: ### 401: Unauthorized ### 403: Current organization is not a participant ### 404: Conversation not found ### 409: A correlated notification delivery is in flight ## Example ```bash curl -X POST "https://api-stage.guidelab.co/conversations/{id}/deletion-approval" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Archive a participant-owned conversation attachment `DELETE https://api-stage.guidelab.co/conversations/{id}/attachments/{attachmentId}` Immediately replaces an attachment owned by the current participant with a permanent placeholder. Its objects enter the shared hold-aware retirement lifecycle after 90 days. Documentation: https://docs.guidelab.co/api-reference/conversations/archiveConversationAttachment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `attachmentId` (string) **(required)** (in: path): ## Responses ### 200: Attachment archived or already archived - `data` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: Values: `[Attachment archived]` - `mimeType` (string) **(required)**: Values: `application/octet-stream` - `size` (number) **(required)**: Values: `0` - `duration` (null) **(required)**: - `transcript` (null) **(required)**: - `hasThumbnail` (boolean) **(required)**: Values: `false` ### 401: Unauthorized ### 403: Attachment belongs to the other participant ### 404: Conversation attachment not found ### 409: Attachment has not been finalized ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/conversations/{id}/attachments/{attachmentId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Prepare a direct conversation attachment upload `POST https://api-stage.guidelab.co/conversations/{id}/attachments/presign` Creates one-use, tenant-bound staging keys and exact-size/content-type presigned PUT URLs. Call finalize after both uploads complete. Documentation: https://docs.guidelab.co/api-reference/conversations/presignConversationAttachment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `filename` (string) **(required)**: - `mimeType` (string) **(required)**: - `size` (integer) **(required)**: - `thumbnailSize` (integer): ## Responses ### 201: One-use attachment upload claim created - `attachmentId` (string) **(required)**: - `uploadUrl` (string) **(required)**: - `uploadContentType` (string) **(required)**: - `thumbnailUploadUrl` (string,null) **(required)**: - `thumbnailUploadContentType` (string,null) **(required)**: - `name` (string) **(required)**: - `mimeType` (string) **(required)**: - `size` (number) **(required)**: - `category` (string) **(required)**: Values: `images`, `voice`, `files` ### 400: Invalid attachment metadata ### 401: Unauthorized ### 403: Not authorized for this conversation ### 404: Conversation not found ### 429: Upload issuance budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/conversations/{id}/attachments/presign" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "filename": "string", "mimeType": "string", "size": 0, "thumbnailSize": 0 }' ``` --- # Finalize a direct conversation attachment upload `POST https://api-stage.guidelab.co/conversations/{id}/attachments/finalize` Documentation: https://docs.guidelab.co/api-reference/conversations/finalizeConversationAttachment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `attachmentId` (string) **(required)**: ## Responses ### 200: Attachment is ready to send ### 400: Uploaded object does not match the claim ### 401: Unauthorized ### 403: Not authorized for this conversation ### 404: Conversation or upload claim not found ### 409: Upload claim cannot currently be finalized ## Example ```bash curl -X POST "https://api-stage.guidelab.co/conversations/{id}/attachments/finalize" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "attachmentId": "string" }' ``` --- # Transcribe a voice attachment `POST https://api-stage.guidelab.co/conversations/{id}/attachments/transcribe` Transcribe an audio attachment using OpenAI Whisper. The attachment may be a ready unsent upload claim owned by the current user or an attachment already sent in the conversation. Documentation: https://docs.guidelab.co/api-reference/conversations/transcribeConversationAttachment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `attachmentId` (string) **(required)**: - `dataProcessingConsent` (boolean) **(required)**: Values: `true` ## Responses ### 200: Transcription result - `transcript` (string) **(required)**: ### 400: Invalid request or attachment is not audio ### 401: Unauthorized ### 403: Not authorized for this conversation ### 404: Conversation or attachment not found ### 409: Attachment transcription is already in progress ### 429: Transcription rate limit exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/conversations/{id}/attachments/transcribe" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "attachmentId": "string", "dataProcessingConsent": true }' ``` --- # Download a conversation attachment `GET https://api-stage.guidelab.co/conversations/attachments/{id}` Stream a conversation attachment file from R2 storage. Supports thumbnail mode via ?thumbnail=true and proxy mode via ?proxy=true. Only accessible by organizations that are part of the conversation's partnership. Documentation: https://docs.guidelab.co/api-reference/conversations/getConversationAttachment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `thumbnail` (string) (in: query): Set to 'true' to return thumbnail version - `proxy` (string) (in: query): Set to 'true' to serve inline instead of as download ## Responses ### 200: Attachment file stream ### 401: Unauthorized ### 403: Not authorized ### 404: Attachment or file not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/conversations/attachments/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # One-click unsubscribe from notification emails `POST https://api-stage.guidelab.co/notifications/unsubscribe` Public endpoint used by List-Unsubscribe headers to disable email notifications for a single notification category. Documentation: https://docs.guidelab.co/api-reference/notifications/unsubscribeNotificationEmails ## Parameters - `token` (string) **(required)** (in: query): ## Responses ### 200: Notification email preference updated ### 400: Invalid unsubscribe token ## Example ```bash curl -X POST "https://api-stage.guidelab.co/notifications/unsubscribe" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List notifications `GET https://api-stage.guidelab.co/notifications` Retrieve paginated notifications for the current user within their active organization. Supports cursor-based pagination and filtering by unread status. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/notifications/listNotifications ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `limit` (string) (in: query): Max items to return (1-50, default 20) - `before` (string) (in: query): Cursor: notification ID to paginate before - `unreadOnly` (string) (in: query): Set to 'true' to return only unread notifications ## Responses ### 200: Paginated list of notifications with unread count - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `userId` (string) **(required)**: - `organizationId` (string) **(required)**: - `type` (string) **(required)**: - `title` (string) **(required)**: - `body` (string,null) **(required)**: - `data` (object): - `readAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `unreadCount` (number) **(required)**: - `hasMore` (boolean) **(required)**: ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/notifications" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get conversation unread count `GET https://api-stage.guidelab.co/notifications/count` Returns the total number of unread conversation messages across all partnerships for the current organization. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/notifications/getConversationUnreadCount ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Total unread conversation message count - `unreadCount` (number) **(required)**: ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/notifications/count" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Mark notifications as read `POST https://api-stage.guidelab.co/notifications/mark-read` Mark specific notifications or all unread notifications as read for the current user. Provide either an array of notificationIds or set all to true. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/notifications/markNotificationsRead ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `notificationIds` (string[]): - `all` (boolean): Values: `true` ## Responses ### 200: Notifications marked as read - `success` (boolean) **(required)**: ### 400: Invalid request body ### 401: Unauthorized ## Example ```bash curl -X POST "https://api-stage.guidelab.co/notifications/mark-read" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "notificationIds": [ "string" ], "all": true }' ``` --- # Get notification unread count `GET https://api-stage.guidelab.co/notifications/unread-count` Returns the count of unread notifications for the current user within their active organization. Available to both labs and clinics. Documentation: https://docs.guidelab.co/api-reference/notifications/getNotificationUnreadCount ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Unread notification count - `count` (number) **(required)**: ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/notifications/unread-count" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get VAPID public key `GET https://api-stage.guidelab.co/push-subscriptions/vapid-key` Returns the VAPID public key needed to subscribe to push notifications. Requires user authentication but no specific organization context. Documentation: https://docs.guidelab.co/api-reference/push-subscriptions/getVapidPublicKey ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: VAPID public key for push notification subscription - `publicKey` (string) **(required)**: ### 401: Unauthorized ### 503: Push notifications not configured on the server ## Example ```bash curl -X GET "https://api-stage.guidelab.co/push-subscriptions/vapid-key" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List push subscriptions `GET https://api-stage.guidelab.co/push-subscriptions` List all registered push subscriptions for the current user. Requires user authentication. Documentation: https://docs.guidelab.co/api-reference/push-subscriptions/listPushSubscriptions ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of registered push subscriptions for the current user - `subscriptions` (object[]) **(required)**: - `id` (string) **(required)**: - `endpoint` (string) **(required)**: - `userAgent` (string,null) **(required)**: - `createdAt` (string) **(required)**: ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/push-subscriptions" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Register push subscription `POST https://api-stage.guidelab.co/push-subscriptions` Register a new Web Push subscription for the current user. If the endpoint already exists, it will be updated with the new keys. Requires user authentication. Documentation: https://docs.guidelab.co/api-reference/push-subscriptions/registerPushSubscription ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `endpoint` (string) **(required)**: [uri] - `keys` (object) **(required)**: - `p256dh` (string) **(required)**: - `auth` (string) **(required)**: ## Responses ### 201: Push subscription registered successfully - `success` (boolean) **(required)**: ### 400: Invalid subscription data ### 401: Unauthorized ### 409: Push subscription limit reached ## Example ```bash curl -X POST "https://api-stage.guidelab.co/push-subscriptions" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "endpoint": "https://example.com", "keys": { "p256dh": "string", "auth": "string" } }' ``` --- # Unregister push subscription `DELETE https://api-stage.guidelab.co/push-subscriptions` Remove a push subscription by its endpoint URL. Only subscriptions belonging to the current user will be removed. Requires user authentication. Documentation: https://docs.guidelab.co/api-reference/push-subscriptions/unregisterPushSubscription ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `endpoint` (string) **(required)**: [uri] ## Responses ### 200: Push subscription removed successfully - `success` (boolean) **(required)**: ### 400: Invalid request body ### 401: Unauthorized ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/push-subscriptions" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "endpoint": "https://example.com" }' ``` --- # Get Company Settings `GET https://api-stage.guidelab.co/company-settings` Retrieve the company settings for the current organization, including contact details, address, and preferences. Documentation: https://docs.guidelab.co/api-reference/company-settings/getCompanySettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Company settings for the current organization - `settings` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `slug` (string) **(required)**: - `logo` (string,null) **(required)**: - `labReference` (string,null) **(required)**: - `email` (string,null) **(required)**: - `billingEmail` (string,null) **(required)**: - `address` (string,null) **(required)**: - `addressLine2` (string,null) **(required)**: - `city` (string,null) **(required)**: - `state` (string,null) **(required)**: - `country` (string,null) **(required)**: - `postcode` (string,null) **(required)**: - `timezone` (string) **(required)**: - `currency` (string) **(required)**: - `dateFormat` (string,null) **(required)**: - `phone` (string,null) **(required)**: - `website` (string,null) **(required)**: - `companyNumber` (string,null) **(required)**: - `taxRegistrationNumber` (string,null) **(required)**: - `teethChartingSystem` (string,null) **(required)**: - `workTypeLayout` (string,null) **(required)**: - `latitude` (string,null) **(required)**: - `longitude` (string,null) **(required)**: - `isDiscoverable` (boolean,null) **(required)**: - `description` (string,null) **(required)**: - `coverImage` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 404: Organization not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/company-settings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Company Settings `PUT https://api-stage.guidelab.co/company-settings` Update company settings such as name, contact information, address, currency, and other organization preferences. Documentation: https://docs.guidelab.co/api-reference/company-settings/updateCompanySettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string): - `labReference` (string,null): - `email` (string,null): [email] - `billingEmail` (string,null): [email] - `address` (string,null): - `addressLine2` (string,null): - `city` (string,null): - `state` (string,null): - `country` (string): - `postcode` (string,null): - `timezone` (string): - `currency` (string): Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `acknowledgeCatalogRepricingRows` (integer): - `dateFormat` (string,null): Values: `DD/MM/YYYY`, `MM/DD/YYYY`, `YYYY-MM-DD`, `DD-MM-YYYY`, `DD.MM.YYYY`, `null` - `phone` (string,null): - `website` (object): - `companyNumber` (object): - `taxRegistrationNumber` (string,null): - `teethChartingSystem` (string,null): Values: `FDI`, `Universal`, `Palmer`, `null` - `workTypeLayout` (string): Values: `standard`, `stepper` - `latitude` (number,null): - `longitude` (number,null): - `isDiscoverable` (boolean): - `description` (string,null): ## Responses ### 200: Successfully updated company settings - `settings` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `slug` (string) **(required)**: - `logo` (string,null) **(required)**: - `labReference` (string,null) **(required)**: - `email` (string,null) **(required)**: - `billingEmail` (string,null) **(required)**: - `address` (string,null) **(required)**: - `addressLine2` (string,null) **(required)**: - `city` (string,null) **(required)**: - `state` (string,null) **(required)**: - `country` (string,null) **(required)**: - `postcode` (string,null) **(required)**: - `timezone` (string) **(required)**: - `currency` (string) **(required)**: - `dateFormat` (string,null) **(required)**: - `phone` (string,null) **(required)**: - `website` (string,null) **(required)**: - `companyNumber` (string,null) **(required)**: - `taxRegistrationNumber` (string,null) **(required)**: - `teethChartingSystem` (string,null) **(required)**: - `workTypeLayout` (string,null) **(required)**: - `latitude` (string,null) **(required)**: - `longitude` (string,null) **(required)**: - `isDiscoverable` (boolean,null) **(required)**: - `description` (string,null) **(required)**: - `coverImage` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 404: Organization not found ### 409: Currency conflicts with persisted catalog prices or the legal identity is already registered ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/company-settings" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Get Company Logo `GET https://api-stage.guidelab.co/company-settings/logo` Serve the company logo image from R2 storage. The optional orgId parameter is limited to the current organization, discoverable organizations, or active partners. Documentation: https://docs.guidelab.co/api-reference/company-settings/getCompanyLogo ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `orgId` (string) (in: query): ## Responses ### 200: Company logo image binary ### 404: Organization or logo not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/company-settings/logo" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload Company Logo `POST https://api-stage.guidelab.co/company-settings/logo` Upload a new company logo image. Replaces any existing logo. Accepts JPEG, PNG, WebP, or GIF up to 5MB. Documentation: https://docs.guidelab.co/api-reference/company-settings/uploadCompanyLogo ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Successfully uploaded company logo - `settings` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `logo` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid file type or file too large ### 404: Organization not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/company-settings/logo" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Company Logo `DELETE https://api-stage.guidelab.co/company-settings/logo` Remove the company logo from R2 storage and clear the logo reference in the organization record. Documentation: https://docs.guidelab.co/api-reference/company-settings/deleteCompanyLogo ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Company logo successfully removed - `settings` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `logo` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `message` (string) **(required)**: ### 400: No logo to delete ### 404: Organization not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/company-settings/logo" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Company Cover Image `GET https://api-stage.guidelab.co/company-settings/cover-image` Serve the company cover image from R2 storage. The optional orgId parameter is limited to the current organization, discoverable organizations, or active partners. Documentation: https://docs.guidelab.co/api-reference/company-settings/getCompanyCoverImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `orgId` (string) (in: query): ## Responses ### 200: Cover image binary ### 404: Organization or cover image not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/company-settings/cover-image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload Company Cover Image `POST https://api-stage.guidelab.co/company-settings/cover-image` Upload a new cover image for the company profile. Replaces any existing cover image. Accepts JPEG, PNG, WebP, or GIF up to 5MB. Documentation: https://docs.guidelab.co/api-reference/company-settings/uploadCompanyCoverImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Cover image successfully uploaded - `success` (boolean) **(required)**: ### 400: Invalid file type or file too large ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/company-settings/cover-image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Company Cover Image `DELETE https://api-stage.guidelab.co/company-settings/cover-image` Remove the company cover image from R2 storage and clear the reference in the organization record. Documentation: https://docs.guidelab.co/api-reference/company-settings/deleteCompanyCoverImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Cover image successfully removed - `success` (boolean) **(required)**: ### 400: No cover image to delete ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/company-settings/cover-image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Company Gallery Images `GET https://api-stage.guidelab.co/company-settings/gallery` List all gallery images for the organization, sorted by display order. The optional orgId parameter is limited to the current organization, discoverable organizations, or active partners. Documentation: https://docs.guidelab.co/api-reference/company-settings/listCompanyGalleryImages ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `orgId` (string) (in: query): ## Responses ### 200: List of gallery images with URLs and sort order Array of: - `id` (string) **(required)**: - `url` (string) **(required)**: - `sortOrder` (number) **(required)**: ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/company-settings/gallery" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload Company Gallery Image `POST https://api-stage.guidelab.co/company-settings/gallery` Upload a new gallery image for the company profile. Accepts JPEG, PNG, WebP, or GIF up to 5MB. Automatically assigned the next sort order. Documentation: https://docs.guidelab.co/api-reference/company-settings/uploadCompanyGalleryImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Successfully uploaded gallery image with ID and URL - `id` (string) **(required)**: - `url` (string) **(required)**: - `sortOrder` (number) **(required)**: ### 400: Invalid file type or file too large ### 409: Organization gallery image limit reached ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/company-settings/gallery" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Reorder Company Gallery Images `POST https://api-stage.guidelab.co/company-settings/gallery/reorder` Reorder gallery images by providing an ordered array of image IDs. Each image's sort order is updated to match its position in the array. Documentation: https://docs.guidelab.co/api-reference/company-settings/reorderCompanyGalleryImages ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `ids` (string[]) **(required)**: ## Responses ### 200: Gallery images successfully reordered - `success` (boolean) **(required)**: ### 400: Invalid request body ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/company-settings/gallery/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "ids": [ "string" ] }' ``` --- # Get Company Gallery Image `GET https://api-stage.guidelab.co/company-settings/gallery/{id}/image` Serve a specific gallery image binary from R2 storage by its ID. Documentation: https://docs.guidelab.co/api-reference/company-settings/getCompanyGalleryImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Gallery image binary ### 404: Gallery image not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/company-settings/gallery/{id}/image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Company Gallery Image `DELETE https://api-stage.guidelab.co/company-settings/gallery/{id}` Delete a specific gallery image from R2 storage and remove its database record. Documentation: https://docs.guidelab.co/api-reference/company-settings/deleteCompanyGalleryImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Gallery image successfully deleted - `success` (boolean) **(required)**: ### 404: Gallery image not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/company-settings/gallery/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Document Settings `GET https://api-stage.guidelab.co/document-settings` Retrieve document settings for the current lab, including title, terms and conditions, footer text, and manufacture details. Documentation: https://docs.guidelab.co/api-reference/document-settings/getDocumentSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Document settings for the current lab - `settings` (object) **(required)**: - `id` (string,null) **(required)**: - `labId` (string) **(required)**: - `documentType` (string) **(required)**: - `title` (string,null) **(required)**: - `termsAndConditions` (string,null) **(required)**: - `footerText` (string,null) **(required)**: - `footerLogoKey` (string,null) **(required)**: - `manufactureTitle` (string,null) **(required)**: - `manufactureText` (string,null) **(required)**: - `showAdditionalProductInfo` (boolean) **(required)**: - `createdAt` (string,null) **(required)**: - `updatedAt` (string,null) **(required)**: ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/document-settings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Document Settings `PUT https://api-stage.guidelab.co/document-settings` Update document settings for the current lab. Creates default settings if none exist. Controls document title, terms, footer text, and manufacture info. Documentation: https://docs.guidelab.co/api-reference/document-settings/updateDocumentSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `title` (string,null): - `termsAndConditions` (string,null): - `footerText` (string,null): - `manufactureTitle` (string,null): - `manufactureText` (string,null): - `showAdditionalProductInfo` (boolean): ## Responses ### 200: Successfully updated document settings - `settings` (object) **(required)**: - `id` (string,null) **(required)**: - `labId` (string) **(required)**: - `documentType` (string) **(required)**: - `title` (string,null) **(required)**: - `termsAndConditions` (string,null) **(required)**: - `footerText` (string,null) **(required)**: - `footerLogoKey` (string,null) **(required)**: - `manufactureTitle` (string,null) **(required)**: - `manufactureText` (string,null) **(required)**: - `showAdditionalProductInfo` (boolean) **(required)**: - `createdAt` (string,null) **(required)**: - `updatedAt` (string,null) **(required)**: ### 400: Invalid request body ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/document-settings" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "title": "string", "termsAndConditions": "string", "footerText": "string", "manufactureTitle": "string", "manufactureText": "string", "showAdditionalProductInfo": true }' ``` --- # Get Document Footer Logo `GET https://api-stage.guidelab.co/document-settings/logo` Serve the document footer logo image from R2 storage for the current lab. Documentation: https://docs.guidelab.co/api-reference/document-settings/getDocumentFooterLogo ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Footer logo image binary ### 404: Document settings or footer logo not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/document-settings/logo" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload Document Footer Logo `POST https://api-stage.guidelab.co/document-settings/logo` Upload a new footer logo for documents. Replaces any existing footer logo. Accepts JPEG, PNG, WebP, or GIF up to 5MB. Documentation: https://docs.guidelab.co/api-reference/document-settings/uploadDocumentFooterLogo ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Successfully uploaded footer logo with updated settings - `settings` (object) **(required)**: - `id` (string,null) **(required)**: - `labId` (string) **(required)**: - `documentType` (string) **(required)**: - `title` (string,null) **(required)**: - `termsAndConditions` (string,null) **(required)**: - `footerText` (string,null) **(required)**: - `footerLogoKey` (string,null) **(required)**: - `manufactureTitle` (string,null) **(required)**: - `manufactureText` (string,null) **(required)**: - `showAdditionalProductInfo` (boolean) **(required)**: - `createdAt` (string,null) **(required)**: - `updatedAt` (string,null) **(required)**: ### 400: Invalid file type or file too large ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/document-settings/logo" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Document Footer Logo `DELETE https://api-stage.guidelab.co/document-settings/logo` Remove the document footer logo from R2 storage and clear the reference in the document settings. Documentation: https://docs.guidelab.co/api-reference/document-settings/deleteDocumentFooterLogo ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Footer logo successfully removed - `settings` (object) **(required)**: - `id` (string,null) **(required)**: - `labId` (string) **(required)**: - `documentType` (string) **(required)**: - `title` (string,null) **(required)**: - `termsAndConditions` (string,null) **(required)**: - `footerText` (string,null) **(required)**: - `footerLogoKey` (string,null) **(required)**: - `manufactureTitle` (string,null) **(required)**: - `manufactureText` (string,null) **(required)**: - `showAdditionalProductInfo` (boolean) **(required)**: - `createdAt` (string,null) **(required)**: - `updatedAt` (string,null) **(required)**: - `message` (string) **(required)**: ### 400: No logo to delete ### 404: Document settings not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/document-settings/logo" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Hold Reasons `GET https://api-stage.guidelab.co/hold-reasons` List all hold reasons for the current lab, sorted by display order. Optionally include inactive reasons. Documentation: https://docs.guidelab.co/api-reference/hold-reasons/listHoldReasons ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` () (in: query): Default: `false` ## Responses ### 200: List of hold reasons for the lab - `reasons` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `requiresFileReupload` (boolean) **(required)**: - `autoFillNotes` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `truncated` (boolean) **(required)**: True when the lab holds more reasons than one response returns. The list is capped, not refused. ### 400: Invalid query parameters ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/hold-reasons" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Hold Reason `POST https://api-stage.guidelab.co/hold-reasons` Create a new hold reason for the lab. Automatically assigns the next sort order if not specified. Documentation: https://docs.guidelab.co/api-reference/hold-reasons/createHoldReason ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `sortOrder` (integer): - `requiresFileReupload` (boolean): - `autoFillNotes` (string,null): ## Responses ### 201: Newly created hold reason - `reason` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `requiresFileReupload` (boolean) **(required)**: - `autoFillNotes` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 404: Lab not found ### 409: Hold reason row limit reached ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/hold-reasons" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "sortOrder": 0, "requiresFileReupload": true, "autoFillNotes": "string" }' ``` --- # Reorder Hold Reasons `POST https://api-stage.guidelab.co/hold-reasons/reorder` Reorder hold reasons by providing an ordered array of reason IDs. Each reason's sort order is updated to match its position. Documentation: https://docs.guidelab.co/api-reference/hold-reasons/reorderHoldReasons ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `reasonIds` (string[]) **(required)**: ## Responses ### 200: Hold reasons successfully reordered - `success` (boolean) **(required)**: ### 400: Invalid request body ### 404: One or more hold reasons not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/hold-reasons/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "reasonIds": [ "string" ] }' ``` --- # Delete Hold Reason `DELETE https://api-stage.guidelab.co/hold-reasons/{id}` Soft-delete a hold reason by marking it as inactive. The reason remains in the database for historical reference. Documentation: https://docs.guidelab.co/api-reference/hold-reasons/deleteHoldReason ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Hold reason ID ## Responses ### 200: Hold reason deactivated - `reason` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `requiresFileReupload` (boolean) **(required)**: - `autoFillNotes` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 404: Hold reason not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/hold-reasons/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Hold Reason `PUT https://api-stage.guidelab.co/hold-reasons/{id}` Update an existing hold reason's name, active status, file reupload requirement, or auto-fill notes. Documentation: https://docs.guidelab.co/api-reference/hold-reasons/updateHoldReason ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Hold reason ID ## Request Body Content-Type: `application/json` - `name` (string): - `isActive` (boolean): - `requiresFileReupload` (boolean): - `autoFillNotes` (string,null): ## Responses ### 200: Successfully updated hold reason - `reason` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `requiresFileReupload` (boolean) **(required)**: - `autoFillNotes` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 404: Hold reason not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/hold-reasons/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "isActive": true, "requiresFileReupload": true, "autoFillNotes": "string" }' ``` --- # List Qc Checklist Items `GET https://api-stage.guidelab.co/qc-checklist` List all quality control checklist items for the current lab, sorted by display order. Optionally include inactive items. Documentation: https://docs.guidelab.co/api-reference/qc-checklist/listQcChecklistItems ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` (boolean,null) (in: query): Default: `false` ## Responses ### 200: List of QC checklist items for the lab - `items` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid query parameters ### 409: QC checklist row limit exceeded ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/qc-checklist" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Qc Checklist Item `POST https://api-stage.guidelab.co/qc-checklist` Create a new quality control checklist item for the lab. Automatically assigns the next sort order if not specified. Documentation: https://docs.guidelab.co/api-reference/qc-checklist/createQcChecklistItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Newly created QC checklist item - `item` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 409: QC checklist item limit reached ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/qc-checklist" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "sortOrder": 0, "isActive": true }' ``` --- # Reorder Qc Checklist Items `POST https://api-stage.guidelab.co/qc-checklist/reorder` Reorder QC checklist items by providing an ordered array of item IDs. Each item's sort order is updated to match its position. Documentation: https://docs.guidelab.co/api-reference/qc-checklist/reorderQcChecklistItems ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `ids` (string[]) **(required)**: ## Responses ### 200: QC checklist items successfully reordered - `success` (boolean) **(required)**: ### 400: Invalid request body ### 404: One or more QC checklist items not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/qc-checklist/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "ids": [ "string" ] }' ``` --- # Delete Qc Checklist Item `DELETE https://api-stage.guidelab.co/qc-checklist/{id}` Soft-delete a QC checklist item by marking it as inactive. The item remains in the database for historical reference. Documentation: https://docs.guidelab.co/api-reference/qc-checklist/deleteQcChecklistItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): QC checklist item ID ## Responses ### 200: QC checklist item deactivated - `item` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 404: QC checklist item not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/qc-checklist/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Qc Checklist Item `PUT https://api-stage.guidelab.co/qc-checklist/{id}` Update an existing QC checklist item's name, active status, or sort order. Documentation: https://docs.guidelab.co/api-reference/qc-checklist/updateQcChecklistItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): QC checklist item ID ## Request Body Content-Type: `application/json` - `name` (string): - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 200: Successfully updated QC checklist item - `item` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 404: QC checklist item not found ### 409: Active QC checklist item limit reached ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/qc-checklist/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "sortOrder": 0, "isActive": true }' ``` --- # Get Qc Settings `GET https://api-stage.guidelab.co/qc-settings` Retrieve quality control settings for the current lab. Returns an unpersisted default projection with QC disabled when no row exists; writes occur only through the manager-guarded update command. Documentation: https://docs.guidelab.co/api-reference/qc-settings/getQcSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: QC settings for the current lab - `settings` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `qcEnabled` (boolean) **(required)**: - `selectAllEnabled` (boolean) **(required)**: - `automationEnabled` (boolean) **(required)**: - `automationId` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/qc-settings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Qc Settings `PUT https://api-stage.guidelab.co/qc-settings` Update quality control settings for the current lab. Creates default settings if none exist (upsert). Controls QC enabled state, select-all, and automation. Documentation: https://docs.guidelab.co/api-reference/qc-settings/updateQcSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `qcEnabled` (boolean): - `selectAllEnabled` (boolean): - `automationEnabled` (boolean): - `automationId` (string,null): ## Responses ### 200: Successfully updated QC settings - `settings` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `qcEnabled` (boolean) **(required)**: - `selectAllEnabled` (boolean) **(required)**: - `automationEnabled` (boolean) **(required)**: - `automationId` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/qc-settings" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "qcEnabled": true, "selectAllEnabled": true, "automationEnabled": true, "automationId": "string" }' ``` --- # List Receiving Categories `GET https://api-stage.guidelab.co/receiving-categories` List all persisted receiving categories for the current lab with optional sources. Defaults are initialized during organization creation or by the explicit settings-defaults command. Documentation: https://docs.guidelab.co/api-reference/receiving/listReceivingCategories ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` () (in: query): Default: `false` - `includeSources` () (in: query): Default: `true` ## Responses ### 200: List of receiving categories with optional nested sources - `categories` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `description` (string,null) **(required)**: - `showInFlow` (boolean) **(required)**: - `settings` (object,null) **(required)**: - `unitsPerItemLimit` (integer): - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `sources` (object[]): - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid query parameters ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/receiving-categories" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Receiving Category `PUT https://api-stage.guidelab.co/receiving-categories/{id}` Update a receiving category's visibility in the receiving flow, settings (e.g. units per item limit), or active status. Documentation: https://docs.guidelab.co/api-reference/receiving/updateReceivingCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Receiving category ID ## Request Body Content-Type: `application/json` - `showInFlow` (boolean): - `settings` (object): - `unitsPerItemLimit` (integer): - `isActive` (boolean): ## Responses ### 200: Successfully updated receiving category - `category` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `description` (string,null) **(required)**: - `showInFlow` (boolean) **(required)**: - `settings` (object,null) **(required)**: - `unitsPerItemLimit` (integer): - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `sources` (object[]): - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 404: Receiving category not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/receiving-categories/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "showInFlow": true, "settings": { "unitsPerItemLimit": 0 }, "isActive": true }' ``` --- # Create Receiving Source `POST https://api-stage.guidelab.co/receiving-sources` Create a new receiving source within a category (e.g., a specific scanner brand under the Digital category). Validates the category belongs to the lab. Documentation: https://docs.guidelab.co/api-reference/receiving/createReceivingSource ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `categoryId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string): - `sortOrder` (integer): ## Responses ### 201: Newly created receiving source - `source` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 404: Parent category not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/receiving-sources" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "categoryId": "string", "name": "string", "code": "string", "sortOrder": 0 }' ``` --- # Reorder Receiving Sources `POST https://api-stage.guidelab.co/receiving-sources/reorder` Reorder receiving sources within a category by providing an ordered array of source IDs. Validates all sources belong to the specified category. Documentation: https://docs.guidelab.co/api-reference/receiving/reorderReceivingSources ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `categoryId` (string) **(required)**: - `sourceIds` (string[]) **(required)**: ## Responses ### 200: Receiving sources successfully reordered - `success` (boolean) **(required)**: ### 400: Invalid request body ### 404: Category or one or more sources not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/receiving-sources/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "categoryId": "string", "sourceIds": [ "string" ] }' ``` --- # Delete Receiving Source `DELETE https://api-stage.guidelab.co/receiving-sources/{id}` Soft-delete a receiving source by marking it as inactive. The source remains in the database for historical reference. Documentation: https://docs.guidelab.co/api-reference/receiving/deleteReceivingSource ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Receiving source ID ## Responses ### 200: Receiving source deactivated - `source` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 404: Receiving source not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/receiving-sources/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Receiving Source `PUT https://api-stage.guidelab.co/receiving-sources/{id}` Update a receiving source's name, code, or active status. Documentation: https://docs.guidelab.co/api-reference/receiving/updateReceivingSource ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Receiving source ID ## Request Body Content-Type: `application/json` - `name` (string): - `code` (string,null): - `isActive` (boolean): ## Responses ### 200: Successfully updated receiving source - `source` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 404: Receiving source not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/receiving-sources/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "code": "string", "isActive": true }' ``` --- # List Remake Reasons `GET https://api-stage.guidelab.co/remake-reasons` List all remake reasons for the current lab, sorted by display order. Each reason includes its associated discount percentage. Documentation: https://docs.guidelab.co/api-reference/remake-reasons/listRemakeReasons ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` () (in: query): Default: `false` ## Responses ### 200: List of remake reasons for the lab - `reasons` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `discountPercent` (number) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `truncated` (boolean) **(required)**: True when the lab holds more reasons than one response returns. The list is capped, not refused. ### 400: Invalid query parameters ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/remake-reasons" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Remake Reason `POST https://api-stage.guidelab.co/remake-reasons` Create a new remake reason with an optional discount percentage. Automatically assigns the next sort order if not specified. Documentation: https://docs.guidelab.co/api-reference/remake-reasons/createRemakeReason ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `discountPercent` (integer,null): (default: `0`) - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Newly created remake reason - `reason` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `discountPercent` (number) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 404: Lab not found ### 409: Remake reason row limit reached ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/remake-reasons" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "discountPercent": "string", "sortOrder": 0, "isActive": true }' ``` --- # Reorder Remake Reasons `POST https://api-stage.guidelab.co/remake-reasons/reorder` Reorder remake reasons by providing an ordered array of reason IDs. Each reason's sort order is updated to match its position. Documentation: https://docs.guidelab.co/api-reference/remake-reasons/reorderRemakeReasons ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `ids` (string[]) **(required)**: ## Responses ### 200: Remake reasons successfully reordered - `success` (boolean) **(required)**: ### 400: Invalid request body ### 404: One or more remake reasons not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/remake-reasons/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "ids": [ "string" ] }' ``` --- # Delete Remake Reason `DELETE https://api-stage.guidelab.co/remake-reasons/{id}` Soft-delete a remake reason by marking it as inactive. The reason remains in the database for historical reference. Documentation: https://docs.guidelab.co/api-reference/remake-reasons/deleteRemakeReason ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Remake reason ID ## Responses ### 200: Remake reason deactivated - `reason` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `discountPercent` (number) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 404: Remake reason not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/remake-reasons/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Remake Reason `PUT https://api-stage.guidelab.co/remake-reasons/{id}` Update an existing remake reason's name, discount percentage, active status, or sort order. Documentation: https://docs.guidelab.co/api-reference/remake-reasons/updateRemakeReason ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Remake reason ID ## Request Body Content-Type: `application/json` - `name` (string): - `discountPercent` (integer,null): (default: `0`) - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 200: Successfully updated remake reason - `reason` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `discountPercent` (number) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 404: Remake reason not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/remake-reasons/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "discountPercent": "string", "sortOrder": 0, "isActive": true }' ``` --- # List Sticker Template Categories `GET https://api-stage.guidelab.co/sticker-templates/categories` List sticker template categories for the lab with pagination, search, and template count per category. Clinic users must provide a labId. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/listStickerTemplateCategories ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` (string) (in: query): Default: `false` - `search` (string) (in: query): - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `50` - `labId` (string) (in: query): ## Responses ### 200: Paginated list of sticker template categories with template counts - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `templateCount` (number) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters or missing labId for clinic users ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/sticker-templates/categories" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Sticker Template Category `POST https://api-stage.guidelab.co/sticker-templates/categories` Create a new sticker template category for organizing sticker templates. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/createStickerTemplateCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `description` (string): - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Newly created sticker template category - `category` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `templateCount` (number) **(required)**: ### 400: Invalid request body ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/sticker-templates/categories" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "sortOrder": 0, "isActive": true }' ``` --- # Get Sticker Template Category `GET https://api-stage.guidelab.co/sticker-templates/categories/{id}` Retrieve a single sticker template category by ID. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/getStickerTemplateCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Sticker template category details - `category` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 404: Category not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/sticker-templates/categories/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Sticker Template Category `DELETE https://api-stage.guidelab.co/sticker-templates/categories/{id}` Soft-delete a sticker template category by marking it as inactive. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/deleteStickerTemplateCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Category deactivated - `success` (boolean) **(required)**: ### 404: Category not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/sticker-templates/categories/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Sticker Template Category `PUT https://api-stage.guidelab.co/sticker-templates/categories/{id}` Update a sticker template category's name, description, sort order, or active status. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/updateStickerTemplateCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `name` (string): - `description` (string): - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 200: Successfully updated sticker template category - `category` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 404: Category not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/sticker-templates/categories/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "sortOrder": 0, "isActive": true }' ``` --- # Generate Sticker Pdf `POST https://api-stage.guidelab.co/sticker-templates/generate` Generate sticker PDF data for a specific order using a template. Resolves order variables (patient, clinic, doctor, product category) and returns processed template data with inputs for PDF generation. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/generateStickerPdf ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `templateId` (string) **(required)**: - `orderId` (string) **(required)**: - `copies` (integer): (default: `1`) ## Responses ### 200: Processed sticker template with resolved variables and PDF inputs - `template` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `width` (string) **(required)**: - `height` (string) **(required)**: - `templateData` (object) **(required)**: - `basePdf` (object) **(required)**: - `schemas` (array[]) **(required)**: - `sampledata` (object[]): - `previewImageKey` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `variables` (object) **(required)**: - `inputs` (object[]) **(required)**: - `copies` (number) **(required)**: ### 400: Invalid request body ### 404: Template or order not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/sticker-templates/generate" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "templateId": "string", "orderId": "string", "copies": 0 }' ``` --- # List Sticker Templates `GET https://api-stage.guidelab.co/sticker-templates` List sticker templates for the lab with pagination, search, and optional category filtering. Includes joined category data. Clinic users must provide a labId. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/listStickerTemplates ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `categoryId` (string) (in: query): - `includeInactive` (string) (in: query): Default: `false` - `search` (string) (in: query): - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `50` - `labId` (string) (in: query): ## Responses ### 200: Paginated list of sticker templates with category details - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `width` (string) **(required)**: - `height` (string) **(required)**: - `templateData` (object) **(required)**: - `basePdf` (object) **(required)**: - `schemas` (array[]) **(required)**: - `sampledata` (object[]): - `previewImageKey` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `category` (object,null) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters or missing labId for clinic users ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/sticker-templates" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Sticker Template `POST https://api-stage.guidelab.co/sticker-templates` Create a new sticker template with dimensions, template data, and optional category. If marked as default, unsets the previous default template. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/createStickerTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `categoryId` (string,null): - `name` (string) **(required)**: - `description` (string): - `width` (number): (default: `50`) - `height` (number): (default: `25`) - `templateData` (object) **(required)**: - `basePdf` (object) **(required)**: - `schemas` (array[]) **(required)**: - `sampledata` (object[]): - `isDefault` (boolean): (default: `false`) - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Newly created sticker template - `template` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `width` (string) **(required)**: - `height` (string) **(required)**: - `templateData` (object) **(required)**: - `basePdf` (object) **(required)**: - `schemas` (array[]) **(required)**: - `sampledata` (object[]): - `previewImageKey` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body or category not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/sticker-templates" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "templateData": { "basePdf": "string", "schemas": [ [ {} ] ], "sampledata": [ {} ] } }' ``` --- # Get Sticker Template `GET https://api-stage.guidelab.co/sticker-templates/{id}` Retrieve a single sticker template by ID, including its full template data and joined category information. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/getStickerTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Sticker template details with category - `template` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `width` (string) **(required)**: - `height` (string) **(required)**: - `templateData` (object) **(required)**: - `basePdf` (object) **(required)**: - `schemas` (array[]) **(required)**: - `sampledata` (object[]): - `previewImageKey` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `category` (object,null) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 404: Template not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/sticker-templates/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Sticker Template `DELETE https://api-stage.guidelab.co/sticker-templates/{id}` Soft-delete a sticker template by marking it as inactive. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/deleteStickerTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Sticker template deactivated - `success` (boolean) **(required)**: ### 404: Template not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/sticker-templates/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Sticker Template `PUT https://api-stage.guidelab.co/sticker-templates/{id}` Update an existing sticker template's properties including name, dimensions, template data, category, and default status. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/updateStickerTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `categoryId` (string,null): - `name` (string): - `description` (string): - `width` (number): (default: `50`) - `height` (number): (default: `25`) - `templateData` (object): - `basePdf` (object) **(required)**: - `schemas` (array[]) **(required)**: - `sampledata` (object[]): - `isDefault` (boolean): (default: `false`) - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 200: Successfully updated sticker template - `template` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `width` (string) **(required)**: - `height` (string) **(required)**: - `templateData` (object) **(required)**: - `basePdf` (object) **(required)**: - `schemas` (array[]) **(required)**: - `sampledata` (object[]): - `previewImageKey` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body or category not found ### 404: Template not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/sticker-templates/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Preview Sticker Template `GET https://api-stage.guidelab.co/sticker-templates/{id}/preview` Generate a preview of a sticker template with sample variables substituted. Returns processed template data ready for rendering. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/previewStickerTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Sticker template preview with sample variables applied - `template` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `width` (string) **(required)**: - `height` (string) **(required)**: - `templateData` (object) **(required)**: - `basePdf` (object) **(required)**: - `schemas` (array[]) **(required)**: - `sampledata` (object[]): - `previewImageKey` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `sampleVariables` (object) **(required)**: ### 404: Template not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/sticker-templates/{id}/preview" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Sticker Template Preview Image `GET https://api-stage.guidelab.co/sticker-templates/{id}/preview-image` Serve the managed preview image for a sticker template. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/getStickerTemplatePreviewImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Sticker preview image binary ### 404: Template or preview image not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/sticker-templates/{id}/preview-image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload Sticker Template Preview Image `POST https://api-stage.guidelab.co/sticker-templates/{id}/preview-image` Upload or replace a sticker template preview image. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/uploadStickerTemplatePreviewImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Preview image attached - `previewImageKey` (string) **(required)**: ### 400: Invalid image ### 404: Template not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/sticker-templates/{id}/preview-image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Sticker Template Preview Image `DELETE https://api-stage.guidelab.co/sticker-templates/{id}/preview-image` Detach a sticker preview image and queue its object deletion. Documentation: https://docs.guidelab.co/api-reference/sticker-templates/deleteStickerTemplatePreviewImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Preview image removed - `success` (boolean) **(required)**: ### 404: Template or preview image not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/sticker-templates/{id}/preview-image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get pickup request settings `GET https://api-stage.guidelab.co/pickup-requests/settings` Retrieve pickup request form settings for the current lab, including whether the form is enabled and thank-you message configuration. Lab only. Documentation: https://docs.guidelab.co/api-reference/pickup-requests/getPickupRequestSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Pickup request settings with form-enabled status and thank-you messages - `settings` (object) **(required)**: - `id` (string,null) **(required)**: - `labId` (string) **(required)**: - `formEnabled` (boolean) **(required)**: - `thankYouTitle` (string) **(required)**: - `thankYouMessage` (string) **(required)**: - `createdAt` (string,null) **(required)**: - `updatedAt` (string,null) **(required)**: ### 401: Unauthorized ### 403: Forbidden - lab only ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/pickup-requests/settings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update pickup request settings `PUT https://api-stage.guidelab.co/pickup-requests/settings` Update pickup request form settings. Creates default settings if none exist. Supports partial updates. Lab only. Documentation: https://docs.guidelab.co/api-reference/pickup-requests/updatePickupRequestSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `formEnabled` (boolean): - `thankYouTitle` (string): - `thankYouMessage` (string): ## Responses ### 200: Updated pickup request settings - `settings` (object): ### 400: Invalid request body ### 401: Unauthorized ### 403: Forbidden - lab only ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/pickup-requests/settings" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "formEnabled": true, "thankYouTitle": "string", "thankYouMessage": "string" }' ``` --- # List pickup form elements `GET https://api-stage.guidelab.co/pickup-requests/elements` Retrieve paginated form elements for the pickup request form. Elements are ordered by sortOrder. Optionally includes inactive elements. Lab only. Documentation: https://docs.guidelab.co/api-reference/pickup-requests/listPickupFormElements ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` () (in: query): Default: `false` - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `50` ## Responses ### 200: Ordered list of form elements - `elements` (array) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized ### 403: Forbidden - lab only ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/pickup-requests/elements" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a pickup form element `POST https://api-stage.guidelab.co/pickup-requests/elements` Add a new form element to the pickup request form. If no sortOrder is specified, it will be appended at the end. Lab only. Documentation: https://docs.guidelab.co/api-reference/pickup-requests/createPickupFormElement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `elementType` (string) **(required)**: Values: `header`, `subheader`, `text`, `textarea`, `address`, `email`, `phone`, `date`, `checkbox` - `label` (string) **(required)**: - `placeholder` (string): - `helpText` (string): - `isRequired` (boolean): (default: `false`) - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Form element created - `element` (object): ### 400: Invalid request body ### 401: Unauthorized ### 403: Forbidden - lab only ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/pickup-requests/elements" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "elementType": "header", "label": "string" }' ``` --- # Reorder pickup form elements `PUT https://api-stage.guidelab.co/pickup-requests/elements/reorder` Update the sort order of multiple form elements in a single request. All referenced elements must belong to the current lab. Lab only. Documentation: https://docs.guidelab.co/api-reference/pickup-requests/reorderPickupFormElements ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `items` (object[]) **(required)**: - `id` (string) **(required)**: - `sortOrder` (integer) **(required)**: ## Responses ### 200: Form elements reordered successfully - `success` (boolean) **(required)**: ### 400: Some elements not found or do not belong to this lab ### 401: Unauthorized ### 403: Forbidden - lab only ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/pickup-requests/elements/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "items": [ { "id": "string", "sortOrder": 0 } ] }' ``` --- # Get a pickup form element by ID `GET https://api-stage.guidelab.co/pickup-requests/elements/{id}` Retrieve a single form element by its ID. Must belong to the current lab. Lab only. Documentation: https://docs.guidelab.co/api-reference/pickup-requests/getPickupFormElement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Form element details - `element` (object): ### 401: Unauthorized ### 403: Forbidden - lab only ### 404: Element not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/pickup-requests/elements/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Deactivate a pickup form element `DELETE https://api-stage.guidelab.co/pickup-requests/elements/{id}` Soft-delete a form element by setting it to inactive. The element remains in the database but will not appear in active element lists. Lab only. Documentation: https://docs.guidelab.co/api-reference/pickup-requests/deletePickupFormElement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Form element deactivated - `element` (object): ### 401: Unauthorized ### 403: Forbidden - lab only ### 404: Element not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/pickup-requests/elements/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a pickup form element `PUT https://api-stage.guidelab.co/pickup-requests/elements/{id}` Update one or more fields of a form element. Supports partial updates. Must belong to the current lab. Lab only. Documentation: https://docs.guidelab.co/api-reference/pickup-requests/updatePickupFormElement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `elementType` (string): Values: `header`, `subheader`, `text`, `textarea`, `address`, `email`, `phone`, `date`, `checkbox` - `label` (string): - `placeholder` (string): - `helpText` (string): - `isRequired` (boolean): (default: `false`) - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 200: Updated form element - `element` (object): ### 400: Invalid request body ### 401: Unauthorized ### 403: Forbidden - lab only ### 404: Element not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/pickup-requests/elements/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Get the current pickup form for an active partnership `GET https://api-stage.guidelab.co/pickup-requests/form/{partnershipId}` Documentation: https://docs.guidelab.co/api-reference/pickup-requests/getClinicPickupRequestForm ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `partnershipId` (string) **(required)** (in: path): ## Responses ### 200: Current immutable form revision - `formRevisionId` (string) **(required)**: - `revision` (integer) **(required)**: - `definition` (object[]) **(required)**: - `thankYouTitle` (string) **(required)**: - `thankYouMessage` (string) **(required)**: ### 401: Unauthorized ### 403: Clinic partnership access required ### 404: Pickup form not found ### 409: Pickup requests are disabled or not yet published ## Example ```bash curl -X GET "https://api-stage.guidelab.co/pickup-requests/form/{partnershipId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List pickup requests visible to the current organization `GET https://api-stage.guidelab.co/pickup-requests` Documentation: https://docs.guidelab.co/api-reference/pickup-requests/listPickupRequests ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `status` (string) (in: query): Values: `requested`, `scheduled`, `en_route`, `needs_reschedule`, `collected`, `cancelled` - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `50` ## Responses ### 200: Pickup requests - `requests` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `clinicId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `formRevisionId` (string) **(required)**: - `status` (string) **(required)**: - `formData` (object) **(required)**: - `requestedWindowStart` (string) **(required)**: - `requestedWindowEnd` (string) **(required)**: - `requestedTimezone` (string) **(required)**: - `scheduledWindowStart` (string,null) **(required)**: - `scheduledWindowEnd` (string,null) **(required)**: - `scheduledTimezone` (string,null) **(required)**: - `addressId` (string,null) **(required)**: - `addressSnapshot` (object) **(required)**: - `label` (string,null): - `contactName` (string,null): - `contactPhone` (string,null): - `addressLine1` (string) **(required)**: - `addressLine2` (string,null): - `city` (string) **(required)**: - `state` (string,null): - `postcode` (string) **(required)**: - `country` (string) **(required)**: - `requestedByMemberId` (string) **(required)**: - `assignedMemberId` (string,null) **(required)**: - `assignedExternalName` (string,null) **(required)**: - `assignedExternalPhone` (string,null) **(required)**: - `assignedExternalEmail` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `internalNotes` (string,null) **(required)**: - `collectedAt` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `page` (integer) **(required)**: - `limit` (integer) **(required)**: ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/pickup-requests" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a pickup request as a partner clinic `POST https://api-stage.guidelab.co/pickup-requests` Documentation: https://docs.guidelab.co/api-reference/pickup-requests/createPickupRequest ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `partnershipId` (string) **(required)**: - `formRevisionId` (string) **(required)**: - `commandId` (string) **(required)**: - `formData` (object): (default: `[object Object]`) - `requestedWindow` (object) **(required)**: - `start` (string) **(required)**: - `end` (string) **(required)**: - `timezone` (string) **(required)**: - `address` (object) **(required)**: - `orderIds` (string[]): (default: ``) - `notes` (string,null): ## Responses ### 200: Idempotently replayed pickup request - `request` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `clinicId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `formRevisionId` (string) **(required)**: - `status` (string) **(required)**: - `formData` (object) **(required)**: - `requestedWindowStart` (string) **(required)**: - `requestedWindowEnd` (string) **(required)**: - `requestedTimezone` (string) **(required)**: - `scheduledWindowStart` (string,null) **(required)**: - `scheduledWindowEnd` (string,null) **(required)**: - `scheduledTimezone` (string,null) **(required)**: - `addressId` (string,null) **(required)**: - `addressSnapshot` (object) **(required)**: - `label` (string,null): - `contactName` (string,null): - `contactPhone` (string,null): - `addressLine1` (string) **(required)**: - `addressLine2` (string,null): - `city` (string) **(required)**: - `state` (string,null): - `postcode` (string) **(required)**: - `country` (string) **(required)**: - `requestedByMemberId` (string) **(required)**: - `assignedMemberId` (string,null) **(required)**: - `assignedExternalName` (string,null) **(required)**: - `assignedExternalPhone` (string,null) **(required)**: - `assignedExternalEmail` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `internalNotes` (string,null) **(required)**: - `collectedAt` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 201: Pickup request created - `request` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `clinicId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `formRevisionId` (string) **(required)**: - `status` (string) **(required)**: - `formData` (object) **(required)**: - `requestedWindowStart` (string) **(required)**: - `requestedWindowEnd` (string) **(required)**: - `requestedTimezone` (string) **(required)**: - `scheduledWindowStart` (string,null) **(required)**: - `scheduledWindowEnd` (string,null) **(required)**: - `scheduledTimezone` (string,null) **(required)**: - `addressId` (string,null) **(required)**: - `addressSnapshot` (object) **(required)**: - `label` (string,null): - `contactName` (string,null): - `contactPhone` (string,null): - `addressLine1` (string) **(required)**: - `addressLine2` (string,null): - `city` (string) **(required)**: - `state` (string,null): - `postcode` (string) **(required)**: - `country` (string) **(required)**: - `requestedByMemberId` (string) **(required)**: - `assignedMemberId` (string,null) **(required)**: - `assignedExternalName` (string,null) **(required)**: - `assignedExternalPhone` (string,null) **(required)**: - `assignedExternalEmail` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `internalNotes` (string,null) **(required)**: - `collectedAt` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid form, address, window, or orders ### 401: Unauthorized ### 403: Clinic partnership access required ### 404: Partnership, form revision, or location not found ### 409: Pickup form disabled or idempotency conflict ## Example ```bash curl -X POST "https://api-stage.guidelab.co/pickup-requests" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "partnershipId": "string", "formRevisionId": "string", "commandId": "string", "requestedWindow": { "start": "string", "end": "string", "timezone": "string" }, "address": "string" }' ``` --- # Get a pickup request and its immutable history `GET https://api-stage.guidelab.co/pickup-requests/{id}` Documentation: https://docs.guidelab.co/api-reference/pickup-requests/getPickupRequest ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Pickup request detail - `request` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `clinicId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `formRevisionId` (string) **(required)**: - `status` (string) **(required)**: - `formData` (object) **(required)**: - `requestedWindowStart` (string) **(required)**: - `requestedWindowEnd` (string) **(required)**: - `requestedTimezone` (string) **(required)**: - `scheduledWindowStart` (string,null) **(required)**: - `scheduledWindowEnd` (string,null) **(required)**: - `scheduledTimezone` (string,null) **(required)**: - `addressId` (string,null) **(required)**: - `addressSnapshot` (object) **(required)**: - `label` (string,null): - `contactName` (string,null): - `contactPhone` (string,null): - `addressLine1` (string) **(required)**: - `addressLine2` (string,null): - `city` (string) **(required)**: - `state` (string,null): - `postcode` (string) **(required)**: - `country` (string) **(required)**: - `requestedByMemberId` (string) **(required)**: - `assignedMemberId` (string,null) **(required)**: - `assignedExternalName` (string,null) **(required)**: - `assignedExternalPhone` (string,null) **(required)**: - `assignedExternalEmail` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `internalNotes` (string,null) **(required)**: - `collectedAt` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `orderIds` (string[]) **(required)**: - `attempts` (object[]) **(required)**: - `id` (string) **(required)**: - `attemptNumber` (integer) **(required)**: - `outcome` (string) **(required)**: - `notes` (string,null) **(required)**: - `attemptedAt` (string) **(required)**: - `events` (object[]) **(required)**: - `id` (string) **(required)**: - `sequence` (integer) **(required)**: - `eventType` (string) **(required)**: - `fromStatus` (string,null) **(required)**: - `toStatus` (string,null) **(required)**: - `payload` (object) **(required)**: - `createdAt` (string) **(required)**: ### 401: Unauthorized ### 404: Pickup request not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/pickup-requests/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Edit a clinic pickup request before it is scheduled `PUT https://api-stage.guidelab.co/pickup-requests/{id}` Documentation: https://docs.guidelab.co/api-reference/pickup-requests/updateRequestedPickup ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `commandId` (string) **(required)**: - `formData` (object): - `requestedWindow` (object): - `start` (string) **(required)**: - `end` (string) **(required)**: - `timezone` (string) **(required)**: - `address` (object): - `orderIds` (string[]): - `notes` (string,null): ## Responses ### 200: Updated or idempotently replayed pickup request - `request` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `clinicId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `formRevisionId` (string) **(required)**: - `status` (string) **(required)**: - `formData` (object) **(required)**: - `requestedWindowStart` (string) **(required)**: - `requestedWindowEnd` (string) **(required)**: - `requestedTimezone` (string) **(required)**: - `scheduledWindowStart` (string,null) **(required)**: - `scheduledWindowEnd` (string,null) **(required)**: - `scheduledTimezone` (string,null) **(required)**: - `addressId` (string,null) **(required)**: - `addressSnapshot` (object) **(required)**: - `label` (string,null): - `contactName` (string,null): - `contactPhone` (string,null): - `addressLine1` (string) **(required)**: - `addressLine2` (string,null): - `city` (string) **(required)**: - `state` (string,null): - `postcode` (string) **(required)**: - `country` (string) **(required)**: - `requestedByMemberId` (string) **(required)**: - `assignedMemberId` (string,null) **(required)**: - `assignedExternalName` (string,null) **(required)**: - `assignedExternalPhone` (string,null) **(required)**: - `assignedExternalEmail` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `internalNotes` (string,null) **(required)**: - `collectedAt` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid form, address, window, or orders ### 401: Unauthorized ### 403: Clinic access required ### 404: Pickup request not found ### 409: Request is scheduled or command conflicts ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/pickup-requests/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "commandId": "string", "formData": {}, "requestedWindow": { "start": "string", "end": "string", "timezone": "string" }, "address": "string", "orderIds": [ "string" ], "notes": "string" }' ``` --- # Schedule, assign, route, collect, reschedule, or cancel a pickup `POST https://api-stage.guidelab.co/pickup-requests/{id}/commands` Documentation: https://docs.guidelab.co/api-reference/pickup-requests/commandPickupRequest ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` ## Responses ### 200: Command applied or idempotently replayed - `request` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `clinicId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `formRevisionId` (string) **(required)**: - `status` (string) **(required)**: - `formData` (object) **(required)**: - `requestedWindowStart` (string) **(required)**: - `requestedWindowEnd` (string) **(required)**: - `requestedTimezone` (string) **(required)**: - `scheduledWindowStart` (string,null) **(required)**: - `scheduledWindowEnd` (string,null) **(required)**: - `scheduledTimezone` (string,null) **(required)**: - `addressId` (string,null) **(required)**: - `addressSnapshot` (object) **(required)**: - `label` (string,null): - `contactName` (string,null): - `contactPhone` (string,null): - `addressLine1` (string) **(required)**: - `addressLine2` (string,null): - `city` (string) **(required)**: - `state` (string,null): - `postcode` (string) **(required)**: - `country` (string) **(required)**: - `requestedByMemberId` (string) **(required)**: - `assignedMemberId` (string,null) **(required)**: - `assignedExternalName` (string,null) **(required)**: - `assignedExternalPhone` (string,null) **(required)**: - `assignedExternalEmail` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `internalNotes` (string,null) **(required)**: - `collectedAt` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid command ### 401: Unauthorized ### 403: Lab access required ### 404: Pickup request or assignee not found ### 409: Stale status or idempotency conflict ## Example ```bash curl -X POST "https://api-stage.guidelab.co/pickup-requests/{id}/commands" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '"string"' ``` --- # Record a pickup attempt `POST https://api-stage.guidelab.co/pickup-requests/{id}/attempts` Documentation: https://docs.guidelab.co/api-reference/pickup-requests/createPickupAttempt ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `commandId` (string) **(required)**: - `outcome` (string) **(required)**: Values: `collected`, `no_answer`, `not_ready`, `address_issue`, `other` - `notes` (string,null): - `attemptedAt` (string): ## Responses ### 200: Attempt recorded or idempotently replayed - `request` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `clinicId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `formRevisionId` (string) **(required)**: - `status` (string) **(required)**: - `formData` (object) **(required)**: - `requestedWindowStart` (string) **(required)**: - `requestedWindowEnd` (string) **(required)**: - `requestedTimezone` (string) **(required)**: - `scheduledWindowStart` (string,null) **(required)**: - `scheduledWindowEnd` (string,null) **(required)**: - `scheduledTimezone` (string,null) **(required)**: - `addressId` (string,null) **(required)**: - `addressSnapshot` (object) **(required)**: - `label` (string,null): - `contactName` (string,null): - `contactPhone` (string,null): - `addressLine1` (string) **(required)**: - `addressLine2` (string,null): - `city` (string) **(required)**: - `state` (string,null): - `postcode` (string) **(required)**: - `country` (string) **(required)**: - `requestedByMemberId` (string) **(required)**: - `assignedMemberId` (string,null) **(required)**: - `assignedExternalName` (string,null) **(required)**: - `assignedExternalPhone` (string,null) **(required)**: - `assignedExternalEmail` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `internalNotes` (string,null) **(required)**: - `collectedAt` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `attempt` (object) **(required)**: - `id` (string) **(required)**: - `attemptNumber` (integer) **(required)**: - `outcome` (string) **(required)**: - `notes` (string,null) **(required)**: - `attemptedAt` (string) **(required)**: ### 401: Unauthorized ### 403: Lab access required ### 404: Pickup request not found ### 409: Pickup is not en route or command conflicts ## Example ```bash curl -X POST "https://api-stage.guidelab.co/pickup-requests/{id}/attempts" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "commandId": "string", "outcome": "collected", "notes": "string", "attemptedAt": "string" }' ``` --- # List Email Templates `GET https://api-stage.guidelab.co/email-templates` List email templates for the current lab with filtering by category, search, and pagination. Supports including inactive templates. Documentation: https://docs.guidelab.co/api-reference/email-templates/listEmailTemplates ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `category` (string) (in: query): Values: `general`, `order`, `invoice`, `shipment`, `notification`, `marketing` - `includeInactive` () (in: query): - `search` (string) (in: query): - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `50` ## Responses ### 200: Paginated list of email templates - `templates` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `subject` (string) **(required)**: - `description` (string,null) **(required)**: - `designJson` (object) **(required)**: - `body` (object) **(required)**: - `rows` (array) **(required)**: - `counters` (object): - `htmlContent` (string) **(required)**: - `category` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: ### 400: Invalid query parameters ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/email-templates" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Email Template `POST https://api-stage.guidelab.co/email-templates` Create a new email template with design JSON and HTML content. Supports categorization (general, order, invoice, shipment, notification, marketing). Documentation: https://docs.guidelab.co/api-reference/email-templates/createEmailTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `subject` (string) **(required)**: - `description` (string): - `designJson` (object) **(required)**: - `body` (object) **(required)**: - `rows` (array) **(required)**: - `counters` (object): - `htmlContent` (string) **(required)**: - `category` (string): (default: `general`) Values: `general`, `order`, `invoice`, `shipment`, `notification`, `marketing` - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Newly created email template - `template` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `subject` (string) **(required)**: - `description` (string,null) **(required)**: - `designJson` (object) **(required)**: - `body` (object) **(required)**: - `rows` (array) **(required)**: - `counters` (object): - `htmlContent` (string) **(required)**: - `category` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/email-templates" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "subject": "string", "designJson": { "body": { "rows": [ "string" ] }, "counters": {} }, "htmlContent": "string" }' ``` --- # Get Email Template `GET https://api-stage.guidelab.co/email-templates/{id}` Retrieve a single email template by ID, including its full design JSON and HTML content. Documentation: https://docs.guidelab.co/api-reference/email-templates/getEmailTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Email template details - `template` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `subject` (string) **(required)**: - `description` (string,null) **(required)**: - `designJson` (object) **(required)**: - `body` (object) **(required)**: - `rows` (array) **(required)**: - `counters` (object): - `htmlContent` (string) **(required)**: - `category` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 404: Email template not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/email-templates/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Email Template `DELETE https://api-stage.guidelab.co/email-templates/{id}` Soft-delete an email template by marking it as inactive. The template remains in the database for historical reference. Documentation: https://docs.guidelab.co/api-reference/email-templates/deleteEmailTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Email template deactivated - `success` (boolean) **(required)**: ### 404: Email template not found ### 409: Template is used by an active production task ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/email-templates/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Email Template `PUT https://api-stage.guidelab.co/email-templates/{id}` Update an existing email template's name, subject, content, category, or other properties. Documentation: https://docs.guidelab.co/api-reference/email-templates/updateEmailTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `name` (string): - `subject` (string): - `description` (string): - `designJson` (object): - `body` (object) **(required)**: - `rows` (array) **(required)**: - `counters` (object): - `htmlContent` (string): - `category` (string): (default: `general`) Values: `general`, `order`, `invoice`, `shipment`, `notification`, `marketing` - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 200: Successfully updated email template - `template` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `subject` (string) **(required)**: - `description` (string,null) **(required)**: - `designJson` (object) **(required)**: - `body` (object) **(required)**: - `rows` (array) **(required)**: - `counters` (object): - `htmlContent` (string) **(required)**: - `category` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 404: Email template not found ### 409: Template is used by an active production task ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/email-templates/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Get Scanner Settings `GET https://api-stage.guidelab.co/scanner-settings` Retrieve scanner settings for the current organization, including auto-pool case amount, disconnection email preferences, and folder paths. Documentation: https://docs.guidelab.co/api-reference/scanner-settings/getScannerSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Scanner settings for the current organization - `settings` (object) **(required)**: - `id` (string,null) **(required)**: - `organizationId` (string) **(required)**: - `autoPoolCaseAmount` (number) **(required)**: - `sendDisconnectionEmail` (boolean) **(required)**: - `disconnectionEmailRecipients` (string[]) **(required)**: - `newOrderFolderPath` (string,null) **(required)**: - `existingOrderFolderPath` (string,null) **(required)**: - `useScanhubLite` (boolean) **(required)**: - `createdAt` (string,null) **(required)**: - `updatedAt` (string,null) **(required)**: ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/scanner-settings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Scanner Settings `PUT https://api-stage.guidelab.co/scanner-settings` Update scanner settings for the current organization. Creates default settings if none exist (upsert). Controls auto-pool amount, disconnection emails, folder paths, and ScanHub Lite mode. Documentation: https://docs.guidelab.co/api-reference/scanner-settings/updateScannerSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `autoPoolCaseAmount` (integer,null): - `sendDisconnectionEmail` (boolean): - `disconnectionEmailRecipients` (string[]): - `newOrderFolderPath` (string,null): - `existingOrderFolderPath` (string,null): - `useScanhubLite` (boolean): ## Responses ### 200: Successfully updated scanner settings - `settings` (object) **(required)**: - `id` (string,null) **(required)**: - `organizationId` (string) **(required)**: - `autoPoolCaseAmount` (number) **(required)**: - `sendDisconnectionEmail` (boolean) **(required)**: - `disconnectionEmailRecipients` (string[]) **(required)**: - `newOrderFolderPath` (string,null) **(required)**: - `existingOrderFolderPath` (string,null) **(required)**: - `useScanhubLite` (boolean) **(required)**: - `createdAt` (string,null) **(required)**: - `updatedAt` (string,null) **(required)**: ### 400: Invalid request body ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/scanner-settings" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "autoPoolCaseAmount": "string", "sendDisconnectionEmail": true, "disconnectionEmailRecipients": [ "string" ], "newOrderFolderPath": "string", "existingOrderFolderPath": "string", "useScanhubLite": true }' ``` --- # List Scanner Connections `GET https://api-stage.guidelab.co/scanner-connections` List all scanner connections for the current organization. Optionally filter by scanner type and include inactive connections. Includes Medit group metadata when available. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/listScannerConnections ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` () (in: query): - `scannerType` (string) (in: query): Values: `3shape`, `itero`, `medit` ## Responses ### 200: List of scanner connections with metadata - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `scannerType` (string) **(required)**: - `name` (string) **(required)**: - `connectionStatus` (string) **(required)**: - `statusMessage` (string,null) **(required)**: - `testMode` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `lastConnectedAt` (string,null) **(required)**: - `lastSyncAt` (string,null) **(required)**: - `meditGroupName` (string,null) **(required)**: - `meditGroupType` (string,null) **(required)**: ### 400: Invalid query parameters ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/scanner-connections" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Scanner Connection `POST https://api-stage.guidelab.co/scanner-connections` Create a new scanner connection for the organization. Supports the implemented Medit, 3Shape, and iTero providers. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/createScannerConnection ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `scannerType` (string) **(required)**: Values: `3shape`, `itero`, `medit` - `name` (string) **(required)**: - `testMode` (boolean): (default: `false`) - `sortOrder` (integer): (default: `0`) ## Responses ### 201: Newly created scanner connection - `connection` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `scannerType` (string) **(required)**: - `name` (string) **(required)**: - `connectionStatus` (string) **(required)**: - `statusMessage` (string,null) **(required)**: - `testMode` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `lastConnectedAt` (string,null) **(required)**: - `lastSyncAt` (string,null) **(required)**: ### 400: Invalid request body ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scanner-connections" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "scannerType": "3shape", "name": "string", "testMode": true, "sortOrder": 0 }' ``` --- # Handle Medit O Auth Callback `GET https://api-stage.guidelab.co/scanner-connections/medit/callback` Handle the Medit OAuth callback after user authorization. Exchanges the authorization code for tokens, stores encrypted credentials, and redirects to scanner settings. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/handleMeditOAuthCallback ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 302: Redirect to scanner settings page after OAuth flow ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/scanner-connections/medit/callback" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Handle Itero O Auth Callback `GET https://api-stage.guidelab.co/scanner-connections/itero/callback` Handle the iTero OAuth callback after user authorization. Exchanges the authorization code for tokens, discovers the API region, and pairs the account if a single unpaired account is found. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/handleIteroOAuthCallback ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 302: Redirect to scanner settings page after OAuth flow ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/scanner-connections/itero/callback" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Handle3 Shape O Auth Callback `GET https://api-stage.guidelab.co/scanner-connections/3shape/callback` Handle the 3Shape OAuth callback after user authorization. Exchanges the code using PKCE, stores encrypted tokens, and discovers active regions. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/handle3ShapeOAuthCallback ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 302: Redirect to scanner settings page after OAuth flow ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/scanner-connections/3shape/callback" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Scanner Connection `GET https://api-stage.guidelab.co/scanner-connections/{id}` Retrieve a single scanner connection by ID, including scanner-type-specific metadata (e.g. Medit group info). Documentation: https://docs.guidelab.co/api-reference/scanner-connections/getScannerConnection ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Scanner connection details with metadata - `connection` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `scannerType` (string) **(required)**: - `name` (string) **(required)**: - `connectionStatus` (string) **(required)**: - `statusMessage` (string,null) **(required)**: - `testMode` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `lastConnectedAt` (string,null) **(required)**: - `lastSyncAt` (string,null) **(required)**: - `meditGroupName` (string,null) **(required)**: - `meditGroupType` (string,null) **(required)**: ### 404: Connection not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/scanner-connections/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Scanner Connection `DELETE https://api-stage.guidelab.co/scanner-connections/{id}` Soft-delete a scanner connection by marking it as inactive. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/deleteScannerConnection ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Scanner connection deactivated - `success` (boolean) **(required)**: ### 404: Connection not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/scanner-connections/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Scanner Connection `PUT https://api-stage.guidelab.co/scanner-connections/{id}` Update a scanner connection's name, test mode, sort order, or active status. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/updateScannerConnection ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `name` (string): - `testMode` (boolean): - `sortOrder` (integer): - `isActive` (boolean): ## Responses ### 200: Successfully updated scanner connection - `connection` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `scannerType` (string) **(required)**: - `name` (string) **(required)**: - `connectionStatus` (string) **(required)**: - `statusMessage` (string,null) **(required)**: - `testMode` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `lastConnectedAt` (string,null) **(required)**: - `lastSyncAt` (string,null) **(required)**: ### 400: Invalid request body ### 404: Connection not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/scanner-connections/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "testMode": true, "sortOrder": 0, "isActive": true }' ``` --- # Disconnect Scanner Connection `POST https://api-stage.guidelab.co/scanner-connections/{id}/disconnect` Disconnect a scanner connection by removing stored tokens and scanner-specific data. For iTero, attempts to unpair the account first. Resets connection status to disconnected. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/disconnectScannerConnection ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Scanner connection successfully disconnected - `success` (boolean) **(required)**: - `connection` (object): - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `scannerType` (string) **(required)**: - `name` (string) **(required)**: - `connectionStatus` (string) **(required)**: - `statusMessage` (string,null) **(required)**: - `testMode` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `lastConnectedAt` (string,null) **(required)**: - `lastSyncAt` (string,null) **(required)**: ### 404: Connection not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scanner-connections/{id}/disconnect" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Test Scanner Connection `POST https://api-stage.guidelab.co/scanner-connections/{id}/test` Test a scanner connection by attempting an API call to the scanner provider. Supports Medit, 3Shape, and iTero. Updates connection status based on the test result. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/testScannerConnection ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Test result with success status and scanner details - `success` (boolean) **(required)**: - `message` (string): - `details` (object): ### 404: Connection not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scanner-connections/{id}/test" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Sync Scanner Connection `POST https://api-stage.guidelab.co/scanner-connections/{id}/sync` Trigger a data sync for a scanner connection. Fetches the latest cases/orders from the scanner provider (Medit, 3Shape, or iTero) and updates the last sync timestamp. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/syncScannerConnection ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Sync result with fetched data - `success` (boolean) **(required)**: - `data` (object): - `syncedAt` (string) **(required)**: ### 400: Scanner not connected or sync not supported ### 404: Connection not found ### 429: Scanner sync budget exceeded ### 500: Sync failed ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scanner-connections/{id}/sync" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Scanner Connection Cases `GET https://api-stage.guidelab.co/scanner-connections/{id}/cases` Operationally list cases/orders from a scanner connection with pagination, search, and date range filtering. Provider access may idempotently refresh an expired token and record connection health; this endpoint is not a tenant-settings inspection read. Supports Medit, 3Shape, and iTero scanners. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/listScannerConnectionCases ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Paginated list of scanner cases/orders ### 400: Scanner not connected or invalid query parameters ### 401: Unauthorized or token expired ### 404: Connection not found ### 500: Internal server error ### 502: Regional discovery failed ## Example ```bash curl -X GET "https://api-stage.guidelab.co/scanner-connections/{id}/cases" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Scanner Connection Case `GET https://api-stage.guidelab.co/scanner-connections/{id}/cases/{caseId}` Operationally retrieve detailed information about a specific scanner case/order. Provider access may idempotently refresh an expired token and record connection health; this endpoint is not a tenant-settings inspection read. Supports Medit, 3Shape (searches all active regions), and iTero scanners. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/getScannerConnectionCase ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `caseId` (string) **(required)** (in: path): ## Responses ### 200: Scanner case details from the provider ### 400: Scanner not connected ### 401: Unauthorized or token expired ### 404: Connection or case not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/scanner-connections/{id}/cases/{caseId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Import Scanner Case `POST https://api-stage.guidelab.co/scanner-connections/{id}/import-case` Import a 3Shape case as a new order. Creates the order, patient (if needed), order items from model elements, and downloads attachments to R2 storage. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/importScannerCase ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `caseId` (string) **(required)**: - `regionId` (integer) **(required)**: - `labId` (string) **(required)**: - `clinicId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `patientId` (string): ## Responses ### 201: Imported case with order ID, patient, items, and file counts - `orderId` (string) **(required)**: - `orderNumber` (string) **(required)**: - `patientId` (string,null) **(required)**: - `orderItemCount` (number) **(required)**: - `fileCount` (number) **(required)**: - `threeshapeCaseId` (string) **(required)**: - `threeshapeOrderNo` (string,null) **(required)**: ### 400: Invalid request body ### 401: Unauthorized or token expired ### 404: 3Shape connection not found ### 409: Scanner case has a conflicting destination or an attachment import is already in progress ### 422: Scanner case exceeds a local import safety limit ### 429: Scanner import rate limit exceeded ### 500: Internal server error ### 503: One or more scanner attachments remain pending ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scanner-connections/{id}/import-case" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "caseId": "string", "regionId": 0, "labId": "string", "clinicId": "string", "partnershipId": "string", "patientId": "string" }' ``` --- # Import Scanner Files `POST https://api-stage.guidelab.co/scanner-connections/{id}/import-files` Import files from a scanner case into an existing order. Downloads files from the scanner provider (Medit, 3Shape, or iTero) and uploads them to R2 storage. Optionally creates scan inbox items. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/importScannerFiles ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` ## Responses ### 200: Import results with success and error counts - `success` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `type` (string) **(required)**: - `mimeType` (string) **(required)**: - `size` (number) **(required)**: - `url` (string) **(required)**: - `thumbnailUrl` (string,null) **(required)**: - `orderId` (string) **(required)**: - `patientId` (string,null) **(required)**: - `fileRequirementId` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `errors` (object[]) **(required)**: - `fileId` (string) **(required)**: - `fileName` (string) **(required)**: - `error` (string) **(required)**: ### 400: Invalid request body or scanner not connected ### 401: Unauthorized or token expired ### 404: Connection, order, or import destination not found ### 409: Provider file has a conflicting destination or its import is already in progress ### 429: Scanner import rate limit exceeded ### 500: Internal server error ### 502: Scanner provider returned inconsistent data ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scanner-connections/{id}/import-files" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '"string"' ``` --- # Initiate Scanner O Auth `POST https://api-stage.guidelab.co/scanner-connections/{id}/oauth/authorize` Initiate the OAuth authorization flow for a scanner connection. Returns the provider-specific authorization URL. Supports Medit, 3Shape (with PKCE), and iTero. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/initiateScannerOAuth ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: OAuth authorization URL to redirect the user to - `url` (string) **(required)**: ### 400: OAuth not supported for this scanner type ### 401: Unauthorized ### 404: Connection not found ### 500: Scanner credentials not configured ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scanner-connections/{id}/oauth/authorize" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Itero Related Accounts `GET https://api-stage.guidelab.co/scanner-connections/{id}/related-accounts` List related iTero accounts available for pairing. Only available for iTero scanner connections that have completed OAuth authentication. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/listIteroRelatedAccounts ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: List of iTero accounts available for pairing - `accounts` (object[]) **(required)**: ### 400: Not an iTero connection or not authenticated ### 404: Connection not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/scanner-connections/{id}/related-accounts" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Pair Itero Account `POST https://api-stage.guidelab.co/scanner-connections/{id}/pair-account` Pair an iTero account with this scanner connection and store the paired tokens. Marks the connection as connected upon success. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/pairIteroAccount ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Account successfully paired - `success` (boolean) **(required)**: - `accountId` (number) **(required)**: - `accountName` (string) **(required)**: ### 400: Not an iTero connection, not authenticated, or invalid request ### 404: Connection not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scanner-connections/{id}/pair-account" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Setup Medit Webhook `POST https://api-stage.guidelab.co/scanner-connections/{id}/webhook-setup` Set up a Medit webhook endpoint for receiving real-time notifications about orders, cases, and files. Replaces any existing webhook endpoint for this connection. Documentation: https://docs.guidelab.co/api-reference/scanner-connections/setupMeditWebhook ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Webhook registered successfully with endpoint details - `success` (boolean) **(required)**: - `message` (string) **(required)**: - `details` (object) **(required)**: - `endpointUuid` (string) **(required)**: - `events` (string[]) **(required)**: - `url` (string) **(required)**: ### 400: Not a Medit connection or not authorized ### 404: Connection not found ### 500: Failed to set up webhook ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scanner-connections/{id}/webhook-setup" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Whats App Templates `GET https://api-stage.guidelab.co/whatsapp-templates` List WhatsApp message templates for the current organization with pagination, search, and status filtering. Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates/listWhatsAppTemplates ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `search` (string) (in: query): - `status` (string) (in: query): Values: `draft`, `pending`, `approved`, `rejected` ## Responses ### 200: Paginated list of WhatsApp templates - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `displayName` (string) **(required)**: - `description` (string,null) **(required)**: - `language` (string) **(required)**: - `category` (string) **(required)**: - `contentType` (string) **(required)**: - `body` (string) **(required)**: - `variables` (object,null) **(required)**: - `status` (string) **(required)**: - `contentSid` (string,null) **(required)**: - `rejectionReason` (string,null) **(required)**: - `lastSyncedAt` (string,null) **(required)**: - `lastSyncError` (string,null) **(required)**: - `usageCount` (number,null) **(required)**: Deprecated compatibility count; advances only for provider-accepted custom-template sends. Prefer successfulSendCount. - `successfulSendCount` (number) **(required)**: - `providerScope` (string) **(required)**: Values: `unbound`, `platform_legacy`, `lab_account` - `accountState` (string) **(required)**: Values: `unbound`, `platform`, `connected`, `disconnected`, `changed` - `providerOperation` (object,null) **(required)**: - `id` (string) **(required)**: - `phase` (string) **(required)**: Values: `ready_create`, `create_ambiguous`, `ready_submit`, `ready_delete`, `manual_review` - `state` (string) **(required)**: Values: `pending`, `manual_review` - `compatibleEvents` (string[]) **(required)**: - `selectedEvents` (string[]) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/whatsapp-templates" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Whats App Template `POST https://api-stage.guidelab.co/whatsapp-templates` Create a new WhatsApp message template in draft status. The template name is auto-prefixed with the organization slug. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates/createWhatsAppTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `nameSuffix` (string) **(required)**: - `displayName` (string) **(required)**: - `description` (string): - `language` (string): (default: `en`) - `category` (string): (default: `UTILITY`) Values: `UTILITY`, `MARKETING`, `AUTHENTICATION` - `body` (string) **(required)**: - `variables` (object): ## Responses ### 201: Newly created WhatsApp template in draft status - `template` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `displayName` (string) **(required)**: - `description` (string,null) **(required)**: - `language` (string) **(required)**: - `category` (string) **(required)**: - `contentType` (string) **(required)**: - `body` (string) **(required)**: - `variables` (object,null) **(required)**: - `status` (string) **(required)**: - `contentSid` (string,null) **(required)**: - `rejectionReason` (string,null) **(required)**: - `lastSyncedAt` (string,null) **(required)**: - `lastSyncError` (string,null) **(required)**: - `usageCount` (number,null) **(required)**: Deprecated compatibility count; advances only for provider-accepted custom-template sends. Prefer successfulSendCount. - `successfulSendCount` (number) **(required)**: - `providerScope` (string) **(required)**: Values: `unbound`, `platform_legacy`, `lab_account` - `accountState` (string) **(required)**: Values: `unbound`, `platform`, `connected`, `disconnected`, `changed` - `providerOperation` (object,null) **(required)**: - `id` (string) **(required)**: - `phase` (string) **(required)**: Values: `ready_create`, `create_ambiguous`, `ready_submit`, `ready_delete`, `manual_review` - `state` (string) **(required)**: Values: `pending`, `manual_review` - `compatibleEvents` (string[]) **(required)**: - `selectedEvents` (string[]) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/whatsapp-templates" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "nameSuffix": "string", "displayName": "string", "body": "string" }' ``` --- # Sync All Whats App Templates `POST https://api-stage.guidelab.co/whatsapp-templates/sync-all` Sync the approval status of all pending WhatsApp templates with Twilio. Updates each template's status to approved, rejected, or keeps as pending. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates/syncAllWhatsAppTemplates ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Sync results with status updates for each template - `synced` (number) **(required)**: - `hasMore` (boolean) **(required)**: - `results` (object[]) **(required)**: - `id` (string) **(required)**: - `status` (string) **(required)**: - `error` (string): ### 429: Template status sync rate limit exceeded ### 500: Twilio credentials not configured or internal error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/whatsapp-templates/sync-all" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Whats App Template Event Overrides `GET https://api-stage.guidelab.co/whatsapp-templates/event-overrides` List the lab's automatic WhatsApp event template selections and effective platform fallbacks. Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates/listWhatsAppTemplateEventOverrides ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Automatic WhatsApp event template selections - `data` (object[]) **(required)**: - `eventKey` (string) **(required)**: Values: `order_received_lab`, `order_submitted_clinic` - `selectedTemplateId` (string,null) **(required)**: - `selectedTemplate` (object,null) **(required)**: - `id` (string) **(required)**: - `displayName` (string) **(required)**: - `language` (string) **(required)**: - `effectiveSource` (string) **(required)**: Values: `override`, `platform` - `fallbackReason` (string,null) **(required)**: Values: `not_configured`, `template_ineligible`, `account_disconnected`, `account_changed`, `null` - `requiredVariables` (object) **(required)**: - `accountState` (string) **(required)**: Values: `unbound`, `platform`, `connected`, `disconnected`, `changed` ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/whatsapp-templates/event-overrides" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Whats App Template Event Candidates `GET https://api-stage.guidelab.co/whatsapp-templates/event-overrides/{eventKey}/candidates` List a bounded page of approved, account-bound templates compatible with one automatic WhatsApp event. Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates/listWhatsAppTemplateEventCandidates ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `eventKey` (string) **(required)** (in: path): Values: `order_received_lab`, `order_submitted_clinic` - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `search` (string) (in: query): ## Responses ### 200: Paginated compatible automatic WhatsApp templates - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `displayName` (string) **(required)**: - `language` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/whatsapp-templates/event-overrides/{eventKey}/candidates" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Whats App Template Event Override `DELETE https://api-stage.guidelab.co/whatsapp-templates/event-overrides/{eventKey}` Reset an automatic WhatsApp event to the GuideLab platform English template. Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates/deleteWhatsAppTemplateEventOverride ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `eventKey` (string) **(required)** (in: path): Values: `order_received_lab`, `order_submitted_clinic` ## Responses ### 200: Updated automatic WhatsApp event template selections - `data` (object[]) **(required)**: - `eventKey` (string) **(required)**: Values: `order_received_lab`, `order_submitted_clinic` - `selectedTemplateId` (string,null) **(required)**: - `selectedTemplate` (object,null) **(required)**: - `id` (string) **(required)**: - `displayName` (string) **(required)**: - `language` (string) **(required)**: - `effectiveSource` (string) **(required)**: Values: `override`, `platform` - `fallbackReason` (string,null) **(required)**: Values: `not_configured`, `template_ineligible`, `account_disconnected`, `account_changed`, `null` - `requiredVariables` (object) **(required)**: - `accountState` (string) **(required)**: Values: `unbound`, `platform`, `connected`, `disconnected`, `changed` ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/whatsapp-templates/event-overrides/{eventKey}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Set Whats App Template Event Override `PUT https://api-stage.guidelab.co/whatsapp-templates/event-overrides/{eventKey}` Select an approved, account-bound lab template for an automatic WhatsApp event. Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates/setWhatsAppTemplateEventOverride ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `eventKey` (string) **(required)** (in: path): Values: `order_received_lab`, `order_submitted_clinic` ## Request Body Content-Type: `application/json` - `templateId` (string) **(required)**: ## Responses ### 200: Updated automatic WhatsApp event template selections - `data` (object[]) **(required)**: - `eventKey` (string) **(required)**: Values: `order_received_lab`, `order_submitted_clinic` - `selectedTemplateId` (string,null) **(required)**: - `selectedTemplate` (object,null) **(required)**: - `id` (string) **(required)**: - `displayName` (string) **(required)**: - `language` (string) **(required)**: - `effectiveSource` (string) **(required)**: Values: `override`, `platform` - `fallbackReason` (string,null) **(required)**: Values: `not_configured`, `template_ineligible`, `account_disconnected`, `account_changed`, `null` - `requiredVariables` (object) **(required)**: - `accountState` (string) **(required)**: Values: `unbound`, `platform`, `connected`, `disconnected`, `changed` ### 404: Template not found ### 409: Template is not eligible for this event or account ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/whatsapp-templates/event-overrides/{eventKey}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "templateId": "string" }' ``` --- # Get Whats App Template `GET https://api-stage.guidelab.co/whatsapp-templates/{id}` Retrieve a single WhatsApp template by ID, including its body, variables, approval status, and Twilio content SID. Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates/getWhatsAppTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: WhatsApp template details - `template` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `displayName` (string) **(required)**: - `description` (string,null) **(required)**: - `language` (string) **(required)**: - `category` (string) **(required)**: - `contentType` (string) **(required)**: - `body` (string) **(required)**: - `variables` (object,null) **(required)**: - `status` (string) **(required)**: - `contentSid` (string,null) **(required)**: - `rejectionReason` (string,null) **(required)**: - `lastSyncedAt` (string,null) **(required)**: - `lastSyncError` (string,null) **(required)**: - `usageCount` (number,null) **(required)**: Deprecated compatibility count; advances only for provider-accepted custom-template sends. Prefer successfulSendCount. - `successfulSendCount` (number) **(required)**: - `providerScope` (string) **(required)**: Values: `unbound`, `platform_legacy`, `lab_account` - `accountState` (string) **(required)**: Values: `unbound`, `platform`, `connected`, `disconnected`, `changed` - `providerOperation` (object,null) **(required)**: - `id` (string) **(required)**: - `phase` (string) **(required)**: Values: `ready_create`, `create_ambiguous`, `ready_submit`, `ready_delete`, `manual_review` - `state` (string) **(required)**: Values: `pending`, `manual_review` - `compatibleEvents` (string[]) **(required)**: - `selectedEvents` (string[]) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 404: Template not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/whatsapp-templates/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Whats App Template `DELETE https://api-stage.guidelab.co/whatsapp-templates/{id}` Permanently delete a WhatsApp template and its event selections, durably recovering exact-account Twilio cleanup when needed. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates/deleteWhatsAppTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Template successfully deleted - `success` (boolean) **(required)**: ### 404: Template not found ### 409: The exact legacy Twilio account is unavailable ### 429: Template deletion budget exceeded ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/whatsapp-templates/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Whats App Template `PUT https://api-stage.guidelab.co/whatsapp-templates/{id}` Update a WhatsApp template's name, body, variables, or other properties. Only draft templates can be edited. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates/updateWhatsAppTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `nameSuffix` (string): - `displayName` (string): - `description` (string): - `language` (string): - `category` (string): Values: `UTILITY`, `MARKETING`, `AUTHENTICATION` - `body` (string): - `variables` (object): ## Responses ### 200: Successfully updated WhatsApp template - `template` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `displayName` (string) **(required)**: - `description` (string,null) **(required)**: - `language` (string) **(required)**: - `category` (string) **(required)**: - `contentType` (string) **(required)**: - `body` (string) **(required)**: - `variables` (object,null) **(required)**: - `status` (string) **(required)**: - `contentSid` (string,null) **(required)**: - `rejectionReason` (string,null) **(required)**: - `lastSyncedAt` (string,null) **(required)**: - `lastSyncError` (string,null) **(required)**: - `usageCount` (number,null) **(required)**: Deprecated compatibility count; advances only for provider-accepted custom-template sends. Prefer successfulSendCount. - `successfulSendCount` (number) **(required)**: - `providerScope` (string) **(required)**: Values: `unbound`, `platform_legacy`, `lab_account` - `accountState` (string) **(required)**: Values: `unbound`, `platform`, `connected`, `disconnected`, `changed` - `providerOperation` (object,null) **(required)**: - `id` (string) **(required)**: - `phase` (string) **(required)**: Values: `ready_create`, `create_ambiguous`, `ready_submit`, `ready_delete`, `manual_review` - `state` (string) **(required)**: Values: `pending`, `manual_review` - `compatibleEvents` (string[]) **(required)**: - `selectedEvents` (string[]) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Template is not in draft status or invalid request body ### 404: Template not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/whatsapp-templates/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Register Whats App Template `POST https://api-stage.guidelab.co/whatsapp-templates/{id}/register` Register a draft WhatsApp template with Twilio for WhatsApp approval. Creates the content in Twilio, submits for approval, and updates the template status to pending. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates/registerWhatsAppTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Template registered and submitted for WhatsApp approval - `template` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `displayName` (string) **(required)**: - `description` (string,null) **(required)**: - `language` (string) **(required)**: - `category` (string) **(required)**: - `contentType` (string) **(required)**: - `body` (string) **(required)**: - `variables` (object,null) **(required)**: - `status` (string) **(required)**: - `contentSid` (string,null) **(required)**: - `rejectionReason` (string,null) **(required)**: - `lastSyncedAt` (string,null) **(required)**: - `lastSyncError` (string,null) **(required)**: - `usageCount` (number,null) **(required)**: Deprecated compatibility count; advances only for provider-accepted custom-template sends. Prefer successfulSendCount. - `successfulSendCount` (number) **(required)**: - `providerScope` (string) **(required)**: Values: `unbound`, `platform_legacy`, `lab_account` - `accountState` (string) **(required)**: Values: `unbound`, `platform`, `connected`, `disconnected`, `changed` - `providerOperation` (object,null) **(required)**: - `id` (string) **(required)**: - `phase` (string) **(required)**: Values: `ready_create`, `create_ambiguous`, `ready_submit`, `ready_delete`, `manual_review` - `state` (string) **(required)**: Values: `pending`, `manual_review` - `compatibleEvents` (string[]) **(required)**: - `selectedEvents` (string[]) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `providerOperation` (object) **(required)**: - `id` (string) **(required)**: - `state` (string) **(required)**: Values: `registered`, `pending` ### 202: Template registration durably accepted for bounded recovery - `template` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `displayName` (string) **(required)**: - `description` (string,null) **(required)**: - `language` (string) **(required)**: - `category` (string) **(required)**: - `contentType` (string) **(required)**: - `body` (string) **(required)**: - `variables` (object,null) **(required)**: - `status` (string) **(required)**: - `contentSid` (string,null) **(required)**: - `rejectionReason` (string,null) **(required)**: - `lastSyncedAt` (string,null) **(required)**: - `lastSyncError` (string,null) **(required)**: - `usageCount` (number,null) **(required)**: Deprecated compatibility count; advances only for provider-accepted custom-template sends. Prefer successfulSendCount. - `successfulSendCount` (number) **(required)**: - `providerScope` (string) **(required)**: Values: `unbound`, `platform_legacy`, `lab_account` - `accountState` (string) **(required)**: Values: `unbound`, `platform`, `connected`, `disconnected`, `changed` - `providerOperation` (object,null) **(required)**: - `id` (string) **(required)**: - `phase` (string) **(required)**: Values: `ready_create`, `create_ambiguous`, `ready_submit`, `ready_delete`, `manual_review` - `state` (string) **(required)**: Values: `pending`, `manual_review` - `compatibleEvents` (string[]) **(required)**: - `selectedEvents` (string[]) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `providerOperation` (object) **(required)**: - `id` (string) **(required)**: - `state` (string) **(required)**: Values: `registered`, `pending` ### 400: Template is not in draft status ### 404: Template not found ### 409: Lab Twilio integration is unavailable or manual review is required ### 429: Template registration budget exceeded ### 500: Twilio credentials not configured or registration failed ## Example ```bash curl -X POST "https://api-stage.guidelab.co/whatsapp-templates/{id}/register" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Sync Whats App Template `POST https://api-stage.guidelab.co/whatsapp-templates/{id}/sync` Sync the approval status of a single WhatsApp template with Twilio. Requires the template to have been registered (has a contentSid). Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates/syncWhatsAppTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Template with updated approval status from Twilio - `template` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `displayName` (string) **(required)**: - `description` (string,null) **(required)**: - `language` (string) **(required)**: - `category` (string) **(required)**: - `contentType` (string) **(required)**: - `body` (string) **(required)**: - `variables` (object,null) **(required)**: - `status` (string) **(required)**: - `contentSid` (string,null) **(required)**: - `rejectionReason` (string,null) **(required)**: - `lastSyncedAt` (string,null) **(required)**: - `lastSyncError` (string,null) **(required)**: - `usageCount` (number,null) **(required)**: Deprecated compatibility count; advances only for provider-accepted custom-template sends. Prefer successfulSendCount. - `successfulSendCount` (number) **(required)**: - `providerScope` (string) **(required)**: Values: `unbound`, `platform_legacy`, `lab_account` - `accountState` (string) **(required)**: Values: `unbound`, `platform`, `connected`, `disconnected`, `changed` - `providerOperation` (object,null) **(required)**: - `id` (string) **(required)**: - `phase` (string) **(required)**: Values: `ready_create`, `create_ambiguous`, `ready_submit`, `ready_delete`, `manual_review` - `state` (string) **(required)**: Values: `pending`, `manual_review` - `compatibleEvents` (string[]) **(required)**: - `selectedEvents` (string[]) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Template has not been registered with Twilio ### 404: Template not found ### 409: Template's Twilio account is unavailable or changed ### 429: Template status provider-read budget exceeded ### 500: Twilio credentials not configured or internal error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/whatsapp-templates/{id}/sync" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Test Whats App Template `POST https://api-stage.guidelab.co/whatsapp-templates/{id}/test` Send a test WhatsApp message using an approved template and the exact Twilio account that owns its Content SID. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/whatsapp-templates/testWhatsAppTemplate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `phoneNumber` (string) **(required)**: - `variables` (object): ## Responses ### 200: Test message accepted for processing - `success` (boolean) **(required)**: ### 400: Template not approved or invalid request body ### 404: Template not found ### 409: Template's Twilio account is unavailable or changed ### 429: Paid test-message rate limit exceeded ### 500: Twilio credentials not configured or send failed ### 503: Durable WhatsApp queue is unavailable ## Example ```bash curl -X POST "https://api-stage.guidelab.co/whatsapp-templates/{id}/test" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "phoneNumber": "string", "variables": {} }' ``` --- # List scan inbox items `GET https://api-stage.guidelab.co/scan-inbox` Retrieve paginated scan inbox items for the current scanner-owning organization. Supports filtering by status, source, and search term, with configurable sorting. Documentation: https://docs.guidelab.co/api-reference/scan-inbox/listScanInboxItems ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `pageSize` (integer) (in: query): Default: `20` - `status` (string) (in: query): - `search` (string) (in: query): - `source` (string) (in: query): - `sortBy` (string) (in: query): Values: `createdAt`, `scanDate`, `dueDate`, `patientName` Default: `createdAt` - `sortOrder` (string) (in: query): Values: `asc`, `desc` Default: `desc` ## Responses ### 200: Paginated list of scan inbox items - `items` (array) **(required)**: - `pagination` (object) **(required)**: - `total` (number) **(required)**: - `page` (number) **(required)**: - `pageSize` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized ## Example ```bash curl -X GET "https://api-stage.guidelab.co/scan-inbox" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Sync scan inbox from scanner connections `POST https://api-stage.guidelab.co/scan-inbox/sync` Trigger a sync of scan inbox items from all configured scanner connections. Optionally specify a single connectionId to sync. Automatically attempts to match new items to tenant-visible orders and patients. Documentation: https://docs.guidelab.co/api-reference/scan-inbox/syncScanInbox ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `connectionId` (string): ## Responses ### 200: Sync results with count of new items imported - `results` (object[]) **(required)**: - `connectionId` (string): - `newItems` (number) **(required)**: - `totalNewItems` (number) **(required)**: ### 400: Invalid sync request ### 401: Unauthorized ### 422: Sync request exceeds a local safety limit ### 429: Scanner sync budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scan-inbox/sync" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "connectionId": "string" }' ``` --- # Bulk action on scan inbox items `POST https://api-stage.guidelab.co/scan-inbox/bulk` Perform a bulk action (currently 'dismiss') on up to 100 scan inbox items owned by the current organization. Documentation: https://docs.guidelab.co/api-reference/scan-inbox/bulkScanInboxAction ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `action` (string) **(required)**: Values: `dismiss` - `ids` (string[]) **(required)**: - `reason` (string): ## Responses ### 200: Bulk action completed successfully - `success` (boolean) **(required)**: - `action` (string) **(required)**: - `count` (number) **(required)**: ### 400: Invalid request body ### 401: Unauthorized ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scan-inbox/bulk" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "action": "dismiss", "ids": [ "string" ], "reason": "string" }' ``` --- # Assign scan inbox item to existing order `POST https://api-stage.guidelab.co/scan-inbox/{id}/assign` Assign a scan inbox item to an existing order. Downloads attachments from the scanner (e.g. 3Shape) and uploads them as order files. Lab only. Documentation: https://docs.guidelab.co/api-reference/scan-inbox/assignScanInboxItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `orderId` (string) **(required)**: ## Responses ### 200: Item assigned to order with imported file count - `orderId` (string) **(required)**: - `orderNumber` (string) **(required)**: - `fileCount` (number) **(required)**: ### 400: Invalid request body ### 401: Unauthorized ### 403: Forbidden - lab only ### 404: Scan inbox item or order not found ### 409: Scan inbox item was handled by another request or its file import is already in progress ### 503: One or more scanner attachments remain pending ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scan-inbox/{id}/assign" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "orderId": "string" }' ``` --- # Book scan inbox item as new order `POST https://api-stage.guidelab.co/scan-inbox/{id}/book` Create a new draft order from a scan inbox item. Optionally creates a patient record and order items from scan metadata. Downloads scanner attachments as order files. Lab only. Documentation: https://docs.guidelab.co/api-reference/scan-inbox/bookScanInboxItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `clinicId` (string): - `partnershipId` (string): - `patientId` (string): ## Responses ### 201: New order created from scan inbox item - `orderId` (string) **(required)**: - `orderNumber` (string) **(required)**: - `patientId` (string,null) **(required)**: - `orderItemCount` (number) **(required)**: - `fileCount` (number) **(required)**: ### 400: Invalid booking destination ### 401: Unauthorized ### 403: Forbidden - lab only ### 404: Scan inbox item not found ### 409: Scan inbox item is already being handled ### 422: Scanner case exceeds a local import safety limit ### 429: Scanner import rate limit exceeded ### 503: One or more scanner attachments remain pending ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scan-inbox/{id}/book" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "clinicId": "string", "partnershipId": "string", "patientId": "string" }' ``` --- # Dismiss a scan inbox item `POST https://api-stage.guidelab.co/scan-inbox/{id}/dismiss` Mark an organization-owned scan inbox item as dismissed with an optional reason. The item will no longer appear in active scan inbox lists. Documentation: https://docs.guidelab.co/api-reference/scan-inbox/dismissScanInboxItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `reason` (string): ## Responses ### 200: Scan inbox item dismissed - `success` (boolean) **(required)**: ### 401: Unauthorized ### 404: Scan inbox item not found ### 409: Scan inbox item is no longer available or its file import is already in progress ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scan-inbox/{id}/dismiss" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "reason": "string" }' ``` --- # Re-run matching for a scan inbox item `POST https://api-stage.guidelab.co/scan-inbox/{id}/match` Trigger the matching algorithm on a scan inbox item to find tenant-visible order, patient, or clinic matches. Updates match metadata and may auto-promote status to 'matched' if confidence is high enough. Documentation: https://docs.guidelab.co/api-reference/scan-inbox/matchScanInboxItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Match result with confidence score and matched entities - `matchedOrderId` (string,null) **(required)**: - `matchedOrderLabId` (string,null) **(required)**: - `matchedPatientId` (string,null) **(required)**: - `matchedClinicId` (string,null) **(required)**: - `confidence` (number) **(required)**: - `matchType` (string,null) **(required)**: - `reason` (string,null) **(required)**: - `status` (string) **(required)**: ### 401: Unauthorized ### 404: Scan inbox item not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/scan-inbox/{id}/match" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Xero integration status `GET https://api-stage.guidelab.co/integrations/xero` Retrieve the current Xero integration status, connection state, and configuration for the authenticated lab. Documentation: https://docs.guidelab.co/api-reference/integrations/getXeroStatus ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Xero integration status including connection state and sync settings - `id` (string,null) **(required)**: - `isEnabled` (boolean) **(required)**: - `isConnected` (boolean) **(required)**: - `tenantName` (string,null) **(required)**: - `config` (object): ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/xero" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Xero integration settings `PUT https://api-stage.guidelab.co/integrations/xero` Update Xero integration settings such as default sales account, tax type, bank account, and sync preferences. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/updateXeroSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Updated Xero integration status and configuration - `id` (string,null) **(required)**: - `isEnabled` (boolean) **(required)**: - `isConnected` (boolean) **(required)**: - `tenantName` (string,null) **(required)**: - `config` (object): ### 401: Unauthorized - valid session required ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/integrations/xero" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Initiate Xero OAuth authorization `POST https://api-stage.guidelab.co/integrations/xero/authorize` Initiate the Xero OAuth 2.0 authorization flow. Returns a URL to redirect the user to Xero's consent screen. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/initiateXeroOAuth ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Xero OAuth consent URL to redirect the user to - `url` (string) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/xero/authorize" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Handle Xero OAuth callback `GET https://api-stage.guidelab.co/integrations/xero/callback` Handle the Xero OAuth 2.0 callback after user authorization. Exchanges the authorization code for tokens and stores them. Documentation: https://docs.guidelab.co/api-reference/integrations/handleXeroOAuthCallback ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Redirect to integration settings page with connection status ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/xero/callback" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Disconnect Xero integration `POST https://api-stage.guidelab.co/integrations/xero/disconnect` Disconnect the Xero integration by clearing OAuth tokens while preserving configuration settings. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/disconnectXero ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Xero integration successfully disconnected - `success` (boolean) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/xero/disconnect" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Xero accounts `GET https://api-stage.guidelab.co/integrations/xero/accounts` Fetch chart of accounts from the connected Xero organization for settings configuration. Owner/admin only; provider access may idempotently refresh and persist an expired OAuth token. Supports filtering by account type (revenue or bank). Documentation: https://docs.guidelab.co/api-reference/integrations/listXeroAccounts ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of Xero accounts with ID, code, name, type, and tax type - `data` (object[]) **(required)**: - `accountId` (string) **(required)**: - `code` (string) **(required)**: - `name` (string) **(required)**: - `type` (string) **(required)**: - `taxType` (string,null) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/xero/accounts" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Xero tax rates `GET https://api-stage.guidelab.co/integrations/xero/tax-rates` Fetch available tax rates from the connected Xero organization for settings configuration. Owner/admin only; provider access may idempotently refresh and persist an expired OAuth token. Documentation: https://docs.guidelab.co/api-reference/integrations/listXeroTaxRates ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of Xero tax rates with name, type, and effective rate - `data` (object[]) **(required)**: - `name` (string) **(required)**: - `taxType` (string) **(required)**: - `effectiveRate` (number) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/xero/tax-rates" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Search Xero contacts `GET https://api-stage.guidelab.co/integrations/xero/contacts/search` Search for contacts in the connected Xero organization while configuring mappings. Owner/admin only; provider access may idempotently refresh and persist an expired OAuth token. Requires a minimum 2-character query. Documentation: https://docs.guidelab.co/api-reference/integrations/searchXeroContacts ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of matching Xero contacts with ID, name, and email - `data` (object[]) **(required)**: - `contactId` (string) **(required)**: - `name` (string) **(required)**: - `email` (string,null) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/xero/contacts/search" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Xero contact mappings `GET https://api-stage.guidelab.co/integrations/xero/contact-mappings` Retrieve all clinic-to-Xero contact mappings for the authenticated lab. Documentation: https://docs.guidelab.co/api-reference/integrations/listXeroContactMappings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of clinic-to-Xero contact mappings with match method - `data` (array) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/xero/contact-mappings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Xero contact mapping `DELETE https://api-stage.guidelab.co/integrations/xero/contact-mappings` Remove a clinic-to-Xero contact mapping by clinic ID. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/deleteXeroContactMapping ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Contact mapping successfully deleted - `success` (boolean) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/integrations/xero/contact-mappings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upsert Xero contact mapping `PUT https://api-stage.guidelab.co/integrations/xero/contact-mappings` Create or update a mapping between a partner clinic and a Xero contact for invoice synchronization. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/upsertXeroContactMapping ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Contact mapping successfully created or updated - `success` (boolean) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/integrations/xero/contact-mappings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Sync an invoice to Xero `POST https://api-stage.guidelab.co/integrations/xero/sync-invoice` Enqueue a single invoice for synchronization to Xero. Sets the invoice sync status to pending and adds it to the sync queue. Documentation: https://docs.guidelab.co/api-reference/integrations/syncXeroInvoice ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Invoice sync enqueued successfully with pending status - `success` (boolean) **(required)**: - `xeroSyncStatus` (string) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/xero/sync-invoice" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Sync a payment allocation to Xero `POST https://api-stage.guidelab.co/integrations/xero/sync-payment` Replay or reconcile one payment allocation against the active Xero account. Documentation: https://docs.guidelab.co/api-reference/integrations/syncXeroPayment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Payment sync accepted - `success` (boolean) **(required)**: ### 400: Xero integration is not active ### 404: Payment allocation not found ### 409: Payment is bound elsewhere or retry budget exhausted ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/xero/sync-payment" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Xero sync logs `GET https://api-stage.guidelab.co/integrations/xero/sync-log` Retrieve Xero synchronization log entries for the authenticated lab. Supports filtering by entity type and entity ID. Documentation: https://docs.guidelab.co/api-reference/integrations/listXeroSyncLogs ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of Xero sync log entries ordered by most recent first - `data` (array) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/xero/sync-log" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Twilio integration status `GET https://api-stage.guidelab.co/integrations/twilio` Retrieve the current Twilio integration status and configuration for the authenticated lab. Auth tokens are masked in the response. Documentation: https://docs.guidelab.co/api-reference/integrations/getTwilioStatus ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Twilio integration status and masked configuration - `id` (string,null) **(required)**: - `isEnabled` (boolean) **(required)**: - `config` (object): ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/twilio" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Twilio integration settings `PUT https://api-stage.guidelab.co/integrations/twilio` Create or update the Twilio integration settings including account credentials and phone numbers. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/updateTwilioIntegration ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Updated Twilio integration status and masked configuration - `id` (string,null) **(required)**: - `isEnabled` (boolean) **(required)**: - `config` (object): ### 400: Invalid Twilio integration configuration ### 401: Unauthorized - valid session required ### 409: Stored Twilio integration configuration is invalid ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/integrations/twilio" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Test Twilio API credentials `POST https://api-stage.guidelab.co/integrations/twilio/test-connection` Verify Twilio API credentials by making a test call to the Twilio API. Returns whether the credentials are valid. Documentation: https://docs.guidelab.co/api-reference/integrations/testTwilioConnection ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Connection test result with validity status - `valid` (boolean) **(required)**: - `friendlyName` (string): - `status` (string): - `error` (string): ### 400: Invalid Twilio credentials ### 401: Unauthorized - valid session required ### 429: Twilio connection-test rate limit exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/twilio/test-connection" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Send a test message via Twilio `POST https://api-stage.guidelab.co/integrations/twilio/test-message` Queue a test WhatsApp or SMS message through the authenticated lab's exact saved Twilio account and channel sender. Documentation: https://docs.guidelab.co/api-reference/integrations/sendTwilioTestMessage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Test message queue admission result - `success` (boolean) **(required)**: - `error` (string): ### 400: Invalid test-message request ### 401: Unauthorized - valid session required ### 409: Saved Twilio credentials or sender are unavailable ### 429: Paid test-message rate limit exceeded ### 503: Test-message queue or credentials temporarily unavailable ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/twilio/test-message" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Dentally connection status `GET https://api-stage.guidelab.co/integrations/dentally` Retrieve the current Dentally connection status and configuration for the authenticated clinic. Documentation: https://docs.guidelab.co/api-reference/integrations/getDentallyConnection ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Dentally connection details or null if not configured - `id` (string) **(required)**: - `name` (string,null) **(required)**: - `apiBaseUrl` (string) **(required)**: - `connectionStatus` (string) **(required)**: - `statusMessage` (string,null) **(required)**: - `syncEnabled` (boolean) **(required)**: - `lastSyncAt` (string,null) **(required)**: - `lastSyncStatus` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/dentally" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Connect or update Dentally integration `POST https://api-stage.guidelab.co/integrations/dentally` Create or update a Dentally connection for the authenticated clinic. Validates credentials before saving. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/connectDentally ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `apiKey` (string) **(required)**: - `apiBaseUrl` (string) **(required)**: Values: `https://api.dentally.co`, `https://api.apac.dentally.com`, `https://api.ca.dentally.com`, `https://api.sandbox.dentally.co` - `name` (string): (default: `Main Practice`) ## Responses ### 200: Created or updated Dentally connection details - `id` (string) **(required)**: - `name` (string,null) **(required)**: - `apiBaseUrl` (string) **(required)**: - `connectionStatus` (string) **(required)**: - `statusMessage` (string,null) **(required)**: - `syncEnabled` (boolean) **(required)**: - `lastSyncAt` (string,null) **(required)**: - `lastSyncStatus` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/dentally" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "apiKey": "string", "apiBaseUrl": "https://api.dentally.co", "name": "string" }' ``` --- # Disconnect Dentally integration `DELETE https://api-stage.guidelab.co/integrations/dentally` Remove the Dentally connection for the authenticated clinic. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/disconnectDentally ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Dentally connection successfully removed - `success` (boolean) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/integrations/dentally" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Trigger Dentally patient sync `POST https://api-stage.guidelab.co/integrations/dentally/sync` Trigger a patient sync from Dentally to the local database for the authenticated clinic. Documentation: https://docs.guidelab.co/api-reference/integrations/triggerDentallySync ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Sync result with counts of created, updated, and skipped patients - `id` (string) **(required)**: - `syncType` (string) **(required)**: - `status` (string) **(required)**: - `patientsCreated` (number) **(required)**: - `patientsUpdated` (number) **(required)**: - `patientsSkipped` (number) **(required)**: - `errorCount` (number) **(required)**: - `errors` (object): - `durationMs` (number,null) **(required)**: - `triggeredBy` (string,null) **(required)**: - `startedAt` (string) **(required)**: - `completedAt` (string,null) **(required)**: ### 401: Unauthorized - valid session required ### 429: Dentally sync rate limit exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/dentally/sync" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Dentally sync logs `GET https://api-stage.guidelab.co/integrations/dentally/sync-logs` Retrieve recent Dentally patient sync log entries for the authenticated clinic. Documentation: https://docs.guidelab.co/api-reference/integrations/listDentallySyncLogs ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Array of sync log entries ordered by most recent first Array of: - `id` (string) **(required)**: - `syncType` (string) **(required)**: - `status` (string) **(required)**: - `patientsCreated` (number) **(required)**: - `patientsUpdated` (number) **(required)**: - `patientsSkipped` (number) **(required)**: - `errorCount` (number) **(required)**: - `errors` (object): - `durationMs` (number,null) **(required)**: - `triggeredBy` (string,null) **(required)**: - `startedAt` (string) **(required)**: - `completedAt` (string,null) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/dentally/sync-logs" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Test Dentally API credentials `POST https://api-stage.guidelab.co/integrations/dentally/test` Test Dentally API credentials without saving them. Returns whether the connection is valid. Documentation: https://docs.guidelab.co/api-reference/integrations/testDentallyConnection ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `apiKey` (string) **(required)**: - `apiBaseUrl` (string) **(required)**: Values: `https://api.dentally.co`, `https://api.apac.dentally.com`, `https://api.ca.dentally.com`, `https://api.sandbox.dentally.co` ## Responses ### 200: Connection test result with validity status and message - `valid` (boolean) **(required)**: - `message` (string): ### 401: Unauthorized - valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/dentally/test" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "apiKey": "string", "apiBaseUrl": "https://api.dentally.co" }' ``` --- # Get Ariba integration status and configuration `GET https://api-stage.guidelab.co/integrations/ariba` Retrieve the current SAP Ariba integration status and full configuration (connection, accounting, billing, automation) for the authenticated lab. Documentation: https://docs.guidelab.co/api-reference/integrations/getAribaStatus ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Ariba integration status with masked secrets and full configuration - `id` (string,null) **(required)**: - `isEnabled` (boolean) **(required)**: - `config` (object) **(required)**: - `connection` (object): - `accounting` (object): - `billTo` (object): - `automation` (object): ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/ariba" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Ariba integration settings `PUT https://api-stage.guidelab.co/integrations/ariba` Create or update the SAP Ariba integration settings including connection, accounting, billing, and automation configuration. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/updateAribaIntegration ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `isEnabled` (boolean): - `config` (object): - `connection` (object): - `deploymentMode` (string): (default: `test`) Values: `test`, `production` - `senderNetworkId` (object): - `recipientNetworkId` (object): - `sharedSecret` (object): - `endpointUrl` (object): - `contractNumber` (object): - `accounting` (object): - `company` (object): - `percentage` (object): - `businessUnit` (object): - `costCentre` (object): - `procurementUnit` (object): - `account` (object): - `billTo` (object): - `addressId` (object): - `name` (object): - `street` (object): - `city` (object): - `state` (object): - `postalCode` (object): - `country` (object): - `automation` (object): - `autoSendXml` (boolean): (default: `false`) ## Responses ### 200: Updated Ariba integration status and configuration - `id` (string,null) **(required)**: - `isEnabled` (boolean) **(required)**: - `config` (object) **(required)**: - `connection` (object): - `accounting` (object): - `billTo` (object): - `automation` (object): ### 400: Invalid request body ### 401: Unauthorized - valid session required ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/integrations/ariba" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "isEnabled": true, "config": { "connection": { "deploymentMode": "test", "senderNetworkId": "string", "recipientNetworkId": "string", "sharedSecret": "string", "endpointUrl": "string", "contractNumber": "string" }, "accounting": { "company": "string", "percentage": "string", "businessUnit": "string", "costCentre": "string", "procurementUnit": "string", "account": "string" }, "billTo": {}, "automation": { "autoSendXml": true } } }' ``` --- # Preview Ariba cXML invoice `GET https://api-stage.guidelab.co/integrations/ariba/preview-cxml` Generate a preview of the cXML invoice document that would be sent to SAP Ariba for the specified invoice. Documentation: https://docs.guidelab.co/api-reference/integrations/previewAribaCxml ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Generated cXML invoice document preview - `cxml` (string) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/ariba/preview-cxml" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Send invoice to Ariba via cXML `POST https://api-stage.guidelab.co/integrations/ariba/send-invoice` Build and transmit a cXML invoice to the configured SAP Ariba endpoint for the specified invoice. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/sendAribaInvoice ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `invoiceId` (string) **(required)**: ## Responses ### 200: Ariba transmission result with HTTP status and response body - `success` (boolean) **(required)**: - `statusCode` (number) **(required)**: - `response` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized - valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/ariba/send-invoice" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "invoiceId": "string" }' ``` --- # Get exocad integration status and mappings `GET https://api-stage.guidelab.co/integrations/exocad` Retrieve the current exocad integration status, configuration, and all material/reconstruction type mappings for the authenticated lab. Documentation: https://docs.guidelab.co/api-reference/integrations/getExocadStatus ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Exocad integration status with configuration and mappings - `id` (string,null) **(required)**: - `isEnabled` (boolean) **(required)**: - `config` (object): - `reconstructionMappings` (array) **(required)**: - `materialMappings` (array) **(required)**: ### 401: Unauthorized - valid session required ### 409: Stored Exocad mapping capacity is invalid ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/exocad" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update exocad integration settings `PUT https://api-stage.guidelab.co/integrations/exocad` Create or update the exocad integration settings including folder paths and auto-import configuration for the authenticated lab. Documentation: https://docs.guidelab.co/api-reference/integrations/updateExocadIntegration ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Updated exocad integration record - `integration` (object): ### 400: Invalid integration configuration ### 401: Unauthorized - valid session required ### 409: Stored integration configuration is invalid ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/integrations/exocad" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update exocad material mappings `PUT https://api-stage.guidelab.co/integrations/exocad/material-mappings` Update the mapping between exocad material names and local material records for the authenticated lab. Documentation: https://docs.guidelab.co/api-reference/integrations/updateExocadMaterialMappings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `mappings` (object[]) **(required)**: - `exocadMaterial` (string) **(required)**: - `materialId` (string,null) **(required)**: ## Responses ### 200: Updated list of exocad material mappings - `mappings` (object[]) **(required)**: - `id` (string) **(required)**: - `exocadMaterial` (string) **(required)**: - `materialId` (string,null) **(required)**: ### 401: Unauthorized - valid session required ### 409: Exocad mapping capacity reached ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/integrations/exocad/material-mappings" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "mappings": [ { "exocadMaterial": "string", "materialId": "string" } ] }' ``` --- # Update exocad reconstruction type mappings `PUT https://api-stage.guidelab.co/integrations/exocad/reconstruction-mappings` Update the mapping between exocad reconstruction types and local product records for the authenticated lab. Documentation: https://docs.guidelab.co/api-reference/integrations/updateExocadReconstructionMappings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `mappings` (object[]) **(required)**: - `exocadType` (string) **(required)**: - `productId` (string,null) **(required)**: ## Responses ### 200: Updated list of exocad reconstruction type mappings - `mappings` (object[]) **(required)**: - `id` (string) **(required)**: - `exocadType` (string) **(required)**: - `productId` (string,null) **(required)**: ### 401: Unauthorized - valid session required ### 409: Exocad mapping capacity reached ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/integrations/exocad/reconstruction-mappings" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "mappings": [ { "exocadType": "string", "productId": "string" } ] }' ``` --- # Get Bite Finder integration status `GET https://api-stage.guidelab.co/integrations/bite-finder` Retrieve the current Bite Finder integration status and configuration for the authenticated lab. Documentation: https://docs.guidelab.co/api-reference/integrations/getBiteFinderStatus ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Bite Finder integration status and masked configuration - `id` (string,null) **(required)**: - `isEnabled` (boolean) **(required)**: - `config` (object): ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/bite-finder" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Bite Finder integration settings `PUT https://api-stage.guidelab.co/integrations/bite-finder` Create or update the Bite Finder integration settings for the authenticated lab. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/updateBiteFinderIntegration ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `isEnabled` (boolean): - `config` (object): - `apiKey` (string): - `endpointUrl` (object): ## Responses ### 200: Updated Bite Finder integration status and masked configuration - `id` (string,null) **(required)**: - `isEnabled` (boolean) **(required)**: - `config` (object): ### 400: Invalid request body ### 401: Unauthorized - valid session required ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/integrations/bite-finder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "isEnabled": true, "config": { "apiKey": "string", "endpointUrl": "string" } }' ``` --- # Get HeyGears integration status `GET https://api-stage.guidelab.co/integrations/heygears` Retrieve the current HeyGears integration status and configuration for the authenticated lab. Documentation: https://docs.guidelab.co/api-reference/integrations/getHeyGearsStatus ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: HeyGears integration status and masked configuration - `id` (string,null) **(required)**: - `isEnabled` (boolean) **(required)**: - `config` (object): ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/heygears" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update HeyGears integration settings `PUT https://api-stage.guidelab.co/integrations/heygears` Create or update the HeyGears integration settings for the authenticated lab. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/updateHeyGearsIntegration ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `isEnabled` (boolean): - `config` (object): - `apiKey` (string): - `endpointUrl` (object): ## Responses ### 200: Updated HeyGears integration status and masked configuration - `id` (string,null) **(required)**: - `isEnabled` (boolean) **(required)**: - `config` (object): ### 400: Invalid request body ### 401: Unauthorized - valid session required ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/integrations/heygears" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "isEnabled": true, "config": { "apiKey": "string", "endpointUrl": "string" } }' ``` --- # Get ShipStation partner shipping status `GET https://api-stage.guidelab.co/integrations/ship-engine` Documentation: https://docs.guidelab.co/api-reference/integrations/getShipEngineIntegration ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Shipping integration status ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/ship-engine" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Provision the lab's ShipStation partner sub-account `POST https://api-stage.guidelab.co/integrations/ship-engine/provision` Documentation: https://docs.guidelab.co/api-reference/integrations/provisionShipEngineIntegration ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `originCountryCode` (string) **(required)**: Values: `GB`, `IT` ## Responses ### 200: Existing connected account ### 201: Sub-account and tracking webhook provisioned ### 202: A bounded provisioning attempt is already in progress ### 400: Unsupported or mismatched origin country ### 403: Organization manager access required ### 429: Provider operation budget exhausted ### 502: Provider setup failed safely ### 503: Provider integration is disabled ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/ship-engine/provision" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "originCountryCode": "GB" }' ``` --- # List the lab's connected carrier accounts `GET https://api-stage.guidelab.co/integrations/ship-engine/carriers` Documentation: https://docs.guidelab.co/api-reference/integrations/listShipEngineCarriers ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Bounded carrier list ### 409: Shipping provider is not connected ### 429: Provider operation budget exhausted ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/ship-engine/carriers" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Connect a lab-owned carrier account without retaining its credentials `POST https://api-stage.guidelab.co/integrations/ship-engine/carriers` Documentation: https://docs.guidelab.co/api-reference/integrations/connectShipEngineCarrier ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `carrierName` (string) **(required)**: - `credentials` (object) **(required)**: ## Responses ### 201: Carrier account connected ### 409: Shipping provider is not connected ### 429: Provider operation budget exhausted ### 502: Carrier connection rejected ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/ship-engine/carriers" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "carrierName": "string", "credentials": {} }' ``` --- # Get Fatture in Cloud integration status `GET https://api-stage.guidelab.co/integrations/fatture-in-cloud` Retrieve the current Fatture in Cloud integration status, connection state, and configuration for the authenticated lab. Documentation: https://docs.guidelab.co/api-reference/integrations/getFattureInCloudStatus ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Fatture in Cloud integration status including connection state and settings - `id` (string,null) **(required)**: - `isEnabled` (boolean) **(required)**: - `connectionState` (string) **(required)**: Values: `disconnected`, `pending_company_selection`, `connected` - `companyName` (string,null) **(required)**: - `config` (object) **(required)**: - `numeration` (string) **(required)**: - `defaultVatTypeId` (integer,null) **(required)**: - `paymentAccountId` (integer,null) **(required)**: - `paymentMethodId` (integer,null) **(required)**: - `autoSyncOnSend` (boolean) **(required)**: - `autoSyncPayments` (boolean) **(required)**: - `sdiEnabled` (boolean) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/fatture-in-cloud" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Fatture in Cloud integration settings `PUT https://api-stage.guidelab.co/integrations/fatture-in-cloud` Update Fatture in Cloud integration settings such as numeration, default VAT type, payment account/method, sync preferences, and the SDI toggle. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/updateFattureInCloudSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Updated Fatture in Cloud integration status and configuration - `id` (string,null) **(required)**: - `isEnabled` (boolean) **(required)**: - `connectionState` (string) **(required)**: Values: `disconnected`, `pending_company_selection`, `connected` - `companyName` (string,null) **(required)**: - `config` (object) **(required)**: - `numeration` (string) **(required)**: - `defaultVatTypeId` (integer,null) **(required)**: - `paymentAccountId` (integer,null) **(required)**: - `paymentMethodId` (integer,null) **(required)**: - `autoSyncOnSend` (boolean) **(required)**: - `autoSyncPayments` (boolean) **(required)**: - `sdiEnabled` (boolean) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/integrations/fatture-in-cloud" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Initiate Fatture in Cloud OAuth authorization `POST https://api-stage.guidelab.co/integrations/fatture-in-cloud/authorize` Initiate the Fatture in Cloud OAuth 2.0 authorization flow. Returns a URL to redirect the user to the consent screen. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/initiateFattureInCloudOAuth ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Fatture in Cloud OAuth consent URL to redirect the user to - `url` (string) **(required)**: ### 401: Unauthorized - valid session required ### 403: Organization manager access required ### 409: The organization currency is not EUR (code: currency_not_supported) ### 503: Fatture in Cloud OAuth is not configured ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/fatture-in-cloud/authorize" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Handle Fatture in Cloud OAuth callback `GET https://api-stage.guidelab.co/integrations/fatture-in-cloud/callback` Handle the Fatture in Cloud OAuth 2.0 callback. Exchanges the authorization code for tokens, and either binds the single visible company or parks the grant until a manager selects one. Documentation: https://docs.guidelab.co/api-reference/integrations/handleFattureInCloudOAuthCallback ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 302: Redirect back to the integration settings page carrying the connection status in the fatture_in_cloud query parameter ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/fatture-in-cloud/callback" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Fatture in Cloud companies `GET https://api-stage.guidelab.co/integrations/fatture-in-cloud/companies` List the Fatture in Cloud companies visible to the pending grant so a manager can select exactly one. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/listFattureInCloudCompanies ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Companies available to the pending authorization - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `vatNumber` (string,null) **(required)**: - `taxCode` (string,null) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/fatture-in-cloud/companies" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Select the Fatture in Cloud company `POST https://api-stage.guidelab.co/integrations/fatture-in-cloud/select-company` Bind the pending Fatture in Cloud grant to exactly one company, activating the integration. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/selectFattureInCloudCompany ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Company bound and integration activated - `success` (boolean) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/fatture-in-cloud/select-company" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Disconnect Fatture in Cloud integration `POST https://api-stage.guidelab.co/integrations/fatture-in-cloud/disconnect` Disconnect the Fatture in Cloud integration by revoking the OAuth grant while preserving configuration settings. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/disconnectFattureInCloud ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Fatture in Cloud integration successfully disconnected - `success` (boolean) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/fatture-in-cloud/disconnect" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Fatture in Cloud VAT types `GET https://api-stage.guidelab.co/integrations/fatture-in-cloud/vat-types` Fetch VAT types from the connected Fatture in Cloud company for settings configuration. Owner/admin only; provider access may idempotently refresh and persist an expired OAuth token. Documentation: https://docs.guidelab.co/api-reference/integrations/listFattureInCloudVatTypes ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of VAT types with id, percentage, and description - `data` (object[]) **(required)**: - `id` (number) **(required)**: - `value` (number) **(required)**: - `description` (string,null) **(required)**: - `eiType` (string,null) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/fatture-in-cloud/vat-types" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Fatture in Cloud payment accounts `GET https://api-stage.guidelab.co/integrations/fatture-in-cloud/payment-accounts` Fetch payment accounts from the connected Fatture in Cloud company for settings configuration. Owner/admin only; provider access may idempotently refresh and persist an expired OAuth token. Documentation: https://docs.guidelab.co/api-reference/integrations/listFattureInCloudPaymentAccounts ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of payment accounts with id, name, and type - `data` (object[]) **(required)**: - `id` (number) **(required)**: - `name` (string) **(required)**: - `type` (string,null) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/fatture-in-cloud/payment-accounts" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Fatture in Cloud payment methods `GET https://api-stage.guidelab.co/integrations/fatture-in-cloud/payment-methods` Fetch payment methods from the connected Fatture in Cloud company for settings configuration. Owner/admin only; provider access may idempotently refresh and persist an expired OAuth token. Documentation: https://docs.guidelab.co/api-reference/integrations/listFattureInCloudPaymentMethods ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of payment methods with id and name - `data` (object[]) **(required)**: - `id` (number) **(required)**: - `name` (string) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/fatture-in-cloud/payment-methods" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Search Fatture in Cloud clients `GET https://api-stage.guidelab.co/integrations/fatture-in-cloud/clients/search` Search for clients in the connected Fatture in Cloud company while configuring mappings. Owner/admin only; provider access may idempotently refresh and persist an expired OAuth token. Requires a minimum 2-character query. Documentation: https://docs.guidelab.co/api-reference/integrations/searchFattureInCloudClients ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of matching clients with id, name, VAT number, and tax code - `data` (object[]) **(required)**: - `clientId` (string) **(required)**: - `name` (string) **(required)**: - `vatNumber` (string,null) **(required)**: - `taxCode` (string,null) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/fatture-in-cloud/clients/search" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Fatture in Cloud client mappings `GET https://api-stage.guidelab.co/integrations/fatture-in-cloud/client-mappings` Retrieve all clinic-to-Fatture in Cloud client mappings for the authenticated lab. Documentation: https://docs.guidelab.co/api-reference/integrations/listFattureInCloudClientMappings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of clinic-to-client mappings with match method - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `partnershipId` (string) **(required)**: - `clinicId` (string) **(required)**: - `clinicName` (string) **(required)**: - `providerClientId` (string) **(required)**: - `providerClientName` (string) **(required)**: - `vatNumber` (string,null) **(required)**: - `taxCode` (string,null) **(required)**: - `matchMethod` (string) **(required)**: - `updatedAt` (string,null) **(required)**: [date-time] ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/fatture-in-cloud/client-mappings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Fatture in Cloud client mapping `DELETE https://api-stage.guidelab.co/integrations/fatture-in-cloud/client-mappings` Remove a clinic-to-Fatture in Cloud client mapping by clinic ID. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/deleteFattureInCloudClientMapping ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Client mapping successfully deleted - `success` (boolean) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/integrations/fatture-in-cloud/client-mappings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upsert Fatture in Cloud client mapping `PUT https://api-stage.guidelab.co/integrations/fatture-in-cloud/client-mappings` Create or update a mapping between a partner clinic and a Fatture in Cloud client for document synchronization. Requires organization manager access. Documentation: https://docs.guidelab.co/api-reference/integrations/upsertFattureInCloudClientMapping ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Client mapping successfully created or updated - `success` (boolean) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/integrations/fatture-in-cloud/client-mappings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Sync an invoice to Fatture in Cloud `POST https://api-stage.guidelab.co/integrations/fatture-in-cloud/sync-invoice` Enqueue a single invoice for export to Fatture in Cloud. The provider assigns the fiscal number inside the configured numeration. Documentation: https://docs.guidelab.co/api-reference/integrations/syncFattureInCloudInvoice ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Invoice export enqueued successfully - `success` (boolean) **(required)**: - `syncStatus` (string) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/fatture-in-cloud/sync-invoice" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Sync a credit note to Fatture in Cloud `POST https://api-stage.guidelab.co/integrations/fatture-in-cloud/sync-credit-note` Enqueue a single credit note for export to Fatture in Cloud, or replay one that reached a terminal state. Documentation: https://docs.guidelab.co/api-reference/integrations/syncFattureInCloudCreditNote ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Credit note export enqueued successfully - `success` (boolean) **(required)**: - `syncStatus` (string) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/fatture-in-cloud/sync-credit-note" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Reconcile invoice payments to Fatture in Cloud `POST https://api-stage.guidelab.co/integrations/fatture-in-cloud/sync-payments` Reconcile the embedded payment schedule of one exported invoice against the connected Fatture in Cloud company. Documentation: https://docs.guidelab.co/api-reference/integrations/syncFattureInCloudPayments ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Payment reconciliation accepted - `success` (boolean) **(required)**: ### 400: Fatture in Cloud integration is not active ### 409: Invoice is not exported or retry budget exhausted ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/fatture-in-cloud/sync-payments" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Send an invoice to SDI `POST https://api-stage.guidelab.co/integrations/fatture-in-cloud/send-e-invoice` Explicitly submit one exported invoice to SDI through Fatture in Cloud after verification. SDI submission is a legal act: it only ever happens through this manager-confirmed action, never automatically. Documentation: https://docs.guidelab.co/api-reference/integrations/sendFattureInCloudEInvoice ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: SDI submission enqueued - `success` (boolean) **(required)**: ### 400: Fatture in Cloud integration is not active ### 409: SDI is not enabled, the invoice is not exported, or the send already happened ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/fatture-in-cloud/send-e-invoice" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Refresh an invoice's SDI status `POST https://api-stage.guidelab.co/integrations/fatture-in-cloud/refresh-e-invoice-status` Fetch the canonical SDI status of one exported invoice from Fatture in Cloud and store it. Documentation: https://docs.guidelab.co/api-reference/integrations/refreshFattureInCloudEInvoiceStatus ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Status refresh enqueued - `success` (boolean) **(required)**: ### 400: Fatture in Cloud integration is not active ### 409: Invoice is not exported ## Example ```bash curl -X POST "https://api-stage.guidelab.co/integrations/fatture-in-cloud/refresh-e-invoice-status" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Fatture in Cloud sync logs `GET https://api-stage.guidelab.co/integrations/fatture-in-cloud/sync-log` Retrieve Fatture in Cloud synchronization log entries for the authenticated lab, including fiscal numbers and SDI status. Supports filtering by entity type and entity ID. Documentation: https://docs.guidelab.co/api-reference/integrations/listFattureInCloudSyncLogs ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of sync log entries ordered by most recent first - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `fattureInCloudAccountId` (string) **(required)**: - `entityType` (string) **(required)**: - `entityId` (string,null) **(required)**: - `invoiceId` (string,null) **(required)**: - `creditNoteId` (string,null) **(required)**: - `action` (string) **(required)**: - `phase` (string) **(required)**: - `status` (string) **(required)**: - `documentSyncStatus` (string) **(required)**: - `providerAttempts` (integer) **(required)**: - `attemptNumber` (integer) **(required)**: - `providerEntityId` (string,null) **(required)**: - `lastError` (string,null) **(required)**: - `errorMessage` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `fiscalNumber` (integer,null) **(required)**: - `fiscalNumeration` (string,null) **(required)**: - `fiscalYear` (integer,null) **(required)**: - `eiStatus` (string) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/integrations/fatture-in-cloud/sync-log" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Invoices `GET https://api-stage.guidelab.co/invoices` Retrieve a paginated list of invoices for the authenticated lab. Supports filtering by status, clinic, and search text. Documentation: https://docs.guidelab.co/api-reference/invoices/listInvoices ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `status` (string) (in: query): - `search` (string) (in: query): - `sortBy` (string) (in: query): Values: `createdAt`, `issueDate`, `dueDate`, `invoiceNumber`, `totalAmount` Default: `createdAt` - `sortOrder` (string) (in: query): Values: `asc`, `desc` Default: `desc` - `clinicId` (string) (in: query): - `partnershipId` (string) (in: query): - `currency` (string) (in: query): Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `allTime` () (in: query): ## Responses ### 200: Paginated list of invoices with clinic details - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `invoiceNumber` (string) **(required)**: - `clinicId` (string) **(required)**: - `clinicName` (string,null) **(required)**: - `status` (string) **(required)**: - `subtotal` (string) **(required)**: - `taxAmount` (string,null) **(required)**: - `totalAmount` (string) **(required)**: - `amountPaid` (string) **(required)**: - `amountDue` (string) **(required)**: - `issueDate` (string) **(required)**: - `dueDate` (string) **(required)**: - `createdAt` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid or malformed query parameters ## Example ```bash curl -X GET "https://api-stage.guidelab.co/invoices" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Invoice `POST https://api-stage.guidelab.co/invoices` Create a new invoice for a clinic. Lab-only. Automatically generates an invoice number; issued invoices create the corresponding account transaction while drafts remain ledger-neutral. Documentation: https://docs.guidelab.co/api-reference/invoices/createInvoice ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `idempotency-key` (string) **(required)** (in: header): Stable key reused only when retrying the exact same command body ## Request Body Content-Type: `application/json` - `clinicId` (string) **(required)**: - `orderId` (string): - `doctorUserId` (string): - `status` (string): (default: `draft`) Values: `draft`, `sent` - `discountAmount` (string): - `currency` (string): (default: `GBP`) Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `issueDate` (string) **(required)**: - `dueDate` (string): - `notes` (string): - `terms` (string): - `items` (object[]) **(required)**: - `orderId` (string): - `orderItemId` (string): - `description` (string) **(required)**: - `quantity` (integer): (default: `1`) - `unitPrice` (string) **(required)**: ## Responses ### 201: Invoice created successfully with line items - `id` (string) **(required)**: - `invoiceNumber` (string) **(required)**: - `items` (array) **(required)**: ### 400: Request body failed validation ### 404: Specified clinic not found ### 409: Issuance requires more than the supported number of prepayments ### 422: Idempotency-Key was already used with a different invoice body ## Example ```bash curl -X POST "https://api-stage.guidelab.co/invoices" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "clinicId": "string", "issueDate": "string", "items": [ { "orderId": "string", "orderItemId": "string", "description": "string", "quantity": 0, "unitPrice": "string" } ] }' ``` --- # Generate Invoices From Orders `POST https://api-stage.guidelab.co/invoices/generate-from-orders` Batch-generate invoices from completed orders, grouped by clinic. Lab-only. Uses lab finance settings for default tax rate and due date calculation. Documentation: https://docs.guidelab.co/api-reference/invoices/generateInvoicesFromOrders ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `orderIds` (string[]) **(required)**: - `issueDate` (string): - `dueDate` (string): - `notes` (string): ## Responses ### 201: Invoices generated successfully with invoice IDs and count - `success` (boolean) **(required)**: - `invoiceIds` (string[]) **(required)**: - `count` (number) **(required)**: ### 400: Request body failed validation ### 404: None of the specified orders were found for this lab ## Example ```bash curl -X POST "https://api-stage.guidelab.co/invoices/generate-from-orders" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "orderIds": [ "string" ], "issueDate": "string", "dueDate": "string", "notes": "string" }' ``` --- # Get Invoice By Order `GET https://api-stage.guidelab.co/invoices/by-order/{orderId}` Look up the invoice associated with a specific order. Returns the full invoice detail including items and payments. Documentation: https://docs.guidelab.co/api-reference/invoices/getInvoiceByOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `orderId` (string) **(required)** (in: path): The order ID to look up the invoice for ## Responses ### 200: Full invoice detail for the specified order - `id` (string) **(required)**: - `invoiceNumber` (string) **(required)**: ### 404: No invoice found for the specified order ## Example ```bash curl -X GET "https://api-stage.guidelab.co/invoices/by-order/{orderId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Invoice `GET https://api-stage.guidelab.co/invoices/{id}` Retrieve full invoice details including line items, payments, clinic info, and Xero sync status. Documentation: https://docs.guidelab.co/api-reference/invoices/getInvoice ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Invoice ID ## Responses ### 200: Full invoice detail with items, payments, and related entities - `id` (string) **(required)**: - `invoiceNumber` (string) **(required)**: ### 404: Invoice not found or does not belong to this lab ## Example ```bash curl -X GET "https://api-stage.guidelab.co/invoices/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Invoice `DELETE https://api-stage.guidelab.co/invoices/{id}` Delete a draft invoice. Only invoices in draft status can be deleted; use status update to cancel non-draft invoices instead. Documentation: https://docs.guidelab.co/api-reference/invoices/deleteInvoice ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Invoice ID ## Responses ### 200: Invoice deleted successfully - `success` (boolean) **(required)**: ### 400: Invoice is not in draft status and cannot be deleted ### 404: Invoice not found or does not belong to this lab ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/invoices/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Invoice `PUT https://api-stage.guidelab.co/invoices/{id}` Edit draft invoice metadata or perform an allowed lifecycle transition. Financial headers are derived from line items and payment states are ledger-derived. Documentation: https://docs.guidelab.co/api-reference/invoices/updateInvoice ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Invoice ID ## Request Body Content-Type: `application/json` - `status` (string): Values: `draft`, `sent`, `paid`, `partially_paid`, `overdue`, `cancelled` - `doctorUserId` (string,null): - `discountAmount` (string,null): - `dueDate` (string): - `notes` (string,null): - `terms` (string,null): ## Responses ### 200: Updated invoice detail - `id` (string) **(required)**: - `invoiceNumber` (string) **(required)**: ### 400: Request body failed validation ### 404: Invoice not found or does not belong to this lab ### 409: Invoice has an online payment in progress or issuance requires too many prepayments ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/invoices/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "status": "draft", "doctorUserId": "string", "discountAmount": "string", "dueDate": "string", "notes": "string", "terms": "string" }' ``` --- # Record Invoice Payment `POST https://api-stage.guidelab.co/invoices/{id}/payment` Record a manual payment against an invoice. Lab-only. Automatically updates invoice status (partially_paid/paid), creates a transaction record, and triggers Xero payment sync if configured. Documentation: https://docs.guidelab.co/api-reference/invoices/recordInvoicePayment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Invoice ID - `idempotency-key` (string) **(required)** (in: header): ## Request Body Content-Type: `application/json` - `amount` (string) **(required)**: - `method` (string) **(required)**: Values: `card`, `bank_transfer`, `cash`, `cheque`, `stripe`, `direct_debit`, `other` - `reference` (string): - `paidAt` (string): - `notes` (string): - `reportingFxRate` (string): - `reportingFxEffectiveDate` (string): ## Responses ### 201: Payment recorded with updated invoice status and remaining balance - `success` (boolean) **(required)**: Values: `true` - `paymentId` (string) **(required)**: - `invoiceStatus` (string) **(required)**: - `amountPaid` (string) **(required)**: - `amountDue` (string) **(required)**: - `overpaymentAmount` (string) **(required)**: ### 400: Payment data failed validation ### 404: Invoice not found or does not belong to this lab ### 409: Idempotent request is still being processed or the invoice has an online payment in progress ### 422: Idempotency-Key was reused with different payment parameters ## Example ```bash curl -X POST "https://api-stage.guidelab.co/invoices/{id}/payment" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "amount": "string", "method": "card" }' ``` --- # Email Invoice `POST https://api-stage.guidelab.co/invoices/{id}/email` Send an invoice via email to the clinic's billing or primary email address. Lab-only. Also emits an in-app notification to clinic owners. Documentation: https://docs.guidelab.co/api-reference/invoices/emailInvoice ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Invoice ID - `idempotency-key` (string) **(required)** (in: header): Stable key reused only when retrying the exact same command body ## Responses ### 200: Invoice email sent successfully - `success` (boolean) **(required)**: ### 400: Clinic has no email address configured ### 404: Invoice not found or does not belong to this lab ### 429: Invoice email send budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/invoices/{id}/email" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Archive Invoice `POST https://api-stage.guidelab.co/invoices/{id}/archive` Toggle the archive status of an invoice. If currently archived, it will be unarchived and vice versa. Archived invoices are excluded from default listing views. Documentation: https://docs.guidelab.co/api-reference/invoices/archiveInvoice ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Invoice ID ## Responses ### 200: Archive status toggled, returns new archived state - `success` (boolean) **(required)**: - `archived` (boolean) **(required)**: ### 404: Invoice not found or does not belong to this lab ## Example ```bash curl -X POST "https://api-stage.guidelab.co/invoices/{id}/archive" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Credit Notes `GET https://api-stage.guidelab.co/credit-notes` Retrieve a paginated list of credit notes for the authenticated lab. Supports filtering by status and search text. Documentation: https://docs.guidelab.co/api-reference/credit-notes/listCreditNotes ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `status` (string) (in: query): - `search` (string) (in: query): - `sortBy` (string) (in: query): Values: `createdAt`, `issueDate`, `creditNoteNumber`, `totalAmount` Default: `createdAt` - `sortOrder` (string) (in: query): Values: `asc`, `desc` Default: `desc` ## Responses ### 200: Paginated list of credit notes with clinic and allocation details - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid or malformed query parameters - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/credit-notes" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Credit Note `POST https://api-stage.guidelab.co/credit-notes` Create an invoice-backed or manual account credit note. Invoice-backed clinic, partnership, currency, doctor identity, tax rate, and pricing mode are derived from the source invoice; manual doctor display data is resolved from a verified clinic member. Documentation: https://docs.guidelab.co/api-reference/credit-notes/createCreditNote ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `idempotency-key` (string) **(required)** (in: header): Stable key reused only when retrying the exact same command body ## Request Body Content-Type: `application/json` ## Responses ### 201: Credit note created successfully with ID and number - `id` (string) **(required)**: - `creditNoteNumber` (string) **(required)**: ### 400: Request body failed validation - `error` (string) **(required)**: ### 422: Idempotency-Key was already used with a different credit-note body ## Example ```bash curl -X POST "https://api-stage.guidelab.co/credit-notes" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '"string"' ``` --- # Get Credit Note `GET https://api-stage.guidelab.co/credit-notes/{id}` Retrieve full credit note details including line items, allocations, and remaining balance. Documentation: https://docs.guidelab.co/api-reference/credit-notes/getCreditNote ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Credit note ID ## Responses ### 200: Full credit note detail with items and allocations - `id` (string) **(required)**: - `creditNoteNumber` (string) **(required)**: ### 404: Credit note not found or does not belong to this lab - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/credit-notes/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Void Credit Note `DELETE https://api-stage.guidelab.co/credit-notes/{id}` Void a credit note. Lab-only. Cannot void a credit note that has existing allocations; deallocate first. Documentation: https://docs.guidelab.co/api-reference/credit-notes/voidCreditNote ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Credit note ID ## Responses ### 200: Credit note voided successfully - `success` (boolean) **(required)**: ### 400: Credit note has existing allocations and cannot be voided - `error` (string) **(required)**: ### 404: Credit note not found or does not belong to this lab - `error` (string) **(required)**: ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/credit-notes/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Email Credit Note `POST https://api-stage.guidelab.co/credit-notes/{id}/email` Send a credit note via email to the clinic's billing or primary email address. Lab-only. Honours the lab's sales-credit email template setting. Documentation: https://docs.guidelab.co/api-reference/credit-notes/emailCreditNote ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Credit note ID ## Responses ### 200: Credit note email sent successfully - `success` (boolean) **(required)**: ### 400: Clinic has no email address or the sales-credit template is disabled - `error` (string) **(required)**: ### 404: Credit note not found or does not belong to this lab - `error` (string) **(required)**: ### 429: Credit note email send budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/credit-notes/{id}/email" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Allocate Credit Note `POST https://api-stage.guidelab.co/credit-notes/{id}/allocate` Allocate credit from a credit note to an invoice. Lab-only. Reduces the invoice's amount due and the credit note's remaining balance. May mark the invoice as paid if fully covered. Documentation: https://docs.guidelab.co/api-reference/credit-notes/allocateCreditNote ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Credit note ID ## Request Body Content-Type: `application/json` - `idempotencyKey` (string) **(required)**: - `invoiceId` (string) **(required)**: - `amount` (string) **(required)**: ## Responses ### 200: Credit allocated with updated remaining credit and invoice amount due - `success` (boolean) **(required)**: - `newRemaining` (string) **(required)**: - `newAmountDue` (string) **(required)**: ### 400: Amount exceeds remaining credit, credit note is voided, or validation failed - `error` (string) **(required)**: ### 404: Credit note or target invoice not found - `error` (string) **(required)**: ### 409: Credit or invoice balance changed, or the invoice has an online payment in progress - `error` (string) **(required)**: ## Example ```bash curl -X POST "https://api-stage.guidelab.co/credit-notes/{id}/allocate" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "idempotencyKey": "string", "invoiceId": "string", "amount": "string" }' ``` --- # Deallocate Credit Note `DELETE https://api-stage.guidelab.co/credit-notes/{id}/allocations/{allocationId}` Reverse a credit-note allocation. Lab-only. Restores the credit note's remaining balance and the invoice's amount due (may revert the invoice from paid). Documentation: https://docs.guidelab.co/api-reference/credit-notes/deallocateCreditNote ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Credit note ID - `allocationId` (string) **(required)** (in: path): Allocation ID to reverse ## Responses ### 200: Allocation reversed with updated balances - `success` (boolean) **(required)**: - `invoiceStatus` (string) **(required)**: - `newRemaining` (string) **(required)**: - `newAmountDue` (string) **(required)**: ### 400: Allocation already reversed - `error` (string) **(required)**: ### 404: Allocation, credit note, or invoice not found - `error` (string) **(required)**: ### 409: Balance changed concurrently; retry - `error` (string) **(required)**: ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/credit-notes/{id}/allocations/{allocationId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Refund Credit Note `POST https://api-stage.guidelab.co/credit-notes/{id}/refund` Process a cash refund for remaining credit on a credit note. Lab-only. Creates a refund record and corresponding transaction. Documentation: https://docs.guidelab.co/api-reference/credit-notes/refundCreditNote ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Credit note ID ## Request Body Content-Type: `application/json` - `idempotencyKey` (string) **(required)**: - `amount` (string) **(required)**: - `method` (string): (default: `bank_transfer`) Values: `bank_transfer`, `cash`, `cheque`, `card` - `reference` (string): - `notes` (string): - `reportingFxRate` (string): - `reportingFxEffectiveDate` (string): ## Responses ### 201: Refund processed successfully with refund ID - `success` (boolean) **(required)**: - `refundId` (string) **(required)**: ### 400: Amount exceeds remaining credit or validation failed - `error` (string) **(required)**: ### 404: Credit note not found or does not belong to this lab - `error` (string) **(required)**: ## Example ```bash curl -X POST "https://api-stage.guidelab.co/credit-notes/{id}/refund" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "idempotencyKey": "string", "amount": "string" }' ``` --- # List Statements `GET https://api-stage.guidelab.co/statements` Retrieve a paginated list of statements for the authenticated lab. Lab-only. Supports filtering by status and search text. Documentation: https://docs.guidelab.co/api-reference/statements/listStatements ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `status` (string) (in: query): - `search` (string) (in: query): - `sortBy` (string) (in: query): Values: `createdAt`, `periodStart`, `statementNumber`, `totalDue` Default: `createdAt` - `sortOrder` (string) (in: query): Values: `asc`, `desc` Default: `desc` ## Responses ### 200: Paginated list of statements with clinic details - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid or malformed query parameters - `error` (string) **(required)**: ### 409: Statement email delivery is already in progress - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/statements" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Generate Statement `POST https://api-stage.guidelab.co/statements` Generate a new statement for a clinic with outstanding or activity data. Lab-only. Automatically calculates aged balances, line items, and running totals. Documentation: https://docs.guidelab.co/api-reference/statements/generateStatement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `partnershipId` (string) **(required)**: - `type` (string): (default: `outstanding`) Values: `outstanding`, `activity` - `asOfDate` (string): - `periodStart` (string): - `periodEnd` (string): - `currency` (string) **(required)**: Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `notes` (string): ## Responses ### 201: Statement generated successfully with statement ID and number - `success` (boolean) **(required)**: - `statementId` (string) **(required)**: - `statementNumber` (string) **(required)**: ### 400: Request body failed validation - `error` (string) **(required)**: ### 413: Statement line-item limit exceeded - `error` (string) **(required)**: ## Example ```bash curl -X POST "https://api-stage.guidelab.co/statements" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "partnershipId": "string", "currency": "GBP" }' ``` --- # Get Statement `GET https://api-stage.guidelab.co/statements/{id}` Retrieve full statement details including line items, aged balances, and totals. Lab-only. Documentation: https://docs.guidelab.co/api-reference/statements/getStatement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Statement ID ## Responses ### 200: Full statement detail with line items and balance breakdown - `id` (string) **(required)**: - `statementNumber` (string) **(required)**: ### 404: Statement not found or does not belong to this lab - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/statements/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Email Statement `POST https://api-stage.guidelab.co/statements/{id}/email` Send a statement via email to the clinic's billing or primary email address. Lab-only. Updates the statement status to sent. Documentation: https://docs.guidelab.co/api-reference/statements/emailStatement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Statement ID ## Responses ### 200: Statement email sent and status updated to sent - `success` (boolean) **(required)**: ### 400: Clinic has no email address configured - `error` (string) **(required)**: ### 404: Statement or clinic not found - `error` (string) **(required)**: ## Example ```bash curl -X POST "https://api-stage.guidelab.co/statements/{id}/email" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Consolidations `GET https://api-stage.guidelab.co/consolidations` Retrieve a paginated list of invoice consolidations for the authenticated lab. Lab-only. Supports filtering by status and search text. Documentation: https://docs.guidelab.co/api-reference/consolidations/listConsolidations ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `status` (string) (in: query): - `search` (string) (in: query): - `sortBy` (string) (in: query): Values: `createdAt`, `consolidationNumber`, `totalAmount`, `dueDate` Default: `createdAt` - `sortOrder` (string) (in: query): Values: `asc`, `desc` Default: `desc` ## Responses ### 200: Paginated list of consolidations with invoice counts and totals - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid or malformed query parameters - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/consolidations" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Consolidation `POST https://api-stage.guidelab.co/consolidations` Create a new invoice consolidation by grouping multiple invoices. Lab-only. Links selected invoices to the consolidation and calculates aggregate totals. Documentation: https://docs.guidelab.co/api-reference/consolidations/createConsolidation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` ## Responses ### 201: Consolidation created with ID and consolidation number - `success` (boolean) **(required)**: - `consolidationId` (string) **(required)**: - `consolidationNumber` (string) **(required)**: ### 400: One or more invoices not found or validation failed - `error` (string) **(required)**: ## Example ```bash curl -X POST "https://api-stage.guidelab.co/consolidations" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '"string"' ``` --- # Get Consolidation `GET https://api-stage.guidelab.co/consolidations/{id}` Retrieve full consolidation details including linked invoices and totals. Lab-only. Documentation: https://docs.guidelab.co/api-reference/consolidations/getConsolidation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Consolidation ID ## Responses ### 200: Full consolidation detail with linked invoices - `id` (string) **(required)**: - `consolidationNumber` (string) **(required)**: ### 404: Consolidation not found or does not belong to this lab - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/consolidations/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Consolidation `DELETE https://api-stage.guidelab.co/consolidations/{id}` Delete a draft consolidation and unlink its invoices. Lab-only. Only consolidations in draft status can be deleted. Documentation: https://docs.guidelab.co/api-reference/consolidations/deleteConsolidation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Consolidation ID ## Responses ### 200: Consolidation deleted and invoices unlinked - `success` (boolean) **(required)**: ### 400: Consolidation is not in draft status and cannot be deleted - `error` (string) **(required)**: ### 404: Consolidation not found or does not belong to this lab - `error` (string) **(required)**: ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/consolidations/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Email Consolidation `POST https://api-stage.guidelab.co/consolidations/{id}/email` Send a consolidated invoice via email to the billing-owner clinic. Lab-only. Honours the lab's consolidated-invoice email template setting. Documentation: https://docs.guidelab.co/api-reference/consolidations/emailConsolidation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Consolidation ID ## Responses ### 200: Consolidated invoice email sent successfully - `success` (boolean) **(required)**: ### 400: No billing-owner email or the consolidated-invoice template is disabled - `error` (string) **(required)**: ### 404: Consolidation not found or does not belong to this lab - `error` (string) **(required)**: ### 409: Consolidation authority or invoice eligibility changed - `error` (string) **(required)**: ### 429: Consolidation email send budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/consolidations/{id}/email" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Transactions `GET https://api-stage.guidelab.co/transactions` Retrieve a paginated list of financial transactions (invoices, payments, credit notes, refunds) for the authenticated lab. Supports filtering by type, clinic, and date range. Documentation: https://docs.guidelab.co/api-reference/transactions/listTransactions ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `type` (string) (in: query): - `search` (string) (in: query): - `clinicId` (string) (in: query): - `partnershipId` (string) (in: query): - `currency` (string) (in: query): Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `dateFrom` (string) (in: query): - `dateTo` (string) (in: query): - `sortBy` (string) (in: query): Values: `transactionDate`, `createdAt`, `amount` Default: `transactionDate` - `sortOrder` (string) (in: query): Values: `asc`, `desc` Default: `desc` ## Responses ### 200: Paginated list of transactions with related entity details - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid or malformed query parameters - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/transactions" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Overpayments `GET https://api-stage.guidelab.co/overpayments` Retrieve a paginated list of payments with overpayment amounts for the authenticated lab. Includes refund totals and remaining overpayment balances. Documentation: https://docs.guidelab.co/api-reference/overpayments/listOverpayments ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` ## Responses ### 200: Paginated list of overpayments with clinic names, refund totals, and remaining balances - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `invoiceId` (string,null) **(required)**: - `labId` (string) **(required)**: - `clinicId` (string) **(required)**: - `amount` (string) **(required)**: - `overpaymentAmount` (string) **(required)**: - `currency` (string) **(required)**: - `method` (string) **(required)**: - `status` (string) **(required)**: - `reference` (string,null) **(required)**: - `paidAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `clinicName` (string,null) **(required)**: - `invoiceNumber` (string,null) **(required)**: - `refundedAmount` (string) **(required)**: - `remainingOverpayment` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/overpayments" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Refund Overpayment `POST https://api-stage.guidelab.co/overpayments/{id}/refund` Process a refund for an overpayment on a completed payment. Lab-only. Creates a refund record and corresponding account-debit transaction. Documentation: https://docs.guidelab.co/api-reference/overpayments/refundOverpayment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Payment ID with the overpayment ## Request Body Content-Type: `application/json` - `idempotencyKey` (string) **(required)**: - `amount` (string) **(required)**: - `method` (string): (default: `bank_transfer`) Values: `bank_transfer`, `cash`, `cheque`, `card`, `stripe` - `reference` (string): - `notes` (string): ## Responses ### 201: Overpayment refund processed successfully with refund ID - `success` (boolean) **(required)**: - `refundId` (string) **(required)**: - `status` (string) **(required)**: Values: `pending`, `completed` ### 202: Stripe refund is pending provider confirmation - `success` (boolean) **(required)**: - `refundId` (string) **(required)**: - `status` (string) **(required)**: Values: `pending` ### 400: Amount exceeds remaining overpayment or validation failed - `error` (string) **(required)**: ### 404: Payment not found or has no overpayment balance - `error` (string) **(required)**: ### 409: Idempotency key or refund method conflicts ### 502: Stripe could not confirm the refund ### 503: Stripe is not configured safely ## Example ```bash curl -X POST "https://api-stage.guidelab.co/overpayments/{id}/refund" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "idempotencyKey": "string", "amount": "string", "method": "bank_transfer", "reference": "string", "notes": "string" }' ``` --- # Get Finance Settings `GET https://api-stage.guidelab.co/finance-settings` Retrieve the lab's finance settings including tax rates, payment terms, invoice automation, late fee configuration, and Stripe Connect status. Lab-only. Documentation: https://docs.guidelab.co/api-reference/finance-settings/getFinanceSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Lab finance settings object, returns defaults if not yet configured - `settings` (object): ### 403: Only lab organizations can access finance settings - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/finance-settings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Finance Settings `PUT https://api-stage.guidelab.co/finance-settings` Update the lab's finance settings. Lab-only. Creates the settings record if it does not yet exist (upsert behavior). Documentation: https://docs.guidelab.co/api-reference/finance-settings/updateFinanceSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `invoiceDuePolicy` (string): Values: `net_days`, `day_of_month` - `invoiceTermDays` (integer,null): - `invoiceDueDay` (integer,null): - `invoiceDueMonthRule` (string,null): Values: `next_occurrence`, `following_month`, `null` - `invoiceReminderOnIssue` (boolean): - `invoiceReminderOffsetsDays` (array): - `creditHoldEnabledByDefault` (boolean): - `paymentTerms` (string,null): - `bankingDetails` (string,null): - `nominalCode` (string,null): - `invoiceRetentionMonths` (integer): - `showPatientInStatements` (boolean): - `statementAddressLower` (boolean): - `statementDay` (integer): - `termsAndConditions` (string,null): - `lateFeeEnabled` (boolean): - `lateFeeType` (string): Values: `flat`, `percentage` - `lateFeeAmount` (string): - `lateFeeCurrency` (string,null): Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR`, `null` - `lateFeeFrequency` (string): Values: `once`, `monthly` - `lateFeeGracePeriod` (integer): - `lateFeeLabel` (string,null): - `salesInvoiceTemplateEnabled` (boolean): - `salesInvoiceAutomate` (boolean): - `salesCreditTemplateEnabled` (boolean): - `salesCreditAutomate` (boolean): - `statementTemplateEnabled` (boolean): - `statementAutomate` (boolean): - `consolidatedInvoiceTemplateEnabled` (boolean): - `consolidatedInvoiceAutomate` (boolean): - `taxMode` (string): Values: `none`, `exclusive`, `inclusive` - `defaultTaxRate` (string,null): - `defaultPaymentPolicy` (string): Values: `pay_on_invoice`, `pay_in_advance` ## Responses ### 200: Updated finance settings object - `settings` (object): ### 400: Request body failed validation - `error` (string) **(required)**: ### 403: Only lab organizations can manage finance settings - `error` (string) **(required)**: ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/finance-settings" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Get Cashflow `GET https://api-stage.guidelab.co/finances/cashflow` Return bounded monthly cash receipts, refunds, expenses, and net cash in the lab reporting currency. Documentation: https://docs.guidelab.co/api-reference/finances/getCashflow ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `period` (string) (in: query): Values: `7m`, `12m`, `ytd` Default: `7m` ## Responses ### 200: Monthly cashflow - `period` (string) **(required)**: Values: `7m`, `12m`, `ytd` - `currency` (string) **(required)**: - `from` (string) **(required)**: - `to` (string) **(required)**: - `points` (object[]) **(required)**: - `month` (string) **(required)**: - `receipts` (string) **(required)**: - `refunds` (string) **(required)**: - `expenses` (string) **(required)**: - `net` (string) **(required)**: - `totals` (object) **(required)**: - `receipts` (string) **(required)**: - `refunds` (string) **(required)**: - `expenses` (string) **(required)**: - `net` (string) **(required)**: ### 409: Organization timezone or currency is not usable for reporting - `error` (string) **(required)**: - `code` (string) **(required)**: Values: `ORGANIZATION_CONFIGURATION_INVALID` ## Example ```bash curl -X GET "https://api-stage.guidelab.co/finances/cashflow" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Expense Categories `GET https://api-stage.guidelab.co/finances/expense-categories` Documentation: https://docs.guidelab.co/api-reference/finances/listExpenseCategories ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` () (in: query): Default: `false` ## Responses ### 200: Expense categories - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `isActive` (boolean) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (object): - `updatedAt` (object): ## Example ```bash curl -X GET "https://api-stage.guidelab.co/finances/expense-categories" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Expense Category `POST https://api-stage.guidelab.co/finances/expense-categories` Documentation: https://docs.guidelab.co/api-reference/finances/createExpenseCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: ## Responses ### 201: Expense category created - `data` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `isActive` (boolean) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (object): - `updatedAt` (object): ### 409: Duplicate category or category ceiling reached ## Example ```bash curl -X POST "https://api-stage.guidelab.co/finances/expense-categories" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string" }' ``` --- # Update Expense Category `PATCH https://api-stage.guidelab.co/finances/expense-categories/{id}` Documentation: https://docs.guidelab.co/api-reference/finances/updateExpenseCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `name` (string): - `isActive` (boolean): ## Responses ### 200: Expense category updated - `data` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `isActive` (boolean) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (object): - `updatedAt` (object): ### 404: Expense category not found ### 409: Duplicate expense category name ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/finances/expense-categories/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "isActive": true }' ``` --- # Delete Expense Category `DELETE https://api-stage.guidelab.co/finances/expense-categories/{id}` Documentation: https://docs.guidelab.co/api-reference/finances/deleteExpenseCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Unused expense category deleted ### 404: Expense category not found ### 409: Expense category is in use ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/finances/expense-categories/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Expenses `GET https://api-stage.guidelab.co/finances/expenses` Documentation: https://docs.guidelab.co/api-reference/finances/listExpenses ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `25` - `status` (string) (in: query): Values: `pending`, `paid`, `void` - `categoryId` (string) (in: query): - `from` (string) (in: query): - `to` (string) (in: query): ## Responses ### 200: Paginated manual expenses - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string) **(required)**: - `description` (string) **(required)**: - `originalAmount` (string) **(required)**: - `originalCurrency` (string) **(required)**: - `reportingAmount` (string) **(required)**: - `reportingCurrency` (string) **(required)**: - `status` (string) **(required)**: - `occurredOn` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Expense date range is too wide ## Example ```bash curl -X GET "https://api-stage.guidelab.co/finances/expenses" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Expense `POST https://api-stage.guidelab.co/finances/expenses` Documentation: https://docs.guidelab.co/api-reference/finances/createExpense ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `idempotency-key` (string) **(required)** (in: header): Stable key reused only when retrying the exact same command body ## Request Body Content-Type: `application/json` - `categoryId` (string) **(required)**: - `supplierId` (string,null): - `purchaseOrderId` (string,null): - `description` (string) **(required)**: - `originalAmount` (string) **(required)**: - `originalCurrency` (string) **(required)**: Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `occurredOn` (string) **(required)**: - `paidAt` (string,null): - `status` (string): (default: `paid`) Values: `pending`, `paid` - `reference` (string,null): - `notes` (string,null): - `reportingFxRate` (string): - `reportingFxEffectiveDate` (string): ## Responses ### 200: Exact idempotent replay ### 201: Expense created - `data` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string) **(required)**: - `description` (string) **(required)**: - `originalAmount` (string) **(required)**: - `originalCurrency` (string) **(required)**: - `reportingAmount` (string) **(required)**: - `reportingCurrency` (string) **(required)**: - `status` (string) **(required)**: - `occurredOn` (string) **(required)**: ### 400: Invalid reporting FX input ### 404: Category, supplier, or purchase order not found ### 409: Reference or idempotency conflict ### 422: Idempotency-Key reused for a different expense ## Example ```bash curl -X POST "https://api-stage.guidelab.co/finances/expenses" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "categoryId": "string", "description": "string", "originalAmount": "string", "originalCurrency": "GBP", "occurredOn": "string" }' ``` --- # Update Expense `PATCH https://api-stage.guidelab.co/finances/expenses/{id}` Documentation: https://docs.guidelab.co/api-reference/finances/updateExpense ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `categoryId` (string): - `supplierId` (string,null): - `purchaseOrderId` (string,null): - `description` (string): - `originalAmount` (string): - `originalCurrency` (string): Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `occurredOn` (string): - `paidAt` (string,null): - `status` (string): Values: `pending`, `paid` - `reference` (string,null): - `notes` (string,null): - `reportingFxRate` (string): - `reportingFxEffectiveDate` (string): ## Responses ### 200: Pending expense updated - `data` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string) **(required)**: - `description` (string) **(required)**: - `originalAmount` (string) **(required)**: - `originalCurrency` (string) **(required)**: - `reportingAmount` (string) **(required)**: - `reportingCurrency` (string) **(required)**: - `status` (string) **(required)**: - `occurredOn` (string) **(required)**: ### 400: Invalid lifecycle or reporting FX input ### 404: Expense not found ### 409: Paid or void expense cannot be edited ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/finances/expenses/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Delete Expense `DELETE https://api-stage.guidelab.co/finances/expenses/{id}` Documentation: https://docs.guidelab.co/api-reference/finances/deleteExpense ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Pending expense deleted ### 404: Expense not found ### 409: Paid or void expense cannot be deleted ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/finances/expenses/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Void Expense `POST https://api-stage.guidelab.co/finances/expenses/{id}/void` Documentation: https://docs.guidelab.co/api-reference/finances/voidExpense ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `reason` (string) **(required)**: ## Responses ### 200: Expense voided - `data` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string) **(required)**: - `description` (string) **(required)**: - `originalAmount` (string) **(required)**: - `originalCurrency` (string) **(required)**: - `reportingAmount` (string) **(required)**: - `reportingCurrency` (string) **(required)**: - `status` (string) **(required)**: - `occurredOn` (string) **(required)**: ### 404: Expense not found ### 409: Expense already void ## Example ```bash curl -X POST "https://api-stage.guidelab.co/finances/expenses/{id}/void" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "reason": "string" }' ``` --- # Get Finances Overview `GET https://api-stage.guidelab.co/finances/overview` Retrieve a finance dashboard overview for the authenticated lab. Lab-only. Returns key metrics (outstanding, invoiced this month, payments this month, overdue), plus recent invoices and payments. Documentation: https://docs.guidelab.co/api-reference/finances/getFinancesOverview ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Finance overview with key metrics, recent invoices, and recent payments - `metrics` (object) **(required)**: - `currencyTotals` (object[]) **(required)**: - `currency` (string) **(required)**: - `totalOutstanding` (string) **(required)**: - `invoicedThisMonth` (string) **(required)**: - `invoicedThisMonthCount` (number) **(required)**: - `paymentsThisMonth` (string) **(required)**: - `paymentsThisMonthCount` (number) **(required)**: - `overdueAmount` (string) **(required)**: - `overdueCount` (number) **(required)**: - `recentInvoices` (object[]) **(required)**: - `id` (string) **(required)**: - `invoiceNumber` (string) **(required)**: - `clinicName` (string) **(required)**: - `clinicNameMissing` (boolean) **(required)**: - `status` (string) **(required)**: - `totalAmount` (string) **(required)**: - `amountDue` (string) **(required)**: - `dueDate` (string,null) **(required)**: - `issueDate` (string) **(required)**: - `currency` (string) **(required)**: - `recentPayments` (object[]) **(required)**: - `id` (string) **(required)**: - `invoiceId` (string,null) **(required)**: - `invoiceNumber` (string,null) **(required)**: - `clinicName` (string) **(required)**: - `clinicNameMissing` (boolean) **(required)**: - `amount` (string) **(required)**: - `method` (string) **(required)**: - `status` (string) **(required)**: - `paidAt` (string) **(required)**: - `currency` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/finances/overview" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Finance Accounts `GET https://api-stage.guidelab.co/finances/accounts` Retrieve a paginated list of clinic accounts with financial summaries. Lab-only. Shows total invoiced, paid, outstanding, overdue, and credit balance per partner clinic. Documentation: https://docs.guidelab.co/api-reference/finances/listFinanceAccounts ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `search` (string) (in: query): - `sortBy` (string) (in: query): Values: `clinicName`, `outstanding`, `totalInvoiced`, `lastPaymentDate` Default: `clinicName` - `sortOrder` (string) (in: query): Values: `asc`, `desc` Default: `asc` ## Responses ### 200: Paginated list of clinic accounts with financial aggregates - `data` (object[]) **(required)**: - `partnershipId` (string) **(required)**: - `partnershipStatus` (string) **(required)**: - `clinicId` (string) **(required)**: - `clinicName` (string) **(required)**: - `clinicNameMissing` (boolean) **(required)**: - `currency` (string) **(required)**: - `totalInvoiced` (string) **(required)**: - `totalPaid` (string) **(required)**: - `outstanding` (string) **(required)**: - `overdue` (string) **(required)**: - `creditBalance` (string) **(required)**: - `lastPaymentDate` (string,null) **(required)**: - `invoiceCount` (number) **(required)**: - `hasActivity` (boolean) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid or malformed query parameters - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/finances/accounts" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Finance Account `GET https://api-stage.guidelab.co/finances/accounts/{id}` Retrieve financial summary for a specific clinic account. Lab-only. Returns total invoiced, paid, outstanding, overdue, credit balance, and last payment date. Documentation: https://docs.guidelab.co/api-reference/finances/getFinanceAccount ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Partnership (account epoch) ID - `currency` (string) **(required)** (in: query): Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` ## Responses ### 200: Clinic account financial summary - `partnershipId` (string) **(required)**: - `partnershipStatus` (string) **(required)**: - `clinicId` (string) **(required)**: - `clinicName` (string) **(required)**: - `clinicNameMissing` (boolean) **(required)**: - `currency` (string) **(required)**: - `totalInvoiced` (string) **(required)**: - `totalPaid` (string) **(required)**: - `outstanding` (string) **(required)**: - `overdue` (string) **(required)**: - `creditBalance` (string) **(required)**: - `lastPaymentDate` (string,null) **(required)**: - `invoiceCount` (number) **(required)**: - `hasActivity` (boolean) **(required)**: ### 404: The requested account epoch/currency was not found - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/finances/accounts/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Aged Balances `GET https://api-stage.guidelab.co/finances/aged-balances` Retrieve aged balance report across all partner clinics. Lab-only. Breaks down outstanding amounts into current, 30-day, 60-day, and 90+ day buckets with per-clinic and grand totals. Documentation: https://docs.guidelab.co/api-reference/finances/getAgedBalances ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `search` (string) (in: query): Filter clinics by name - `asOfDate` (string) (in: query): Reference date for ageing calculations ## Responses ### 200: Aged balance rows per clinic with bucket totals and grand totals - `rows` (object[]) **(required)**: - `partnershipId` (string) **(required)**: - `partnershipStatus` (string) **(required)**: - `clinicId` (string) **(required)**: - `clinicName` (string) **(required)**: - `clinicNameMissing` (boolean) **(required)**: - `currency` (string) **(required)**: - `current` (string) **(required)**: - `days30` (string) **(required)**: - `days60` (string) **(required)**: - `days90Plus` (string) **(required)**: - `total` (string) **(required)**: - `totals` (object[]) **(required)**: - `currency` (string) **(required)**: - `current` (string) **(required)**: - `days30` (string) **(required)**: - `days60` (string) **(required)**: - `days90Plus` (string) **(required)**: - `total` (string) **(required)**: ### 400: Historical ageing is unavailable from mutable current invoice balances - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/finances/aged-balances" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Stripe External Adjustments `GET https://api-stage.guidelab.co/finances/external-adjustments` List unresolved Stripe dashboard refunds, disputes, and refund gaps for the authenticated lab. Lab owner/admin only. Documentation: https://docs.guidelab.co/api-reference/finances/listStripeExternalAdjustments ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` ## Responses ### 200: Paginated unresolved external Stripe adjustments - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `paymentId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `clinicId` (string) **(required)**: - `clinicName` (string) **(required)**: - `kind` (string) **(required)**: Values: `refund`, `dispute`, `refund_gap` - `amount` (string) **(required)**: - `resolutionAmount` (string) **(required)**: - `currency` (string) **(required)**: - `providerStatus` (string) **(required)**: - `effectState` (string) **(required)**: Values: `none`, `debited`, `reinstated` - `reviewReason` (string) **(required)**: - `providerReference` (string,null) **(required)**: - `paymentReference` (string,null) **(required)**: - `lastProviderEventAt` (string) **(required)**: - `createdAt` (string) **(required)**: - `canResolve` (boolean) **(required)**: - `allowedResolutionTypes` (string[]) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/finances/external-adjustments" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Stripe External Adjustment `GET https://api-stage.guidelab.co/finances/external-adjustments/{id}` View an unresolved external Stripe adjustment and source-receipt invoice candidates. Lab owner/admin only. Documentation: https://docs.guidelab.co/api-reference/finances/getStripeExternalAdjustment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: External Stripe adjustment review detail - `id` (string) **(required)**: - `paymentId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `clinicId` (string) **(required)**: - `clinicName` (string) **(required)**: - `kind` (string) **(required)**: Values: `refund`, `dispute`, `refund_gap` - `amount` (string) **(required)**: - `resolutionAmount` (string) **(required)**: - `currency` (string) **(required)**: - `providerStatus` (string) **(required)**: - `effectState` (string) **(required)**: Values: `none`, `debited`, `reinstated` - `reviewReason` (string) **(required)**: - `providerReference` (string,null) **(required)**: - `paymentReference` (string,null) **(required)**: - `lastProviderEventAt` (string) **(required)**: - `createdAt` (string) **(required)**: - `canResolve` (boolean) **(required)**: - `allowedResolutionTypes` (string[]) **(required)**: - `stripePaymentIntentId` (string) **(required)**: - `stripeChargeId` (string) **(required)**: - `invoiceCandidates` (object[]) **(required)**: - `invoiceId` (string) **(required)**: - `invoiceNumber` (string) **(required)**: - `status` (string) **(required)**: - `issueDate` (string) **(required)**: - `totalAmount` (string) **(required)**: - `amountPaid` (string) **(required)**: - `amountDue` (string) **(required)**: - `sourceAllocatedAmount` (string) **(required)**: - `currency` (string) **(required)**: ### 404: Unresolved adjustment not found - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/finances/external-adjustments/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Resolve Stripe External Adjustment `POST https://api-stage.guidelab.co/finances/external-adjustments/{id}/resolve` Resolve one external Stripe adjustment by classifying its immutable debit against source-receipt invoices or retaining it explicitly at account level. Lab owner/admin only. Documentation: https://docs.guidelab.co/api-reference/finances/resolveStripeExternalAdjustment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` ## Responses ### 200: Adjustment review resolved - `success` (boolean) **(required)**: Values: `true` - `resolutionId` (string) **(required)**: - `resolutionType` (string) **(required)**: Values: `allocate`, `account_adjustment` - `resolvedAt` (string) **(required)**: ### 400: Invalid invoice allocation ### 404: Unresolved adjustment not found ### 409: Review state or idempotency conflict ## Example ```bash curl -X POST "https://api-stage.guidelab.co/finances/external-adjustments/{id}/resolve" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '"string"' ``` --- # List Clinic Invoices `GET https://api-stage.guidelab.co/clinic-finances/invoices` Retrieve a paginated list of invoices received by the authenticated clinic. Clinic-only. Supports filtering by status, search, and sorting. Documentation: https://docs.guidelab.co/api-reference/clinic-finances/listClinicInvoices ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `status` (string) (in: query): - `search` (string) (in: query): - `sortBy` (string) (in: query): Values: `createdAt`, `issueDate`, `dueDate`, `invoiceNumber`, `totalAmount` Default: `createdAt` - `sortOrder` (string) (in: query): Values: `asc`, `desc` Default: `desc` - `clinicId` (string) (in: query): - `partnershipId` (string) (in: query): - `currency` (string) (in: query): Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `allTime` () (in: query): ## Responses ### 200: Paginated list of invoices with lab details - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid or malformed query parameters - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic-finances/invoices" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Clinic Invoices By Order `GET https://api-stage.guidelab.co/clinic-finances/invoices/by-order/{orderId}` Look up invoices associated with a specific order for the authenticated clinic. Clinic-only. Returns a list since an order may have multiple invoices. Documentation: https://docs.guidelab.co/api-reference/clinic-finances/getClinicInvoicesByOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `orderId` (string) **(required)** (in: path): Order ID to look up invoices for ## Responses ### 200: List of invoices linked to the specified order Array of: - `id` (string) **(required)**: - `invoiceNumber` (string) **(required)**: - `status` (string) **(required)**: - `totalAmount` (string) **(required)**: - `amountPaid` (string) **(required)**: - `amountDue` (string) **(required)**: - `currency` (string) **(required)**: - `dueDate` (string) **(required)**: - `labId` (string) **(required)**: - `partnershipId` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic-finances/invoices/by-order/{orderId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Clinic Invoice `GET https://api-stage.guidelab.co/clinic-finances/invoices/{id}` Retrieve full invoice details including line items and payment history. Clinic-only. Only returns invoices belonging to the authenticated clinic. Documentation: https://docs.guidelab.co/api-reference/clinic-finances/getClinicInvoice ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Invoice ID ## Responses ### 200: Full invoice detail with items, payments, and lab info - `id` (string) **(required)**: - `invoiceNumber` (string) **(required)**: - `status` (string) **(required)**: - `items` (array) **(required)**: - `payments` (array) **(required)**: ### 404: Invoice not found or does not belong to this clinic - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic-finances/invoices/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Clinic Credit Notes `GET https://api-stage.guidelab.co/clinic-finances/credit-notes` Retrieve a paginated list of credit notes received by the authenticated clinic. Clinic-only. Supports filtering by status and search text. Documentation: https://docs.guidelab.co/api-reference/clinic-finances/listClinicCreditNotes ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `status` (string) (in: query): - `search` (string) (in: query): - `sortBy` (string) (in: query): Values: `createdAt`, `issueDate`, `creditNoteNumber`, `totalAmount` Default: `createdAt` - `sortOrder` (string) (in: query): Values: `asc`, `desc` Default: `desc` ## Responses ### 200: Paginated list of credit notes with lab details - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid or malformed query parameters - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic-finances/credit-notes" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Clinic Credit Note `GET https://api-stage.guidelab.co/clinic-finances/credit-notes/{id}` Retrieve full credit note details including line items and allocations. Clinic-only. Only returns credit notes belonging to the authenticated clinic. Documentation: https://docs.guidelab.co/api-reference/clinic-finances/getClinicCreditNote ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Credit note ID ## Responses ### 200: Full credit note detail with items and allocations - `id` (string) **(required)**: - `creditNoteNumber` (string) **(required)**: - `status` (string) **(required)**: - `items` (array) **(required)**: - `allocations` (array) **(required)**: ### 404: Credit note not found or does not belong to this clinic - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic-finances/credit-notes/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Clinic Statements `GET https://api-stage.guidelab.co/clinic-finances/statements` Retrieve a paginated list of statements received by the authenticated clinic. Clinic-only. Supports filtering by status and search text. Documentation: https://docs.guidelab.co/api-reference/clinic-finances/listClinicStatements ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `status` (string) (in: query): - `search` (string) (in: query): - `sortBy` (string) (in: query): Values: `createdAt`, `periodStart`, `statementNumber`, `totalDue` Default: `createdAt` - `sortOrder` (string) (in: query): Values: `asc`, `desc` Default: `desc` ## Responses ### 200: Paginated list of statements with lab details - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid or malformed query parameters - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic-finances/statements" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Clinic Statement `GET https://api-stage.guidelab.co/clinic-finances/statements/{id}` Retrieve full statement details including line items and balance breakdown. Clinic-only. Only returns statements belonging to the authenticated clinic. Documentation: https://docs.guidelab.co/api-reference/clinic-finances/getClinicStatement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Statement ID ## Responses ### 200: Full statement detail with line items and aged balances - `id` (string) **(required)**: - `statementNumber` (string) **(required)**: - `status` (string) **(required)**: - `lineItems` (array) **(required)**: ### 404: Statement not found or does not belong to this clinic - `error` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic-finances/statements/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Clinic Stripe Status `GET https://api-stage.guidelab.co/clinic-finances/stripe-status/{labId}` Check whether a specific lab has Stripe Connect enabled and can accept online payments. Clinic-only. Used to determine if the pay-online option should be shown. Documentation: https://docs.guidelab.co/api-reference/clinic-finances/getClinicStripeStatus ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `labId` (string) **(required)** (in: path): Lab ID to check Stripe status for - `partnershipId` (string) **(required)** (in: query): Exact partnership/account epoch authorizing this check ## Responses ### 200: Stripe enablement status for the specified lab - `stripeEnabled` (boolean) **(required)**: - `labStripeAccountId` (string,null) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic-finances/stripe-status/{labId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Clinic Finances Summary `GET https://api-stage.guidelab.co/clinic-finances/summary` Aggregate outstanding-balance summary for the authenticated clinic across all payable invoices (not page-limited), broken down per lab for grouped Stripe payment. Clinic-only. Documentation: https://docs.guidelab.co/api-reference/clinic-finances/getClinicFinancesSummary ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Outstanding totals, overdue totals, and per-lab payable breakdown with Stripe status - `outstandingCount` (integer) **(required)**: - `overdueCount` (integer) **(required)**: - `currencyTotals` (object[]) **(required)**: - `currency` (string) **(required)**: Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `totalOutstanding` (string) **(required)**: - `overdueTotal` (string) **(required)**: - `outstandingCount` (integer) **(required)**: - `overdueCount` (integer) **(required)**: - `labs` (object[]) **(required)**: - `labId` (string) **(required)**: - `partnershipId` (string) **(required)**: - `labName` (string) **(required)**: - `labNameMissing` (boolean) **(required)**: - `outstandingTotal` (string) **(required)**: - `invoiceCount` (integer) **(required)**: - `overdueTotal` (string) **(required)**: - `overdueCount` (integer) **(required)**: - `currency` (string) **(required)**: Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `stripeEnabled` (boolean) **(required)**: - `labStripeAccountId` (string,null) **(required)**: - `invoiceIds` (string[]) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic-finances/summary" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List products `GET https://api-stage.guidelab.co/products` Retrieve a paginated list of products for the authenticated lab, grouped by category. Supports batch fetch by IDs, filtering by category/standard/search, and sorting. Includes file requirements, materials, inventory requirements, and custom fields. Documentation: https://docs.guidelab.co/api-reference/products/listProducts ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `ids` (string) (in: query): - `categoryId` (string) (in: query): - `standardId` (string) (in: query): - `search` (string) (in: query): - `includeInactive` (string) (in: query): - `includeHidden` (string) (in: query): - `onlyInactive` (string) (in: query): - `page` (string) (in: query): - `limit` (string) (in: query): - `sortBy` (string) (in: query): - `sortOrder` (string) (in: query): - `labId` (string) (in: query): ## Responses ### 200: Paginated list of products with categories, materials, and custom fields - `categories` (array): - `products` (array): - `data` (array): - `workTypeLayout` (string): - `pagination` (object): - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 403: User does not have permission to access products ### 404: Not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/products" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a product `POST https://api-stage.guidelab.co/products` Create a new product in the lab's catalog. Supports setting category, quality standard, treatment phase, pricing, materials, file requirements, inventory requirements, and custom fields in a single request. Documentation: https://docs.guidelab.co/api-reference/products/createProduct ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `sku` (string,null): - `description` (string,null): - `categoryId` (string,null): - `standardId` (string,null): - `treatmentPhaseId` (string) **(required)**: - `defaultPrice` (string,null): - `cogs` (string,null): - `pricingUnit` (string): (default: `product`) Values: `product`, `tooth`, `arch` - `turnaroundDays` (integer): - `weight` (number,null): - `minTeethCount` (integer,null): - `maxTeethCount` (integer,null): - `shadeEnabled` (boolean): (default: `true`) - `implantSpecRequired` (boolean): (default: `false`) - `archSelection` (string,null): Values: `upper`, `lower`, `both`, `single`, `null` - `bothArchesOnly` (boolean): (default: `false`) - `hideOdontogram` (boolean): (default: `false`) - `odontogramMode` (string): (default: `any_any`) Values: `single_natural`, `single_implant`, `single_any`, `bridge_natural`, `bridge_implant`, `bridge_any`, `any_natural`, `any_implant`, `any_any` - `configuratorType` (string): (default: `step_by_step`) Values: `single_page`, `step_by_step` - `quantityEnabled` (boolean): (default: `false`) - `autoAddToCart` (boolean): (default: `false`) - `upfrontPayment` (boolean): (default: `false`) - `isHidden` (boolean): (default: `false`) - `useProgressBar` (boolean): (default: `false`) - `fulfillmentMode` (string): (default: `physical`) Values: `physical`, `digital_only` - `isActive` (boolean): (default: `true`) - `sortOrder` (integer): (default: `0`) - `laboratoryCode` (string,null): - `laboratoryDescription` (string,null): - `productMaterials` (object[]): - `materialId` (string) **(required)**: - `isDefault` (boolean): (default: `false`) - `markupType` (string): (default: `value`) Values: `percentage`, `value` - `markupPercent` (string,null): - `markupValue` (string,null): - `fileRequirements` (object[]): - `id` (string): - `fileRequirementId` (string) **(required)**: - `requirementMode` (string): (default: `always_required`) Values: `always_required`, `conditionally_required`, `optional` - `requirementRules` (object,null): - `conditions` (object[]) **(required)**: - `field` (string) **(required)**: - `operator` (string) **(required)**: Values: `equals`, `not_empty`, `has_any`, `includes_any`, `includes_all` - `value` (object): - `fallback` (string) **(required)**: Values: `show_optional`, `hide` - `sortOrder` (integer): (default: `0`) - `inventoryRequirements` (object[]): - `inventoryItemId` (string) **(required)**: - `quantityPerUnit` (number) **(required)**: - `notes` (string): - `customFields` (object[]): - `id` (string): - `label` (string) **(required)**: - `fieldType` (string) **(required)**: Values: `input`, `textarea`, `odontogram`, `checkbox`, `select`, `radio`, `switch`, `file`, `number`, `date`, `image_select`, `image_multi_select` - `description` (string): - `placeholder` (string): - `defaultValue` (object): - `requirementMode` (string): (default: `optional`) Values: `always_required`, `conditionally_required`, `optional` - `requirementRules` (object,null): - `conditions` (object[]) **(required)**: - `field` (string) **(required)**: - `operator` (string) **(required)**: Values: `equals`, `not_empty`, `has_any`, `includes_any`, `includes_all` - `value` (object): - `fallback` (string) **(required)**: Values: `show_optional`, `hide` - `sortOrder` (integer): (default: `0`) - `options` (object[]): - `value` (string) **(required)**: - `label` (string) **(required)**: - `priceModifier` (string): - `imageKey` (string): - `visibilityRules` (object,null): - `logic` (string): (default: `and`) Values: `and`, `or` - `conditions` (object[]) **(required)**: - `field` (string) **(required)**: - `operator` (string) **(required)**: Values: `equals`, `not_equals`, `contains`, `not_empty`, `is_empty`, `has_any`, `includes_any`, `includes_all` - `value` (object): - `action` (string): Values: `hide`, `disable` - `fieldConfig` (object): - `isActive` (boolean): (default: `true`) - `triggerRules` (array,null): - `id` (string) **(required)**: - `targetProductId` (string) **(required)**: - `quantity` (integer): (default: `1`) - `rules` (object) **(required)**: - `logic` (string): (default: `and`) Values: `and`, `or` - `conditions` (object[]) **(required)**: - `field` (string) **(required)**: - `operator` (string) **(required)**: Values: `equals`, `not_equals`, `contains`, `not_empty`, `is_empty`, `has_any`, `includes_any`, `includes_all` - `value` (object): - `action` (string): Values: `hide`, `disable` - `enabled` (boolean): (default: `true`) - `duplicateFromProductId` (string): [uuid] ## Responses ### 201: Product successfully created - `product` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `standardId` (string,null) **(required)**: - `treatmentPhaseId` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `description` (string,null) **(required)**: - `defaultPrice` (string,null) **(required)**: - `cogs` (string,null) **(required)**: - `pricingUnit` (string) **(required)**: - `turnaroundDays` (number,null) **(required)**: - `weight` (string,null) **(required)**: - `minTeethCount` (number,null) **(required)**: - `maxTeethCount` (number,null) **(required)**: - `shadeEnabled` (boolean) **(required)**: - `implantSpecRequired` (boolean) **(required)**: - `archSelection` (string,null) **(required)**: - `bothArchesOnly` (boolean) **(required)**: - `hideOdontogram` (boolean) **(required)**: - `odontogramMode` (string) **(required)**: - `configuratorType` (string) **(required)**: Values: `single_page`, `step_by_step` - `quantityEnabled` (boolean) **(required)**: - `autoAddToCart` (boolean) **(required)**: - `upfrontPayment` (boolean) **(required)**: - `isHidden` (boolean) **(required)**: - `useProgressBar` (boolean) **(required)**: - `fulfillmentMode` (string) **(required)**: Values: `physical`, `digital_only` - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `laboratoryCode` (string,null) **(required)**: - `laboratoryDescription` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `triggerRules` (object): - `treatmentPhaseName` (string,null): - `treatmentPhaseSortOrder` (number,null): - `treatmentPhaseStartPolicy` (string,null): - `treatmentPhaseLeadTimeDays` (number,null): - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 403: Only labs can create products ### 404: Category, standard, treatment phase, or inventory item not found ### 409: A product with this SKU already exists or the same image copy is in progress ### 413: Copied option images exceed the size budget ### 429: Product image copy budget exceeded ### 500: Internal server error ### 504: Product option image copy timed out ## Example ```bash curl -X POST "https://api-stage.guidelab.co/products" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "treatmentPhaseId": "string" }' ``` --- # List recent custom field templates `GET https://api-stage.guidelab.co/products/recent-custom-fields` Return up to 100 of the most recently added custom field templates across the authenticated lab's products, deduped by (label, fieldType). Used by the product editor's Quick Add picker. Documentation: https://docs.guidelab.co/api-reference/products/listRecentCustomFields ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Recent custom field templates - `fields` (array) **(required)**: ### 403: Only labs can list custom field templates ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/products/recent-custom-fields" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List product picker options `GET https://api-stage.guidelab.co/products/options` Return the authenticated lab's products as `id`/`name`/`sku` picker options from a single projection, without the categories, materials, custom fields and file requirements the paginated list carries. Capped at 1000 rows; `truncated` reports when the lab holds more. Documentation: https://docs.guidelab.co/api-reference/products/listProductOptions ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` (string) (in: query): - `includeHidden` (string) (in: query): - `search` (string) (in: query): ## Responses ### 200: Product picker options - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `truncated` (boolean) **(required)**: ### 400: Invalid query parameters ### 403: Only labs can list product options ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/products/options" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get a product `GET https://api-stage.guidelab.co/products/{id}` Retrieve a single product by its ID, including its category, quality standard, materials, file requirements, inventory requirements, and custom fields. Clinic users must have an active partnership with the owning lab. Documentation: https://docs.guidelab.co/api-reference/products/getProduct ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Product ID ## Responses ### 200: Product details with all related data - `product` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `standardId` (string,null) **(required)**: - `treatmentPhaseId` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `description` (string,null) **(required)**: - `defaultPrice` (string,null) **(required)**: - `cogs` (string,null) **(required)**: - `pricingUnit` (string) **(required)**: - `turnaroundDays` (number,null) **(required)**: - `weight` (string,null) **(required)**: - `minTeethCount` (number,null) **(required)**: - `maxTeethCount` (number,null) **(required)**: - `shadeEnabled` (boolean) **(required)**: - `implantSpecRequired` (boolean) **(required)**: - `archSelection` (string,null) **(required)**: - `bothArchesOnly` (boolean) **(required)**: - `hideOdontogram` (boolean) **(required)**: - `odontogramMode` (string) **(required)**: - `configuratorType` (string) **(required)**: Values: `single_page`, `step_by_step` - `quantityEnabled` (boolean) **(required)**: - `autoAddToCart` (boolean) **(required)**: - `upfrontPayment` (boolean) **(required)**: - `isHidden` (boolean) **(required)**: - `useProgressBar` (boolean) **(required)**: - `fulfillmentMode` (string) **(required)**: Values: `physical`, `digital_only` - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `laboratoryCode` (string,null) **(required)**: - `laboratoryDescription` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `triggerRules` (object): - `treatmentPhaseName` (string,null): - `treatmentPhaseSortOrder` (number,null): - `treatmentPhaseStartPolicy` (string,null): - `treatmentPhaseLeadTimeDays` (number,null): - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `category` (object,null) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `standard` (object,null) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `code` (string) **(required)**: - `productMaterials` (array) **(required)**: - `fileRequirements` (array) **(required)**: - `customFields` (array) **(required)**: - `inventoryRequirements` (array) **(required)**: ### 400: Invalid request ### 403: User does not have permission to view this product ### 404: Product not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/products/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Partially update a product `PATCH https://api-stage.guidelab.co/products/{id}` Partially update a product's flags such as isHidden, isActive, or sortOrder. Supports action-based toggles (toggleHidden, toggleActive) or direct field updates. Documentation: https://docs.guidelab.co/api-reference/products/patchProduct ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Product ID ## Request Body Content-Type: `application/json` - `action` (string): Values: `toggleHidden`, `toggleActive` - `isHidden` (boolean): - `isActive` (boolean): - `sortOrder` (integer): ## Responses ### 200: Product partially updated - `product` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `standardId` (string,null) **(required)**: - `treatmentPhaseId` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `description` (string,null) **(required)**: - `defaultPrice` (string,null) **(required)**: - `cogs` (string,null) **(required)**: - `pricingUnit` (string) **(required)**: - `turnaroundDays` (number,null) **(required)**: - `weight` (string,null) **(required)**: - `minTeethCount` (number,null) **(required)**: - `maxTeethCount` (number,null) **(required)**: - `shadeEnabled` (boolean) **(required)**: - `implantSpecRequired` (boolean) **(required)**: - `archSelection` (string,null) **(required)**: - `bothArchesOnly` (boolean) **(required)**: - `hideOdontogram` (boolean) **(required)**: - `odontogramMode` (string) **(required)**: - `configuratorType` (string) **(required)**: Values: `single_page`, `step_by_step` - `quantityEnabled` (boolean) **(required)**: - `autoAddToCart` (boolean) **(required)**: - `upfrontPayment` (boolean) **(required)**: - `isHidden` (boolean) **(required)**: - `useProgressBar` (boolean) **(required)**: - `fulfillmentMode` (string) **(required)**: Values: `physical`, `digital_only` - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `laboratoryCode` (string,null) **(required)**: - `laboratoryDescription` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `triggerRules` (object): - `treatmentPhaseName` (string,null): - `treatmentPhaseSortOrder` (number,null): - `treatmentPhaseStartPolicy` (string,null): - `treatmentPhaseLeadTimeDays` (number,null): - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request ### 403: Only labs can update products ### 404: Product not found ### 500: Internal server error ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/products/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "action": "toggleHidden", "isHidden": true, "isActive": true, "sortOrder": 0 }' ``` --- # Delete a product `DELETE https://api-stage.guidelab.co/products/{id}` Soft-delete a product by setting it to inactive. The product record is preserved for historical reference in existing orders. Documentation: https://docs.guidelab.co/api-reference/products/deleteProduct ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Product ID ## Responses ### 200: Product deactivated successfully - `product` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `standardId` (string,null) **(required)**: - `treatmentPhaseId` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `description` (string,null) **(required)**: - `defaultPrice` (string,null) **(required)**: - `cogs` (string,null) **(required)**: - `pricingUnit` (string) **(required)**: - `turnaroundDays` (number,null) **(required)**: - `weight` (string,null) **(required)**: - `minTeethCount` (number,null) **(required)**: - `maxTeethCount` (number,null) **(required)**: - `shadeEnabled` (boolean) **(required)**: - `implantSpecRequired` (boolean) **(required)**: - `archSelection` (string,null) **(required)**: - `bothArchesOnly` (boolean) **(required)**: - `hideOdontogram` (boolean) **(required)**: - `odontogramMode` (string) **(required)**: - `configuratorType` (string) **(required)**: Values: `single_page`, `step_by_step` - `quantityEnabled` (boolean) **(required)**: - `autoAddToCart` (boolean) **(required)**: - `upfrontPayment` (boolean) **(required)**: - `isHidden` (boolean) **(required)**: - `useProgressBar` (boolean) **(required)**: - `fulfillmentMode` (string) **(required)**: Values: `physical`, `digital_only` - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `laboratoryCode` (string,null) **(required)**: - `laboratoryDescription` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `triggerRules` (object): - `treatmentPhaseName` (string,null): - `treatmentPhaseSortOrder` (number,null): - `treatmentPhaseStartPolicy` (string,null): - `treatmentPhaseLeadTimeDays` (number,null): - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `message` (string) **(required)**: ### 400: Invalid request ### 403: Only labs can delete products ### 404: Product not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/products/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a product `PUT https://api-stage.guidelab.co/products/{id}` Update an existing product's properties, materials, file requirements, inventory requirements, and custom fields. File requirements referenced by existing files are soft-deleted (archived) rather than permanently removed. Documentation: https://docs.guidelab.co/api-reference/products/updateProduct ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Product ID ## Request Body Content-Type: `application/json` - `name` (string): - `sku` (string,null): - `description` (string,null): - `categoryId` (string,null): - `standardId` (string,null): - `treatmentPhaseId` (string): - `defaultPrice` (string,null): - `cogs` (string,null): - `pricingUnit` (string): (default: `product`) Values: `product`, `tooth`, `arch` - `turnaroundDays` (integer): - `weight` (number,null): - `minTeethCount` (integer,null): - `maxTeethCount` (integer,null): - `shadeEnabled` (boolean): (default: `true`) - `implantSpecRequired` (boolean): (default: `false`) - `archSelection` (string,null): Values: `upper`, `lower`, `both`, `single`, `null` - `bothArchesOnly` (boolean): (default: `false`) - `hideOdontogram` (boolean): (default: `false`) - `odontogramMode` (string): (default: `any_any`) Values: `single_natural`, `single_implant`, `single_any`, `bridge_natural`, `bridge_implant`, `bridge_any`, `any_natural`, `any_implant`, `any_any` - `configuratorType` (string): (default: `step_by_step`) Values: `single_page`, `step_by_step` - `quantityEnabled` (boolean): (default: `false`) - `autoAddToCart` (boolean): (default: `false`) - `upfrontPayment` (boolean): (default: `false`) - `isHidden` (boolean): (default: `false`) - `useProgressBar` (boolean): (default: `false`) - `fulfillmentMode` (string): (default: `physical`) Values: `physical`, `digital_only` - `isActive` (boolean): (default: `true`) - `sortOrder` (integer): (default: `0`) - `laboratoryCode` (string,null): - `laboratoryDescription` (string,null): - `productMaterials` (object[]): - `materialId` (string) **(required)**: - `isDefault` (boolean): (default: `false`) - `markupType` (string): (default: `value`) Values: `percentage`, `value` - `markupPercent` (string,null): - `markupValue` (string,null): - `fileRequirements` (object[]): - `id` (string): - `fileRequirementId` (string) **(required)**: - `requirementMode` (string): (default: `always_required`) Values: `always_required`, `conditionally_required`, `optional` - `requirementRules` (object,null): - `conditions` (object[]) **(required)**: - `field` (string) **(required)**: - `operator` (string) **(required)**: Values: `equals`, `not_empty`, `has_any`, `includes_any`, `includes_all` - `value` (object): - `fallback` (string) **(required)**: Values: `show_optional`, `hide` - `sortOrder` (integer): (default: `0`) - `inventoryRequirements` (object[]): - `inventoryItemId` (string) **(required)**: - `quantityPerUnit` (number) **(required)**: - `notes` (string): - `customFields` (object[]): - `id` (string): - `label` (string) **(required)**: - `fieldType` (string) **(required)**: Values: `input`, `textarea`, `odontogram`, `checkbox`, `select`, `radio`, `switch`, `file`, `number`, `date`, `image_select`, `image_multi_select` - `description` (string): - `placeholder` (string): - `defaultValue` (object): - `requirementMode` (string): (default: `optional`) Values: `always_required`, `conditionally_required`, `optional` - `requirementRules` (object,null): - `conditions` (object[]) **(required)**: - `field` (string) **(required)**: - `operator` (string) **(required)**: Values: `equals`, `not_empty`, `has_any`, `includes_any`, `includes_all` - `value` (object): - `fallback` (string) **(required)**: Values: `show_optional`, `hide` - `sortOrder` (integer): (default: `0`) - `options` (object[]): - `value` (string) **(required)**: - `label` (string) **(required)**: - `priceModifier` (string): - `imageKey` (string): - `visibilityRules` (object,null): - `logic` (string): (default: `and`) Values: `and`, `or` - `conditions` (object[]) **(required)**: - `field` (string) **(required)**: - `operator` (string) **(required)**: Values: `equals`, `not_equals`, `contains`, `not_empty`, `is_empty`, `has_any`, `includes_any`, `includes_all` - `value` (object): - `action` (string): Values: `hide`, `disable` - `fieldConfig` (object): - `isActive` (boolean): (default: `true`) - `triggerRules` (array,null): - `id` (string) **(required)**: - `targetProductId` (string) **(required)**: - `quantity` (integer): (default: `1`) - `rules` (object) **(required)**: - `logic` (string): (default: `and`) Values: `and`, `or` - `conditions` (object[]) **(required)**: - `field` (string) **(required)**: - `operator` (string) **(required)**: Values: `equals`, `not_equals`, `contains`, `not_empty`, `is_empty`, `has_any`, `includes_any`, `includes_all` - `value` (object): - `action` (string): Values: `hide`, `disable` - `enabled` (boolean): (default: `true`) - `duplicateFromProductId` (string): [uuid] ## Responses ### 200: Product successfully updated - `product` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `standardId` (string,null) **(required)**: - `treatmentPhaseId` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `description` (string,null) **(required)**: - `defaultPrice` (string,null) **(required)**: - `cogs` (string,null) **(required)**: - `pricingUnit` (string) **(required)**: - `turnaroundDays` (number,null) **(required)**: - `weight` (string,null) **(required)**: - `minTeethCount` (number,null) **(required)**: - `maxTeethCount` (number,null) **(required)**: - `shadeEnabled` (boolean) **(required)**: - `implantSpecRequired` (boolean) **(required)**: - `archSelection` (string,null) **(required)**: - `bothArchesOnly` (boolean) **(required)**: - `hideOdontogram` (boolean) **(required)**: - `odontogramMode` (string) **(required)**: - `configuratorType` (string) **(required)**: Values: `single_page`, `step_by_step` - `quantityEnabled` (boolean) **(required)**: - `autoAddToCart` (boolean) **(required)**: - `upfrontPayment` (boolean) **(required)**: - `isHidden` (boolean) **(required)**: - `useProgressBar` (boolean) **(required)**: - `fulfillmentMode` (string) **(required)**: Values: `physical`, `digital_only` - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `laboratoryCode` (string,null) **(required)**: - `laboratoryDescription` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `triggerRules` (object): - `treatmentPhaseName` (string,null): - `treatmentPhaseSortOrder` (number,null): - `treatmentPhaseStartPolicy` (string,null): - `treatmentPhaseLeadTimeDays` (number,null): - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 403: Only labs can update products ### 404: Product, category, standard, phase, or inventory item not found ### 409: A product with this SKU already exists or the same image copy is in progress ### 413: Copied option images exceed the size budget ### 429: Product image copy budget exceeded ### 500: Internal server error ### 504: Product option image copy timed out ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/products/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Get product image `GET https://api-stage.guidelab.co/products/{id}/image` Retrieve the image associated with a product from R2 storage. Returns the raw image binary with appropriate content-type headers. Documentation: https://docs.guidelab.co/api-reference/products/getProductImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Product ID ## Responses ### 200: Product image binary data ## Example ```bash curl -X GET "https://api-stage.guidelab.co/products/{id}/image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload product image `POST https://api-stage.guidelab.co/products/{id}/image` Upload or replace the image for a product. Accepts JPEG, PNG, WebP, or GIF up to 5MB via multipart form data. Documentation: https://docs.guidelab.co/api-reference/products/uploadProductImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Product ID ## Responses ### 200: Product image successfully uploaded - `product` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `standardId` (string,null) **(required)**: - `treatmentPhaseId` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `description` (string,null) **(required)**: - `defaultPrice` (string,null) **(required)**: - `cogs` (string,null) **(required)**: - `pricingUnit` (string) **(required)**: - `turnaroundDays` (number,null) **(required)**: - `weight` (string,null) **(required)**: - `minTeethCount` (number,null) **(required)**: - `maxTeethCount` (number,null) **(required)**: - `shadeEnabled` (boolean) **(required)**: - `implantSpecRequired` (boolean) **(required)**: - `archSelection` (string,null) **(required)**: - `bothArchesOnly` (boolean) **(required)**: - `hideOdontogram` (boolean) **(required)**: - `odontogramMode` (string) **(required)**: - `configuratorType` (string) **(required)**: Values: `single_page`, `step_by_step` - `quantityEnabled` (boolean) **(required)**: - `autoAddToCart` (boolean) **(required)**: - `upfrontPayment` (boolean) **(required)**: - `isHidden` (boolean) **(required)**: - `useProgressBar` (boolean) **(required)**: - `fulfillmentMode` (string) **(required)**: Values: `physical`, `digital_only` - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `laboratoryCode` (string,null) **(required)**: - `laboratoryDescription` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `triggerRules` (object): - `treatmentPhaseName` (string,null): - `treatmentPhaseSortOrder` (number,null): - `treatmentPhaseStartPolicy` (string,null): - `treatmentPhaseLeadTimeDays` (number,null): - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid file type or file too large ### 403: Only labs can upload product images ### 404: Product not found ### 500: Internal server error or storage not configured ## Example ```bash curl -X POST "https://api-stage.guidelab.co/products/{id}/image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete product image `DELETE https://api-stage.guidelab.co/products/{id}/image` Remove the image associated with a product from R2 storage and clear the imageKey reference. Documentation: https://docs.guidelab.co/api-reference/products/deleteProductImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Product ID ## Responses ### 200: Product image successfully removed - `product` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `standardId` (string,null) **(required)**: - `treatmentPhaseId` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `description` (string,null) **(required)**: - `defaultPrice` (string,null) **(required)**: - `cogs` (string,null) **(required)**: - `pricingUnit` (string) **(required)**: - `turnaroundDays` (number,null) **(required)**: - `weight` (string,null) **(required)**: - `minTeethCount` (number,null) **(required)**: - `maxTeethCount` (number,null) **(required)**: - `shadeEnabled` (boolean) **(required)**: - `implantSpecRequired` (boolean) **(required)**: - `archSelection` (string,null) **(required)**: - `bothArchesOnly` (boolean) **(required)**: - `hideOdontogram` (boolean) **(required)**: - `odontogramMode` (string) **(required)**: - `configuratorType` (string) **(required)**: Values: `single_page`, `step_by_step` - `quantityEnabled` (boolean) **(required)**: - `autoAddToCart` (boolean) **(required)**: - `upfrontPayment` (boolean) **(required)**: - `isHidden` (boolean) **(required)**: - `useProgressBar` (boolean) **(required)**: - `fulfillmentMode` (string) **(required)**: Values: `physical`, `digital_only` - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `laboratoryCode` (string,null) **(required)**: - `laboratoryDescription` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `triggerRules` (object): - `treatmentPhaseName` (string,null): - `treatmentPhaseSortOrder` (number,null): - `treatmentPhaseStartPolicy` (string,null): - `treatmentPhaseLeadTimeDays` (number,null): - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `message` (string) **(required)**: ### 400: Product has no image ### 403: Only labs can delete product images ### 404: Product not found ### 500: Internal server error or storage not configured ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/products/{id}/image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get custom field image `GET https://api-stage.guidelab.co/products/{id}/custom-field-image` Retrieve a custom field option image from R2 storage by its key. Validates that the image key belongs to the authenticated organization. Documentation: https://docs.guidelab.co/api-reference/products/getCustomFieldImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Product ID - `key` (string) (in: query): ## Responses ### 200: Custom field image binary data ## Example ```bash curl -X GET "https://api-stage.guidelab.co/products/{id}/custom-field-image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload custom field image `POST https://api-stage.guidelab.co/products/{id}/custom-field-image` Upload an image for a product custom field option (e.g. image_select or image_multi_select). Accepts JPEG, PNG, WebP, or GIF up to 5MB via multipart form data with a fieldId. Documentation: https://docs.guidelab.co/api-reference/products/uploadCustomFieldImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Product ID ## Responses ### 200: Custom field image successfully uploaded with imageKey - `imageKey` (string) **(required)**: ### 400: Invalid file type, file too large, or missing fieldId ### 403: Only labs can upload custom field images ### 404: Product not found ### 500: Internal server error or storage not configured ## Example ```bash curl -X POST "https://api-stage.guidelab.co/products/{id}/custom-field-image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete custom field image `DELETE https://api-stage.guidelab.co/products/{id}/custom-field-image` Remove a custom field option image from R2 storage. Validates that the image key belongs to the authenticated organization. Documentation: https://docs.guidelab.co/api-reference/products/deleteCustomFieldImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Product ID ## Request Body Content-Type: `application/json` - `imageKey` (string) **(required)**: ## Responses ### 200: Custom field image successfully removed - `message` (string) **(required)**: ### 400: Missing image key ### 403: Only labs can delete custom field images or image does not belong to this organization ### 404: Not found ### 500: Internal server error or storage not configured ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/products/{id}/custom-field-image" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "imageKey": "string" }' ``` --- # List categories `GET https://api-stage.guidelab.co/categories` Retrieve product categories for the authenticated lab, optionally filtered by parent or active status. Returns a hierarchical tree by default or a flat list when requested. Documentation: https://docs.guidelab.co/api-reference/categories/listCategories ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` () (in: query): Default: `false` - `parentId` (string) (in: query): - `flat` () (in: query): Default: `false` - `labId` (string) (in: query): ## Responses ### 200: Successfully retrieved the list of product categories - `categories` (array) **(required)**: ### 400: Invalid query parameters ### 403: User does not have permission to access categories ### 404: Lab not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/categories" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a category `POST https://api-stage.guidelab.co/categories` Create a new product category for the authenticated lab. Categories can be nested one level deep by specifying a parentId. Documentation: https://docs.guidelab.co/api-reference/categories/createCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `subtitle` (string): - `description` (string): - `parentId` (string): - `icon` (string): - `imageAspectRatio` (string): (default: `square`) Values: `square`, `wide` - `guideTitle` (string): - `guideBody` (string): - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Category successfully created - `category` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `parentId` (string,null) **(required)**: - `name` (string) **(required)**: - `subtitle` (string,null) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `imageAspectRatio` (string) **(required)**: Values: `square`, `wide` - `guideTitle` (string,null) **(required)**: - `guideBody` (string,null) **(required)**: - `guideMediaKey` (string,null) **(required)**: - `guideMediaType` (string,null) **(required)**: Values: `image`, `video`, `null` - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body or nesting depth exceeded ### 403: Only labs can create categories ### 404: Parent category not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/categories" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string" }' ``` --- # Reorder categories `POST https://api-stage.guidelab.co/categories/reorder` Bulk update the sort order and parent assignments for product categories. Validates nesting depth constraints (max one level deep). Documentation: https://docs.guidelab.co/api-reference/categories/reorderCategories ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `categories` (object[]) **(required)**: - `id` (string) **(required)**: - `parentId` (string,null) **(required)**: - `sortOrder` (integer) **(required)**: ## Responses ### 200: Categories successfully reordered - `success` (boolean) **(required)**: ### 400: Invalid nesting or request body ### 403: Only labs can reorder categories ### 404: One or more categories not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/categories/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "categories": [ { "id": "string", "parentId": "string", "sortOrder": 0 } ] }' ``` --- # Get a category `GET https://api-stage.guidelab.co/categories/{id}` Retrieve a single product category by its ID. Clinic users must have an active partnership with the owning lab. Documentation: https://docs.guidelab.co/api-reference/categories/getCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Category ID ## Responses ### 200: Category details - `category` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `parentId` (string,null) **(required)**: - `name` (string) **(required)**: - `subtitle` (string,null) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `imageAspectRatio` (string) **(required)**: Values: `square`, `wide` - `guideTitle` (string,null) **(required)**: - `guideBody` (string,null) **(required)**: - `guideMediaKey` (string,null) **(required)**: - `guideMediaType` (string,null) **(required)**: Values: `image`, `video`, `null` - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request ### 403: User does not have permission to view this category ### 404: Category not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/categories/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Toggle category active status `PATCH https://api-stage.guidelab.co/categories/{id}` Toggle the active/inactive status of a product category. Documentation: https://docs.guidelab.co/api-reference/categories/toggleCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Category ID ## Responses ### 200: Category active status toggled - `category` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `parentId` (string,null) **(required)**: - `name` (string) **(required)**: - `subtitle` (string,null) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `imageAspectRatio` (string) **(required)**: Values: `square`, `wide` - `guideTitle` (string,null) **(required)**: - `guideBody` (string,null) **(required)**: - `guideMediaKey` (string,null) **(required)**: - `guideMediaType` (string,null) **(required)**: Values: `image`, `video`, `null` - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request ### 403: Only labs can toggle categories ### 404: Category not found ### 500: Internal server error ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/categories/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete a category `DELETE https://api-stage.guidelab.co/categories/{id}` Delete a product category. If the category has associated products or bundles, it is soft-deleted (deactivated) instead of permanently removed. Documentation: https://docs.guidelab.co/api-reference/categories/deleteCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Category ID ## Responses ### 200: Category deleted or deactivated - `category` (object): - `id` (string) **(required)**: - `labId` (string) **(required)**: - `parentId` (string,null) **(required)**: - `name` (string) **(required)**: - `subtitle` (string,null) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `imageAspectRatio` (string) **(required)**: Values: `square`, `wide` - `guideTitle` (string,null) **(required)**: - `guideBody` (string,null) **(required)**: - `guideMediaKey` (string,null) **(required)**: - `guideMediaType` (string,null) **(required)**: Values: `image`, `video`, `null` - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `action` (string) **(required)**: - `message` (string) **(required)**: ### 400: Invalid request ### 403: Only labs can delete categories ### 404: Category not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/categories/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a category `PUT https://api-stage.guidelab.co/categories/{id}` Update an existing product category. Validates nesting constraints if parentId is changed. Documentation: https://docs.guidelab.co/api-reference/categories/updateCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Category ID ## Request Body Content-Type: `application/json` - `name` (string): - `subtitle` (string): - `description` (string): - `parentId` (string): - `icon` (string): - `imageAspectRatio` (string): (default: `square`) Values: `square`, `wide` - `guideTitle` (string): - `guideBody` (string): - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 200: Category successfully updated - `category` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `parentId` (string,null) **(required)**: - `name` (string) **(required)**: - `subtitle` (string,null) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `imageAspectRatio` (string) **(required)**: Values: `square`, `wide` - `guideTitle` (string,null) **(required)**: - `guideBody` (string,null) **(required)**: - `guideMediaKey` (string,null) **(required)**: - `guideMediaType` (string,null) **(required)**: Values: `image`, `video`, `null` - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body or self-referencing parent ### 403: Only labs can update categories ### 404: Category or parent category not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/categories/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Get category image `GET https://api-stage.guidelab.co/categories/{id}/image` Retrieve the image associated with a product category from R2 storage. Returns the raw image binary with appropriate content-type headers. Documentation: https://docs.guidelab.co/api-reference/categories/getCategoryImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Category ID ## Responses ### 200: Category image binary data ## Example ```bash curl -X GET "https://api-stage.guidelab.co/categories/{id}/image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload category image `POST https://api-stage.guidelab.co/categories/{id}/image` Upload or replace the image for a product category. Accepts JPEG, PNG, WebP, or GIF up to 5MB via multipart form data. Documentation: https://docs.guidelab.co/api-reference/categories/uploadCategoryImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Category ID ## Responses ### 200: Image successfully uploaded - `category` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `parentId` (string,null) **(required)**: - `name` (string) **(required)**: - `subtitle` (string,null) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `imageAspectRatio` (string) **(required)**: Values: `square`, `wide` - `guideTitle` (string,null) **(required)**: - `guideBody` (string,null) **(required)**: - `guideMediaKey` (string,null) **(required)**: - `guideMediaType` (string,null) **(required)**: Values: `image`, `video`, `null` - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid file type or file too large ### 403: Only labs can upload category images ### 404: Category not found ### 500: Internal server error or storage not configured ## Example ```bash curl -X POST "https://api-stage.guidelab.co/categories/{id}/image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete category image `DELETE https://api-stage.guidelab.co/categories/{id}/image` Remove the image associated with a product category from R2 storage and clear the imageKey reference. Documentation: https://docs.guidelab.co/api-reference/categories/deleteCategoryImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Category ID ## Responses ### 200: Category image successfully removed - `category` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `parentId` (string,null) **(required)**: - `name` (string) **(required)**: - `subtitle` (string,null) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `imageAspectRatio` (string) **(required)**: Values: `square`, `wide` - `guideTitle` (string,null) **(required)**: - `guideBody` (string,null) **(required)**: - `guideMediaKey` (string,null) **(required)**: - `guideMediaType` (string,null) **(required)**: Values: `image`, `video`, `null` - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `message` (string) **(required)**: ### 400: Category has no image ### 403: Only labs can delete category images ### 404: Category not found ### 500: Internal server error or storage not configured ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/categories/{id}/image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get category guide media `GET https://api-stage.guidelab.co/categories/{id}/guide-media` Retrieve the decision-guide media (image or video) for a product category from R2 storage. Returns the raw binary with appropriate content-type headers. Documentation: https://docs.guidelab.co/api-reference/categories/getCategoryGuideMedia ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Category ID ## Responses ### 200: Guide media binary data ## Example ```bash curl -X GET "https://api-stage.guidelab.co/categories/{id}/guide-media" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload category guide media `POST https://api-stage.guidelab.co/categories/{id}/guide-media` Upload or replace the decision-guide media for a product category. Accepts image (JPEG/PNG/WebP/GIF up to 5MB) or video (MP4/WebM up to 20MB) via multipart form data. Documentation: https://docs.guidelab.co/api-reference/categories/uploadCategoryGuideMedia ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Category ID ## Responses ### 200: Guide media successfully uploaded - `category` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `parentId` (string,null) **(required)**: - `name` (string) **(required)**: - `subtitle` (string,null) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `imageAspectRatio` (string) **(required)**: Values: `square`, `wide` - `guideTitle` (string,null) **(required)**: - `guideBody` (string,null) **(required)**: - `guideMediaKey` (string,null) **(required)**: - `guideMediaType` (string,null) **(required)**: Values: `image`, `video`, `null` - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid file type or file too large ### 403: Only labs can upload category guide media ### 404: Category not found ### 500: Internal server error or storage not configured ## Example ```bash curl -X POST "https://api-stage.guidelab.co/categories/{id}/guide-media" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete category guide media `DELETE https://api-stage.guidelab.co/categories/{id}/guide-media` Remove the decision-guide media for a product category from R2 storage and clear the guideMediaKey reference. Documentation: https://docs.guidelab.co/api-reference/categories/deleteCategoryGuideMedia ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Category ID ## Responses ### 200: Guide media successfully removed - `category` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `parentId` (string,null) **(required)**: - `name` (string) **(required)**: - `subtitle` (string,null) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `imageAspectRatio` (string) **(required)**: Values: `square`, `wide` - `guideTitle` (string,null) **(required)**: - `guideBody` (string,null) **(required)**: - `guideMediaKey` (string,null) **(required)**: - `guideMediaType` (string,null) **(required)**: Values: `image`, `video`, `null` - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `message` (string) **(required)**: ### 400: Category has no guide media ### 403: Only labs can delete category guide media ### 404: Category not found ### 500: Internal server error or storage not configured ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/categories/{id}/guide-media" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List bundles `GET https://api-stage.guidelab.co/bundles` Retrieve a paginated list of product bundles for the authenticated lab, with optional filtering by category, search term, and visibility status. Documentation: https://docs.guidelab.co/api-reference/bundles/listBundles ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (string) (in: query): - `limit` (string) (in: query): - `search` (string) (in: query): - `categoryId` (string) (in: query): - `includeInactive` (string) (in: query): - `includeHidden` (string) (in: query): - `sortBy` (string) (in: query): - `sortOrder` (string) (in: query): - `labId` (string) (in: query): ## Responses ### 200: Paginated list of bundles with their items - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 403: User does not have permission to access bundles ### 404: Not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/bundles" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a bundle `POST https://api-stage.guidelab.co/bundles` Create a new product bundle with at least 2 products. Validates that all referenced products and category belong to the lab, and checks SKU uniqueness. Documentation: https://docs.guidelab.co/api-reference/bundles/createBundle ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `sku` (string): - `description` (string): - `categoryId` (string): - `bundlePrice` (string) **(required)**: - `isActive` (boolean): (default: `true`) - `isHidden` (boolean): (default: `false`) - `sortOrder` (integer): (default: `0`) - `shareTeeth` (boolean): (default: `false`) - `shareMaterial` (boolean): (default: `false`) - `shareShade` (boolean): (default: `false`) - `quantityEnabled` (boolean): (default: `false`) - `items` (object[]) **(required)**: - `productId` (string) **(required)**: - `sortOrder` (integer): (default: `0`) ## Responses ### 201: Bundle successfully created with its items - `bundle` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `description` (string,null) **(required)**: - `bundlePrice` (string) **(required)**: - `isActive` (boolean) **(required)**: - `isHidden` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `shareTeeth` (boolean) **(required)**: - `shareMaterial` (boolean) **(required)**: - `shareShade` (boolean) **(required)**: - `quantityEnabled` (boolean) **(required)**: - `createdAt` (object): - `updatedAt` (object): - `items` (object[]) **(required)**: - `id` (string) **(required)**: - `bundleId` (string) **(required)**: - `productId` (string) **(required)**: - `sortOrder` (number) **(required)**: - `product` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `defaultPrice` (string,null) **(required)**: ### 400: Invalid request body or products not found ### 403: Only labs can create bundles ### 404: Category not found ### 409: A bundle with this SKU already exists ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/bundles" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "bundlePrice": "string", "items": [ { "productId": "string", "sortOrder": 0 } ] }' ``` --- # Get a bundle `GET https://api-stage.guidelab.co/bundles/{id}` Retrieve a single bundle by its ID, including its items with full product details and category information. Documentation: https://docs.guidelab.co/api-reference/bundles/getBundle ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Bundle ID ## Responses ### 200: Bundle details with items and category - `bundle` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `description` (string,null) **(required)**: - `bundlePrice` (string) **(required)**: - `isActive` (boolean) **(required)**: - `isHidden` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `shareTeeth` (boolean) **(required)**: - `shareMaterial` (boolean) **(required)**: - `shareShade` (boolean) **(required)**: - `quantityEnabled` (boolean) **(required)**: - `createdAt` (object): - `updatedAt` (object): - `items` (object[]) **(required)**: - `id` (string) **(required)**: - `bundleId` (string) **(required)**: - `productId` (string) **(required)**: - `sortOrder` (number) **(required)**: - `product` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `defaultPrice` (string,null) **(required)**: - `category` (object,null) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: ### 400: Invalid request ### 403: User does not have permission to view this bundle ### 404: Bundle not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/bundles/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Partially update a bundle `PATCH https://api-stage.guidelab.co/bundles/{id}` Partially update a bundle's boolean flags such as isActive, isHidden, shareTeeth, shareMaterial, shareShade, or quantityEnabled. Documentation: https://docs.guidelab.co/api-reference/bundles/patchBundle ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Bundle ID ## Request Body Content-Type: `application/json` - `isActive` (boolean): - `isHidden` (boolean): - `shareTeeth` (boolean): - `shareMaterial` (boolean): - `shareShade` (boolean): - `quantityEnabled` (boolean): ## Responses ### 200: Bundle partially updated - `bundle` (object): ### 400: Invalid request ### 403: Only labs can modify bundles ### 404: Bundle not found ### 500: Internal server error ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/bundles/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "isActive": true, "isHidden": true, "shareTeeth": true, "shareMaterial": true, "shareShade": true, "quantityEnabled": true }' ``` --- # Delete a bundle `DELETE https://api-stage.guidelab.co/bundles/{id}` Soft-delete a bundle by setting it to inactive. The bundle record and its items are preserved for historical reference. Documentation: https://docs.guidelab.co/api-reference/bundles/deleteBundle ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Bundle ID ## Responses ### 200: Bundle deactivated successfully - `success` (boolean) **(required)**: ### 400: Invalid request ### 403: Only labs can delete bundles ### 404: Bundle not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/bundles/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a bundle `PUT https://api-stage.guidelab.co/bundles/{id}` Update an existing bundle's properties and optionally replace its items. Validates category, products ownership, and SKU uniqueness. Documentation: https://docs.guidelab.co/api-reference/bundles/updateBundle ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Bundle ID ## Request Body Content-Type: `application/json` - `name` (string): - `sku` (string): - `description` (string): - `categoryId` (string): - `bundlePrice` (string): - `isActive` (boolean): (default: `true`) - `isHidden` (boolean): (default: `false`) - `sortOrder` (integer): (default: `0`) - `shareTeeth` (boolean): (default: `false`) - `shareMaterial` (boolean): (default: `false`) - `shareShade` (boolean): (default: `false`) - `quantityEnabled` (boolean): (default: `false`) - `items` (object[]): - `productId` (string) **(required)**: - `sortOrder` (integer): (default: `0`) ## Responses ### 200: Bundle successfully updated with its items - `bundle` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `description` (string,null) **(required)**: - `bundlePrice` (string) **(required)**: - `isActive` (boolean) **(required)**: - `isHidden` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `shareTeeth` (boolean) **(required)**: - `shareMaterial` (boolean) **(required)**: - `shareShade` (boolean) **(required)**: - `quantityEnabled` (boolean) **(required)**: - `createdAt` (object): - `updatedAt` (object): - `items` (object[]) **(required)**: - `id` (string) **(required)**: - `bundleId` (string) **(required)**: - `productId` (string) **(required)**: - `sortOrder` (number) **(required)**: - `product` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `defaultPrice` (string,null) **(required)**: ### 400: Invalid request body or products not found ### 403: Only labs can update bundles ### 404: Bundle or category not found ### 409: A bundle with this SKU already exists ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/bundles/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # List materials `GET https://api-stage.guidelab.co/materials` Retrieve a paginated list of materials for the authenticated lab, with optional search and inactive filtering. Documentation: https://docs.guidelab.co/api-reference/materials/listMaterials ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` (string) (in: query): - `search` (string) (in: query): - `page` (string) (in: query): - `limit` (string) (in: query): - `labId` (string) (in: query): ## Responses ### 200: Paginated list of materials - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `valuePerGram` (string,null) **(required)**: - `description` (string,null) **(required)**: - `iconKey` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 403: User does not have permission to access materials ### 404: Lab not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/materials" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a material `POST https://api-stage.guidelab.co/materials` Create a new material in the lab's catalog. Materials carry cost information such as value per gram; markup is configured per product on the product-material association. Documentation: https://docs.guidelab.co/api-reference/materials/createMaterial ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `code` (string): - `valuePerGram` (string,null): - `description` (string): - `isActive` (boolean): (default: `true`) - `sortOrder` (integer): (default: `0`) ## Responses ### 201: Material successfully created - `material` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `valuePerGram` (string,null) **(required)**: - `description` (string,null) **(required)**: - `iconKey` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 403: Only labs can create materials ### 404: Not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/materials" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "code": "string", "valuePerGram": "string", "description": "string", "isActive": true, "sortOrder": 0 }' ``` --- # Get a material `GET https://api-stage.guidelab.co/materials/{id}` Retrieve a single material by its ID. Clinic users must have an active partnership with the owning lab. Documentation: https://docs.guidelab.co/api-reference/materials/getMaterial ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Material ID ## Responses ### 200: Material details - `material` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `valuePerGram` (string,null) **(required)**: - `description` (string,null) **(required)**: - `iconKey` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request ### 403: User does not have permission to view this material ### 404: Material not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/materials/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete a material `DELETE https://api-stage.guidelab.co/materials/{id}` Soft-delete a material by setting it to inactive. The material record is preserved for historical reference. Documentation: https://docs.guidelab.co/api-reference/materials/deleteMaterial ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Material ID ## Responses ### 200: Material deactivated successfully - `material` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `valuePerGram` (string,null) **(required)**: - `description` (string,null) **(required)**: - `iconKey` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `message` (string) **(required)**: ### 400: Invalid request ### 403: Only labs can delete materials ### 404: Material not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/materials/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a material `PUT https://api-stage.guidelab.co/materials/{id}` Update an existing material's properties including name, code, pricing, and active status. Documentation: https://docs.guidelab.co/api-reference/materials/updateMaterial ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Material ID ## Request Body Content-Type: `application/json` - `name` (string): - `code` (string): - `valuePerGram` (string,null): - `description` (string): - `isActive` (boolean): (default: `true`) - `sortOrder` (integer): (default: `0`) ## Responses ### 200: Material successfully updated - `material` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `valuePerGram` (string,null) **(required)**: - `description` (string,null) **(required)**: - `iconKey` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 403: Only labs can update materials ### 404: Material not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/materials/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "code": "string", "valuePerGram": "string", "description": "string", "isActive": true, "sortOrder": 0 }' ``` --- # Get material icon `GET https://api-stage.guidelab.co/materials/{id}/icon` Retrieve the icon image associated with a material from R2 storage. Returns the raw image binary with appropriate content-type headers. Documentation: https://docs.guidelab.co/api-reference/materials/getMaterialIcon ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Material ID ## Responses ### 200: Material icon binary data ### 404: Material or icon not found ### 500: Storage not configured ## Example ```bash curl -X GET "https://api-stage.guidelab.co/materials/{id}/icon" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload material icon `POST https://api-stage.guidelab.co/materials/{id}/icon` Upload or replace the icon for a material. Accepts JPEG, PNG, WebP, or GIF up to 5MB via multipart form data. Documentation: https://docs.guidelab.co/api-reference/materials/uploadMaterialIcon ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Material ID ## Responses ### 200: Icon successfully uploaded - `material` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `valuePerGram` (string,null) **(required)**: - `description` (string,null) **(required)**: - `iconKey` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid file type or file too large ### 403: Only labs can upload material icons ### 404: Material not found ### 500: Internal server error or storage not configured ## Example ```bash curl -X POST "https://api-stage.guidelab.co/materials/{id}/icon" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete material icon `DELETE https://api-stage.guidelab.co/materials/{id}/icon` Remove the icon associated with a material from R2 storage and clear the iconKey reference. Documentation: https://docs.guidelab.co/api-reference/materials/deleteMaterialIcon ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Material ID ## Responses ### 200: Material icon successfully removed - `material` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `valuePerGram` (string,null) **(required)**: - `description` (string,null) **(required)**: - `iconKey` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `message` (string) **(required)**: ### 400: Material has no icon ### 403: Only labs can delete material icons ### 404: Material not found ### 500: Internal server error or storage not configured ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/materials/{id}/icon" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List file requirements `GET https://api-stage.guidelab.co/file-requirements` List the lab's file requirement library entries with usage counts. Documentation: https://docs.guidelab.co/api-reference/file-requirements/listFileRequirements ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeArchived` (string) (in: query): - `search` (string) (in: query): - `page` (string) (in: query): - `limit` (string) (in: query): ## Responses ### 200: Paginated list of file requirements - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `acceptedExtensions` (string[]) **(required)**: - `sortOrder` (number) **(required)**: - `archivedAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `productsUsingCount` (number): - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 403: Forbidden ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/file-requirements" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create file requirement `POST https://api-stage.guidelab.co/file-requirements` Create a new file requirement library entry. Documentation: https://docs.guidelab.co/api-reference/file-requirements/createFileRequirement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `description` (string,null): - `acceptedExtensions` (string[]) **(required)**: - `sortOrder` (integer): (default: `0`) ## Responses ### 201: Created - `fileRequirement` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `acceptedExtensions` (string[]) **(required)**: - `sortOrder` (number) **(required)**: - `archivedAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `productsUsingCount` (number): ### 400: Invalid request body ### 403: Forbidden ## Example ```bash curl -X POST "https://api-stage.guidelab.co/file-requirements" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "acceptedExtensions": [ "string" ], "sortOrder": 0 }' ``` --- # Get file requirement `GET https://api-stage.guidelab.co/file-requirements/{id}` Get a single file requirement library entry. Documentation: https://docs.guidelab.co/api-reference/file-requirements/getFileRequirement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: OK - `fileRequirement` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `acceptedExtensions` (string[]) **(required)**: - `sortOrder` (number) **(required)**: - `archivedAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `productsUsingCount` (number): ### 404: Not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/file-requirements/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Archive file requirement `DELETE https://api-stage.guidelab.co/file-requirements/{id}` Archive a file requirement library entry. Rejects if any products currently reference it. Documentation: https://docs.guidelab.co/api-reference/file-requirements/archiveFileRequirement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Archived - `fileRequirement` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `acceptedExtensions` (string[]) **(required)**: - `sortOrder` (number) **(required)**: - `archivedAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `productsUsingCount` (number): ### 404: Not found ### 409: In use by one or more products ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/file-requirements/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update file requirement `PUT https://api-stage.guidelab.co/file-requirements/{id}` Update a file requirement library entry. Documentation: https://docs.guidelab.co/api-reference/file-requirements/updateFileRequirement ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `name` (string): - `description` (string,null): - `acceptedExtensions` (string[]): - `sortOrder` (integer): (default: `0`) ## Responses ### 200: OK - `fileRequirement` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `acceptedExtensions` (string[]) **(required)**: - `sortOrder` (number) **(required)**: - `archivedAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `productsUsingCount` (number): ### 404: Not found ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/file-requirements/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "acceptedExtensions": [ "string" ], "sortOrder": 0 }' ``` --- # List shade systems `GET https://api-stage.guidelab.co/shade-systems` Retrieve shade systems and their stable values for the requested lab. Documentation: https://docs.guidelab.co/api-reference/shade-systems/listShadeSystems ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` (string) (in: query): - `defaultOnly` (string) (in: query): - `labId` (string) (in: query): ## Responses ### 200: List of shade systems (or the default system) ### 400: Invalid query parameters ### 403: User does not have permission ### 404: Lab not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/shade-systems" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a shade system `POST https://api-stage.guidelab.co/shade-systems` Create a shade system and its stable value rows. Documentation: https://docs.guidelab.co/api-reference/shade-systems/createShadeSystem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `description` (string): - `isDefault` (boolean): (default: `false`) - `isActive` (boolean): (default: `true`) - `sortOrder` (integer): (default: `0`) - `values` (object[]): (default: ``) - `id` (string): - `code` (string) **(required)**: - `label` (string): - `sortOrder` (integer): - `isActive` (boolean): ## Responses ### 201: Shade system created - `system` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `values` (object[]) **(required)**: - `id` (string) **(required)**: - `code` (string) **(required)**: - `label` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `images` (object) **(required)**: - `occlusal` (string,null) **(required)**: - `middle` (string,null) **(required)**: - `gingival` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 403: Only labs can create shade systems ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/shade-systems" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "isDefault": true, "isActive": true, "sortOrder": 0, "values": [ { "id": "string", "code": "string", "label": "string", "sortOrder": 0, "isActive": true } ] }' ``` --- # Get a shade system `GET https://api-stage.guidelab.co/shade-systems/{id}` Retrieve one shade system. Clinic users require a partnership with its lab. Documentation: https://docs.guidelab.co/api-reference/shade-systems/getShadeSystem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Shade system - `system` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `values` (object[]) **(required)**: - `id` (string) **(required)**: - `code` (string) **(required)**: - `label` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `images` (object) **(required)**: - `occlusal` (string,null) **(required)**: - `middle` (string,null) **(required)**: - `gingival` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 403: Forbidden ### 404: Shade system not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/shade-systems/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Patch a shade system `PATCH https://api-stage.guidelab.co/shade-systems/{id}` Perform a shade-system action. Documentation: https://docs.guidelab.co/api-reference/shade-systems/patchShadeSystem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `action` (string): ## Responses ### 200: Action completed - `system` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `values` (object[]) **(required)**: - `id` (string) **(required)**: - `code` (string) **(required)**: - `label` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `images` (object) **(required)**: - `occlusal` (string,null) **(required)**: - `middle` (string,null) **(required)**: - `gingival` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid action ### 403: Only labs can update shade systems ### 404: Shade system not found ### 500: Internal server error ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/shade-systems/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "action": "string" }' ``` --- # Delete a shade system `DELETE https://api-stage.guidelab.co/shade-systems/{id}` Soft-delete a non-default shade system. Documentation: https://docs.guidelab.co/api-reference/shade-systems/deleteShadeSystem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Shade system deactivated - `system` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `values` (object[]) **(required)**: - `id` (string) **(required)**: - `code` (string) **(required)**: - `label` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `images` (object) **(required)**: - `occlusal` (string,null) **(required)**: - `middle` (string,null) **(required)**: - `gingival` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `message` (string) **(required)**: ### 400: Cannot delete the default shade system ### 403: Only labs can delete shade systems ### 404: Shade system not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/shade-systems/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a shade system `PUT https://api-stage.guidelab.co/shade-systems/{id}` Update a shade system and reconcile stable values by ID. Renames preserve image assets. Documentation: https://docs.guidelab.co/api-reference/shade-systems/updateShadeSystem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `name` (string): - `description` (string): - `isDefault` (boolean): - `isActive` (boolean): - `sortOrder` (integer): - `values` (object[]): - `id` (string): - `code` (string) **(required)**: - `label` (string): - `sortOrder` (integer): - `isActive` (boolean): ## Responses ### 200: Shade system updated - `system` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `values` (object[]) **(required)**: - `id` (string) **(required)**: - `code` (string) **(required)**: - `label` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `images` (object) **(required)**: - `occlusal` (string,null) **(required)**: - `middle` (string,null) **(required)**: - `gingival` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body or value identity ### 403: Only labs can update shade systems ### 404: Shade system not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/shade-systems/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "isDefault": true, "isActive": true, "sortOrder": 0, "values": [ { "id": "string", "code": "string", "label": "string", "sortOrder": 0, "isActive": true } ] }' ``` --- # Get shade value image `GET https://api-stage.guidelab.co/shade-systems/{id}/values/{valueId}/image` Stream a stable shade value's position image. Documentation: https://docs.guidelab.co/api-reference/shade-systems/getShadeValueImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `valueId` (string) **(required)** (in: path): - `position` (string) **(required)** (in: query): Values: `occlusal`, `middle`, `gingival` ## Responses ### 200: Image binary data ### 404: Image not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/shade-systems/{id}/values/{valueId}/image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload shade value image `POST https://api-stage.guidelab.co/shade-systems/{id}/values/{valueId}/image` Upload or replace one position image for a stable shade value (maximum 5MB). Documentation: https://docs.guidelab.co/api-reference/shade-systems/uploadShadeValueImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `valueId` (string) **(required)** (in: path): - `position` (string) **(required)** (in: query): Values: `occlusal`, `middle`, `gingival` ## Responses ### 200: Image uploaded - `system` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `values` (object[]) **(required)**: - `id` (string) **(required)**: - `code` (string) **(required)**: - `label` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `images` (object) **(required)**: - `occlusal` (string,null) **(required)**: - `middle` (string,null) **(required)**: - `gingival` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `url` (string,null) **(required)**: ### 400: Invalid file or position ### 403: Only labs can upload shade value images ### 404: Shade system or value not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/shade-systems/{id}/values/{valueId}/image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete shade value image `DELETE https://api-stage.guidelab.co/shade-systems/{id}/values/{valueId}/image` Clear and enqueue deletion of one shade-value image. Documentation: https://docs.guidelab.co/api-reference/shade-systems/deleteShadeValueImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `valueId` (string) **(required)** (in: path): - `position` (string) **(required)** (in: query): Values: `occlusal`, `middle`, `gingival` ## Responses ### 200: Image removed - `system` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `values` (object[]) **(required)**: - `id` (string) **(required)**: - `code` (string) **(required)**: - `label` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `images` (object) **(required)**: - `occlusal` (string,null) **(required)**: - `middle` (string,null) **(required)**: - `gingival` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: No image for this value/position ### 403: Only labs can delete shade value images ### 404: Shade value not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/shade-systems/{id}/values/{valueId}/image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List implant systems `GET https://api-stage.guidelab.co/implant-systems` Retrieve all persisted implant systems for the authenticated lab, including their inline platforms list. Organization defaults are initialized during creation or by the explicit settings-defaults command. Documentation: https://docs.guidelab.co/api-reference/implant-systems/listImplantSystems ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` (string) (in: query): - `defaultOnly` (string) (in: query): - `labId` (string) (in: query): ## Responses ### 200: List of implant systems (or the default, when defaultOnly) ### 400: Invalid query parameters ### 403: User does not have permission ### 404: Lab not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/implant-systems" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create an implant system `POST https://api-stage.guidelab.co/implant-systems` Create a new implant system with an inline list of platforms (connections + diameters). Documentation: https://docs.guidelab.co/api-reference/implant-systems/createImplantSystem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `manufacturer` (string): - `description` (string): - `isDefault` (boolean): (default: `false`) - `isActive` (boolean): (default: `true`) - `sortOrder` (integer): (default: `0`) - `platforms` (object[]): (default: ``) - `code` (string) **(required)**: - `label` (string) **(required)**: - `diameter` (string): - `isActive` (boolean): (default: `true`) ## Responses ### 201: Implant system created - `system` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `manufacturer` (string,null) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `platforms` (object[]) **(required)**: - `code` (string) **(required)**: - `label` (string) **(required)**: - `diameter` (string): - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 403: Only labs can create implant systems ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/implant-systems" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string" }' ``` --- # Get an implant system `GET https://api-stage.guidelab.co/implant-systems/{id}` Retrieve a single implant system by its ID. Clinic users must have an active partnership with the owning lab. Documentation: https://docs.guidelab.co/api-reference/implant-systems/getImplantSystem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Implant system ID ## Responses ### 200: Implant system - `system` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `manufacturer` (string,null) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `platforms` (object[]) **(required)**: - `code` (string) **(required)**: - `label` (string) **(required)**: - `diameter` (string): - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 403: Forbidden ### 404: Implant system not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/implant-systems/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Patch an implant system `PATCH https://api-stage.guidelab.co/implant-systems/{id}` Perform an action on an implant system (e.g. setDefault). Documentation: https://docs.guidelab.co/api-reference/implant-systems/patchImplantSystem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `action` (string): ## Responses ### 200: Action completed - `system` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `manufacturer` (string,null) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `platforms` (object[]) **(required)**: - `code` (string) **(required)**: - `label` (string) **(required)**: - `diameter` (string): - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid action ### 403: Only labs can update implant systems ### 404: Implant system not found ### 500: Internal server error ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/implant-systems/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "action": "string" }' ``` --- # Delete an implant system `DELETE https://api-stage.guidelab.co/implant-systems/{id}` Soft-delete an implant system by setting it inactive. Documentation: https://docs.guidelab.co/api-reference/implant-systems/deleteImplantSystem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Implant system deactivated - `system` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `manufacturer` (string,null) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `platforms` (object[]) **(required)**: - `code` (string) **(required)**: - `label` (string) **(required)**: - `diameter` (string): - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `message` (string) **(required)**: ### 400: Cannot delete the default implant system ### 403: Only labs can delete implant systems ### 404: Implant system not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/implant-systems/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update an implant system `PUT https://api-stage.guidelab.co/implant-systems/{id}` Update an existing implant system's properties, including the full inline platforms array. Documentation: https://docs.guidelab.co/api-reference/implant-systems/updateImplantSystem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `name` (string): - `manufacturer` (string): - `description` (string): - `isDefault` (boolean): (default: `false`) - `isActive` (boolean): (default: `true`) - `sortOrder` (integer): (default: `0`) - `platforms` (object[]): (default: ``) - `code` (string) **(required)**: - `label` (string) **(required)**: - `diameter` (string): - `isActive` (boolean): (default: `true`) ## Responses ### 200: Implant system updated - `system` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `manufacturer` (string,null) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `platforms` (object[]) **(required)**: - `code` (string) **(required)**: - `label` (string) **(required)**: - `diameter` (string): - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 403: Only labs can update implant systems ### 404: Implant system not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/implant-systems/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # List components `GET https://api-stage.guidelab.co/components` Retrieve all lab components (e.g. implant components) ordered by sort position, optionally including inactive ones. Documentation: https://docs.guidelab.co/api-reference/components/listComponents ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` (string) (in: query): ## Responses ### 200: List of lab components - `components` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `truncated` (boolean) **(required)**: True when the lab holds more components than one response returns. The list is capped, not refused. ### 400: Invalid query parameters ### 403: Only labs can manage components ### 404: Not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/components" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a component `POST https://api-stage.guidelab.co/components` Create a new lab component. If sortOrder is not specified, it is automatically set to the next available position. Documentation: https://docs.guidelab.co/api-reference/components/createComponent ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `sortOrder` (integer): ## Responses ### 201: Component successfully created - `component` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 403: Only labs can manage components ### 404: Lab not found ### 409: Component row limit reached ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/components" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "sortOrder": 0 }' ``` --- # Reorder components `POST https://api-stage.guidelab.co/components/reorder` Bulk reorder lab components by providing an ordered array of component IDs. Sort positions are assigned sequentially starting from 0. Documentation: https://docs.guidelab.co/api-reference/components/reorderComponents ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `componentIds` (string[]) **(required)**: ## Responses ### 200: Components successfully reordered - `success` (boolean) **(required)**: ### 400: Invalid request body ### 403: Only labs can manage components ### 404: One or more components not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/components/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "componentIds": [ "string" ] }' ``` --- # Get component settings `GET https://api-stage.guidelab.co/components/settings` Retrieve the lab's component display settings, such as whether components are shown in the order page. Documentation: https://docs.guidelab.co/api-reference/components/getComponentSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Component display settings - `settings` (object) **(required)**: - `id` (string,null) **(required)**: - `labId` (string) **(required)**: - `showInOrderPage` (boolean) **(required)**: - `createdAt` (string,null) **(required)**: - `updatedAt` (string,null) **(required)**: ### 400: Invalid request ### 403: Only labs can manage components ### 404: Not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/components/settings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update component settings `PUT https://api-stage.guidelab.co/components/settings` Update the lab's component display settings. Creates the settings record if it does not yet exist. Documentation: https://docs.guidelab.co/api-reference/components/updateComponentSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `showInOrderPage` (boolean) **(required)**: ## Responses ### 200: Component settings successfully updated - `settings` (object) **(required)**: - `id` (string,null) **(required)**: - `labId` (string) **(required)**: - `showInOrderPage` (boolean) **(required)**: - `createdAt` (string,null) **(required)**: - `updatedAt` (string,null) **(required)**: ### 400: Invalid request body ### 403: Only labs can manage components ### 404: Not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/components/settings" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "showInOrderPage": true }' ``` --- # Delete a component `DELETE https://api-stage.guidelab.co/components/{id}` Soft-delete a lab component by setting it to inactive. The component record is preserved for historical reference. Documentation: https://docs.guidelab.co/api-reference/components/deleteComponent ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Component ID ## Responses ### 200: Component deactivated successfully - `component` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request ### 403: Only labs can manage components ### 404: Component not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/components/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a component `PUT https://api-stage.guidelab.co/components/{id}` Update an existing lab component's name or active status. Documentation: https://docs.guidelab.co/api-reference/components/updateComponent ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Component ID ## Request Body Content-Type: `application/json` - `name` (string): - `isActive` (boolean): ## Responses ### 200: Component successfully updated - `component` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 403: Only labs can manage components ### 404: Component not found ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/components/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "isActive": true }' ``` --- # List treatment phases `GET https://api-stage.guidelab.co/treatment-phases` Retrieve all treatment phases for the authenticated lab, including their ordered task list and task counts. Documentation: https://docs.guidelab.co/api-reference/treatment-phases/listTreatmentPhases ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of treatment phases with their tasks - `phases` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `defaultOffsetDays` (number) **(required)**: - `isActive` (boolean) **(required)**: - `color` (string,null): - `startPolicy` (string) **(required)**: - `leadTimeDays` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `taskCount` (number): - `tasks` (object[]): - `id` (string) **(required)**: - `taskId` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `clinicVisible` (boolean) **(required)**: - `clinicTitle` (string,null) **(required)**: - `task` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `color` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `completionTrigger` (string) **(required)**: ### 400: Invalid request ### 403: Only labs can access treatment phases ### 404: Not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/treatment-phases" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a treatment phase `POST https://api-stage.guidelab.co/treatment-phases` Create a new treatment phase with an optional ordered task list. The phase sort order is set to the next available position. Documentation: https://docs.guidelab.co/api-reference/treatment-phases/createTreatmentPhase ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `description` (string,null): - `defaultOffsetDays` (integer): - `color` (string,null): - `startPolicy` (string): Values: `ask`, `always`, `never` - `leadTimeDays` (integer): - `tasks` (object[]): - `id` (string): - `taskId` (string) **(required)**: - `clinicVisible` (boolean): - `clinicTitle` (string,null): - `isActive` (boolean): ## Responses ### 201: Treatment phase successfully created with its tasks - `phase` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `defaultOffsetDays` (number) **(required)**: - `isActive` (boolean) **(required)**: - `color` (string,null): - `startPolicy` (string) **(required)**: - `leadTimeDays` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `taskCount` (number): - `tasks` (object[]): - `id` (string) **(required)**: - `taskId` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `clinicVisible` (boolean) **(required)**: - `clinicTitle` (string,null) **(required)**: - `task` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `color` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `completionTrigger` (string) **(required)**: ### 400: Invalid request body or task references unknown task ### 403: Only labs can create treatment phases ### 404: Not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/treatment-phases" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string" }' ``` --- # Reorder treatment phases `POST https://api-stage.guidelab.co/treatment-phases/reorder` Bulk reorder treatment phases by providing an ordered array of phase IDs. Sort positions are assigned sequentially starting from 0. Documentation: https://docs.guidelab.co/api-reference/treatment-phases/reorderTreatmentPhases ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `phaseIds` (string[]) **(required)**: ## Responses ### 200: Treatment phases successfully reordered - `success` (boolean) **(required)**: ### 400: Invalid phaseIds array ### 403: Only labs can reorder treatment phases ### 404: One or more phases not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/treatment-phases/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "phaseIds": [ "string" ] }' ``` --- # Get a treatment phase `GET https://api-stage.guidelab.co/treatment-phases/{id}` Retrieve a single treatment phase by its ID, including its ordered task list. Documentation: https://docs.guidelab.co/api-reference/treatment-phases/getTreatmentPhase ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Treatment phase ID ## Responses ### 200: Treatment phase details with tasks - `phase` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `defaultOffsetDays` (number) **(required)**: - `isActive` (boolean) **(required)**: - `color` (string,null): - `startPolicy` (string) **(required)**: - `leadTimeDays` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `taskCount` (number): - `tasks` (object[]): - `id` (string) **(required)**: - `taskId` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `clinicVisible` (boolean) **(required)**: - `clinicTitle` (string,null) **(required)**: - `task` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `color` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `completionTrigger` (string) **(required)**: ### 400: Invalid request ### 403: Only labs can access treatment phases ### 404: Treatment phase not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/treatment-phases/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete a treatment phase `DELETE https://api-stage.guidelab.co/treatment-phases/{id}` Permanently delete a treatment phase and its task list. Fails if the phase is referenced by any products or order phases. Documentation: https://docs.guidelab.co/api-reference/treatment-phases/deleteTreatmentPhase ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Treatment phase ID ## Responses ### 200: Treatment phase successfully deleted - `success` (boolean) **(required)**: ### 400: Invalid request ### 403: Only labs can delete treatment phases ### 404: Treatment phase not found ### 409: Phase is referenced by products or order phases ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/treatment-phases/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a treatment phase `PUT https://api-stage.guidelab.co/treatment-phases/{id}` Update an existing treatment phase. If `tasks` is provided, the template task list is replaced; existing orders retain their immutable task snapshots. Documentation: https://docs.guidelab.co/api-reference/treatment-phases/updateTreatmentPhase ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Treatment phase ID ## Request Body Content-Type: `application/json` - `name` (string): - `description` (string,null): - `defaultOffsetDays` (integer): - `isActive` (boolean): - `color` (string,null): - `startPolicy` (string): Values: `ask`, `always`, `never` - `leadTimeDays` (integer): - `tasks` (object[]): - `id` (string): - `taskId` (string) **(required)**: - `clinicVisible` (boolean): - `clinicTitle` (string,null): - `isActive` (boolean): ## Responses ### 200: Treatment phase successfully updated with tasks - `phase` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `defaultOffsetDays` (number) **(required)**: - `isActive` (boolean) **(required)**: - `color` (string,null): - `startPolicy` (string) **(required)**: - `leadTimeDays` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `taskCount` (number): - `tasks` (object[]): - `id` (string) **(required)**: - `taskId` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `clinicVisible` (boolean) **(required)**: - `clinicTitle` (string,null) **(required)**: - `task` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `color` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `completionTrigger` (string) **(required)**: ### 400: Invalid request body ### 403: Only labs can update treatment phases ### 404: Treatment phase not found ### 409: The requested lifecycle conflicts with task readiness, default status, or product references ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/treatment-phases/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Reorder tasks within a treatment phase `POST https://api-stage.guidelab.co/treatment-phases/{id}/tasks/reorder` Bulk reorder the task list within a treatment phase by providing an ordered array of phase-task row IDs. Documentation: https://docs.guidelab.co/api-reference/treatment-phases/reorderPhaseTasks ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Treatment phase ID ## Request Body Content-Type: `application/json` - `phaseTaskIds` (string[]) **(required)**: ## Responses ### 200: Phase tasks successfully reordered - `success` (boolean) **(required)**: ### 400: Invalid phaseTaskIds array ### 403: Only labs can reorder phase tasks ### 404: Treatment phase or rows not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/treatment-phases/{id}/tasks/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "phaseTaskIds": [ "string" ] }' ``` --- # List quality standards `GET https://api-stage.guidelab.co/standards` Retrieve all quality standards for the authenticated lab, optionally including inactive ones. Documentation: https://docs.guidelab.co/api-reference/standards/listStandards ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` (string) (in: query): - `labId` (string) (in: query): ## Responses ### 200: List of quality standards - `standards` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid query parameters ### 403: User does not have permission to access standards ### 404: Lab not found ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/standards" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a quality standard `POST https://api-stage.guidelab.co/standards` Create a new quality standard with a unique code (bronze, silver, gold, platinum, na) for the authenticated lab. Documentation: https://docs.guidelab.co/api-reference/standards/createStandard ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `code` (string) **(required)**: Values: `bronze`, `silver`, `gold`, `platinum`, `na` - `description` (string): - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Quality standard successfully created - `standard` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 403: Only labs can create quality standards ### 409: A standard with this code already exists ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/standards" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "code": "bronze", "description": "string", "sortOrder": 0, "isActive": true }' ``` --- # Toggle quality standard active status `PATCH https://api-stage.guidelab.co/standards` Toggle the active/inactive status of a quality standard identified by the id query parameter. Documentation: https://docs.guidelab.co/api-reference/standards/toggleStandard ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: query): ## Responses ### 200: Quality standard active status toggled - `standard` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Missing standard ID ### 403: Only labs can toggle quality standards ### 404: Standard not found ### 500: Internal server error ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/standards" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a quality standard `PUT https://api-stage.guidelab.co/standards` Update an existing quality standard identified by the id query parameter. Validates code uniqueness if the code is being changed. Documentation: https://docs.guidelab.co/api-reference/standards/updateStandard ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: query): ## Request Body Content-Type: `application/json` - `name` (string): - `code` (string): Values: `bronze`, `silver`, `gold`, `platinum`, `na` - `description` (string): - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 200: Quality standard successfully updated - `standard` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string) **(required)**: - `description` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body or missing standard ID ### 403: Only labs can update quality standards ### 404: Standard not found ### 409: A standard with this code already exists ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/standards" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "code": "bronze", "description": "string", "sortOrder": 0, "isActive": true }' ``` --- # List stable price books and their versions `GET https://api-stage.guidelab.co/price-lists` Documentation: https://docs.guidelab.co/api-reference/price-lists/listPriceLists ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Price books and immutable publication history - `priceLists` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] - `archivedAt` (string,null) **(required)**: [date-time] - `archivedBy` (string,null) **(required)**: - `versions` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `priceListId` (string) **(required)**: - `currency` (string) **(required)**: - `publicationNumber` (integer,null) **(required)**: - `defaultDiscountPercent` (string,null) **(required)**: - `revision` (integer) **(required)**: - `effectiveFrom` (string,null) **(required)**: [date-time] - `effectiveUntil` (string,null) **(required)**: [date-time] - `createdBy` (string) **(required)**: - `publishedAt` (string,null) **(required)**: [date-time] - `publishedBy` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: [date-time] - `cancelledBy` (string,null) **(required)**: - `endedEarlyAt` (string,null) **(required)**: [date-time] - `endedEarlyBy` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/price-lists" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a stable price book `POST https://api-stage.guidelab.co/price-lists` Documentation: https://docs.guidelab.co/api-reference/price-lists/createPriceList ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `description` (string,null): - `isDefault` (boolean): (default: `false`) ## Responses ### 201: Price book created - `priceList` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] - `archivedAt` (string,null) **(required)**: [date-time] - `archivedBy` (string,null) **(required)**: ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/price-lists" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "isDefault": true }' ``` --- # Update stable price-book metadata `PATCH https://api-stage.guidelab.co/price-lists/{priceListId}` Documentation: https://docs.guidelab.co/api-reference/price-lists/updatePriceList ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `priceListId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `name` (string): - `description` (string,null): - `isDefault` (boolean): ## Responses ### 200: Price book updated - `priceList` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] - `archivedAt` (string,null) **(required)**: [date-time] - `archivedBy` (string,null) **(required)**: ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/price-lists/{priceListId}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "isDefault": true }' ``` --- # Archive a stable price book `POST https://api-stage.guidelab.co/price-lists/{priceListId}/archive` Documentation: https://docs.guidelab.co/api-reference/price-lists/archivePriceList ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `priceListId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `archived` (boolean) **(required)**: Values: `true` ## Responses ### 200: Price book archived - `priceList` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `isDefault` (boolean) **(required)**: - `createdBy` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] - `archivedAt` (string,null) **(required)**: [date-time] - `archivedBy` (string,null) **(required)**: ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/price-lists/{priceListId}/archive" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "archived": true }' ``` --- # Create the one editable draft for a price book `POST https://api-stage.guidelab.co/price-lists/{priceListId}/versions` Documentation: https://docs.guidelab.co/api-reference/price-lists/createPriceListVersion ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `priceListId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `cloneFromVersionId` (string): ## Responses ### 201: Draft created - `version` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `priceListId` (string) **(required)**: - `currency` (string) **(required)**: - `publicationNumber` (integer,null) **(required)**: - `defaultDiscountPercent` (string,null) **(required)**: - `revision` (integer) **(required)**: - `effectiveFrom` (string,null) **(required)**: [date-time] - `effectiveUntil` (string,null) **(required)**: [date-time] - `createdBy` (string) **(required)**: - `publishedAt` (string,null) **(required)**: [date-time] - `publishedBy` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: [date-time] - `cancelledBy` (string,null) **(required)**: - `endedEarlyAt` (string,null) **(required)**: [date-time] - `endedEarlyBy` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/price-lists/{priceListId}/versions" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "cloneFromVersionId": "string" }' ``` --- # Get a version with its product and bundle rules `GET https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}` Documentation: https://docs.guidelab.co/api-reference/price-lists/getPriceListVersion ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `priceListId` (string) **(required)** (in: path): - `versionId` (string) **(required)** (in: path): ## Responses ### 200: Version detail - `version` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `priceListId` (string) **(required)**: - `currency` (string) **(required)**: - `publicationNumber` (integer,null) **(required)**: - `defaultDiscountPercent` (string,null) **(required)**: - `revision` (integer) **(required)**: - `effectiveFrom` (string,null) **(required)**: [date-time] - `effectiveUntil` (string,null) **(required)**: [date-time] - `createdBy` (string) **(required)**: - `publishedAt` (string,null) **(required)**: [date-time] - `publishedBy` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: [date-time] - `cancelledBy` (string,null) **(required)**: - `endedEarlyAt` (string,null) **(required)**: [date-time] - `endedEarlyBy` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] - `rules` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `priceListVersionId` (string) **(required)**: - `targetKind` (string) **(required)**: Values: `product`, `bundle` - `productId` (string,null) **(required)**: - `bundleId` (string,null) **(required)**: - `fixedPrice` (string,null) **(required)**: - `discountPercent` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] - `productRules` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `priceListVersionId` (string) **(required)**: - `productId` (string) **(required)**: - `fixedPrice` (string,null) **(required)**: - `discountPercent` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] - `bundleRules` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `priceListVersionId` (string) **(required)**: - `bundleId` (string) **(required)**: - `fixedPrice` (string,null) **(required)**: - `discountPercent` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update draft defaults with optimistic concurrency `PATCH https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}` Documentation: https://docs.guidelab.co/api-reference/price-lists/updatePriceListVersion ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `priceListId` (string) **(required)** (in: path): - `versionId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `expectedRevision` (integer) **(required)**: - `defaultDiscountPercent` (string,null) **(required)**: ## Responses ### 200: Draft updated - `version` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `priceListId` (string) **(required)**: - `currency` (string) **(required)**: - `publicationNumber` (integer,null) **(required)**: - `defaultDiscountPercent` (string,null) **(required)**: - `revision` (integer) **(required)**: - `effectiveFrom` (string,null) **(required)**: [date-time] - `effectiveUntil` (string,null) **(required)**: [date-time] - `createdBy` (string) **(required)**: - `publishedAt` (string,null) **(required)**: [date-time] - `publishedBy` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: [date-time] - `cancelledBy` (string,null) **(required)**: - `endedEarlyAt` (string,null) **(required)**: [date-time] - `endedEarlyBy` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "expectedRevision": 0, "defaultDiscountPercent": "string" }' ``` --- # Delete a draft product rule `DELETE https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/products/{productId}` Documentation: https://docs.guidelab.co/api-reference/price-lists/deletePriceListProductRule ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `priceListId` (string) **(required)** (in: path): - `versionId` (string) **(required)** (in: path): - `productId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `expectedRevision` (integer) **(required)**: ## Responses ### 200: Rule deleted - `deleted` (boolean) **(required)**: - `revision` (integer) **(required)**: ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/products/{productId}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "expectedRevision": 0 }' ``` --- # Set a draft product rule `PUT https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/products/{productId}` Documentation: https://docs.guidelab.co/api-reference/price-lists/upsertPriceListProductRule ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `priceListId` (string) **(required)** (in: path): - `versionId` (string) **(required)** (in: path): - `productId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `expectedRevision` (integer) **(required)**: - `rule` (object) **(required)**: ## Responses ### 200: Rule saved - `rule` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `priceListVersionId` (string) **(required)**: - `targetKind` (string) **(required)**: Values: `product`, `bundle` - `productId` (string,null) **(required)**: - `bundleId` (string,null) **(required)**: - `fixedPrice` (string,null) **(required)**: - `discountPercent` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] - `revision` (integer) **(required)**: ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/products/{productId}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "expectedRevision": 0, "rule": "string" }' ``` --- # Delete a draft bundle rule `DELETE https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/bundles/{bundleId}` Documentation: https://docs.guidelab.co/api-reference/price-lists/deletePriceListBundleRule ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `priceListId` (string) **(required)** (in: path): - `versionId` (string) **(required)** (in: path): - `bundleId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `expectedRevision` (integer) **(required)**: ## Responses ### 200: Rule deleted - `deleted` (boolean) **(required)**: - `revision` (integer) **(required)**: ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/bundles/{bundleId}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "expectedRevision": 0 }' ``` --- # Set a draft bundle rule `PUT https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/bundles/{bundleId}` Documentation: https://docs.guidelab.co/api-reference/price-lists/upsertPriceListBundleRule ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `priceListId` (string) **(required)** (in: path): - `versionId` (string) **(required)** (in: path): - `bundleId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `expectedRevision` (integer) **(required)**: - `rule` (object) **(required)**: ## Responses ### 200: Rule saved - `rule` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `priceListVersionId` (string) **(required)**: - `targetKind` (string) **(required)**: Values: `product`, `bundle` - `productId` (string,null) **(required)**: - `bundleId` (string,null) **(required)**: - `fixedPrice` (string,null) **(required)**: - `discountPercent` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] - `revision` (integer) **(required)**: ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/bundles/{bundleId}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "expectedRevision": 0, "rule": "string" }' ``` --- # Publish an immutable effective-dated version `POST https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/publish` Documentation: https://docs.guidelab.co/api-reference/price-lists/publishPriceListVersion ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `priceListId` (string) **(required)** (in: path): - `versionId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `expectedRevision` (integer) **(required)**: - `activation` (object) **(required)**: - `effectiveUntil` (string,null): [date-time] - `supersedesVersionId` (string): ## Responses ### 200: Version published - `version` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `priceListId` (string) **(required)**: - `currency` (string) **(required)**: - `publicationNumber` (integer,null) **(required)**: - `defaultDiscountPercent` (string,null) **(required)**: - `revision` (integer) **(required)**: - `effectiveFrom` (string,null) **(required)**: [date-time] - `effectiveUntil` (string,null) **(required)**: [date-time] - `createdBy` (string) **(required)**: - `publishedAt` (string,null) **(required)**: [date-time] - `publishedBy` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: [date-time] - `cancelledBy` (string,null) **(required)**: - `endedEarlyAt` (string,null) **(required)**: [date-time] - `endedEarlyBy` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/publish" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "expectedRevision": 0, "activation": "string", "effectiveUntil": "string", "supersedesVersionId": "string" }' ``` --- # Cancel a future publication `POST https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/cancel` Documentation: https://docs.guidelab.co/api-reference/price-lists/cancelPriceListVersion ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `priceListId` (string) **(required)** (in: path): - `versionId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `expectedRevision` (integer) **(required)**: ## Responses ### 200: Publication cancelled - `version` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `priceListId` (string) **(required)**: - `currency` (string) **(required)**: - `publicationNumber` (integer,null) **(required)**: - `defaultDiscountPercent` (string,null) **(required)**: - `revision` (integer) **(required)**: - `effectiveFrom` (string,null) **(required)**: [date-time] - `effectiveUntil` (string,null) **(required)**: [date-time] - `createdBy` (string) **(required)**: - `publishedAt` (string,null) **(required)**: [date-time] - `publishedBy` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: [date-time] - `cancelledBy` (string,null) **(required)**: - `endedEarlyAt` (string,null) **(required)**: [date-time] - `endedEarlyBy` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/cancel" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "expectedRevision": 0 }' ``` --- # Shorten an active or future publication `POST https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/end` Documentation: https://docs.guidelab.co/api-reference/price-lists/endPriceListVersion ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `priceListId` (string) **(required)** (in: path): - `versionId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` ## Responses ### 200: Publication shortened - `version` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `priceListId` (string) **(required)**: - `currency` (string) **(required)**: - `publicationNumber` (integer,null) **(required)**: - `defaultDiscountPercent` (string,null) **(required)**: - `revision` (integer) **(required)**: - `effectiveFrom` (string,null) **(required)**: [date-time] - `effectiveUntil` (string,null) **(required)**: [date-time] - `createdBy` (string) **(required)**: - `publishedAt` (string,null) **(required)**: [date-time] - `publishedBy` (string,null) **(required)**: - `cancelledAt` (string,null) **(required)**: [date-time] - `cancelledBy` (string,null) **(required)**: - `endedEarlyAt` (string,null) **(required)**: [date-time] - `endedEarlyBy` (string,null) **(required)**: - `createdAt` (string,null) **(required)**: [date-time] - `updatedAt` (string,null) **(required)**: [date-time] ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/price-lists/{priceListId}/versions/{versionId}/end" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '"string"' ``` --- # Assign a stable price book to a partnership `PUT https://api-stage.guidelab.co/price-lists/partnerships/{partnershipId}` Documentation: https://docs.guidelab.co/api-reference/price-lists/assignPartnershipPriceList ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `partnershipId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `priceListId` (string,null) **(required)**: ## Responses ### 200: Partnership assignment updated - `partnership` (object): ### 400: Invalid pricing lifecycle request ### 401: Unauthorized ### 403: Only lab managers may manage price lists ### 404: Price-list resource not found ### 409: Pricing lifecycle conflict ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/price-lists/partnerships/{partnershipId}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "priceListId": "string" }' ``` --- # Preview authoritative pricing without pinning an order `POST https://api-stage.guidelab.co/price-lists/preview` Documentation: https://docs.guidelab.co/api-reference/price-lists/previewOrderPricing ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `labId` (string) **(required)**: - `clinicId` (string) **(required)**: - `patientId` (string,null): - `items` (object[]) **(required)**: - `productId` (string) **(required)**: - `toothGroups` (object[]): - `id` (string) **(required)**: - `type` (string) **(required)**: Values: `single`, `bridge` - `teeth` (object[]) **(required)**: - `fdi` (integer) **(required)**: - `role` (string) **(required)**: Values: `crown`, `pontic` - `support` (string): Values: `natural`, `implant` - `implantSystemId` (string): - `implantPlatform` (string): - `quantity` (integer): (default: `1`) - `materialId` (string): - `material` (string): - `shadeSystemId` (string): - `shadeOcclusal` (string): - `shadeMiddle` (string): - `shadeGingival` (string): - `shadeNotes` (string): - `defaultImplantSystemId` (string): - `defaultImplantPlatform` (string): - `notes` (string): - `customFieldValues` (object): - `value` (object): - `fileIds` (string[]): - `bundleId` (string): - `bundleInstanceId` (string): ## Responses ### 200: Authoritative pricing preview - `effectiveAt` (string,null) **(required)**: [date-time] - `selection` (string) **(required)**: Values: `assigned_price_list`, `lab_default_price_list`, `catalog` - `priceListId` (string,null) **(required)**: - `priceListVersionId` (string,null) **(required)**: - `currency` (string) **(required)**: - `items` (object[]) **(required)**: - `unitPrice` (string,null) **(required)**: - `totalPrice` (string,null) **(required)**: - `pricingSource` (string) **(required)**: Values: `fixed_rule`, `percent_rule`, `version_default_discount`, `catalog` - `priceListVersionId` (string,null) **(required)**: - `priceListRuleId` (string,null) **(required)**: - `priceListRuleTargetKind` (string,null) **(required)**: Values: `product`, `bundle`, `null` - `priceListProductRuleId` (string,null) **(required)**: - `priceListBundleRuleId` (string,null) **(required)**: ### 400: Catalog validation failed ### 401: Unauthorized ### 403: No active partnership access ### 404: Lab not found ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/price-lists/preview" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "labId": "string", "clinicId": "string", "patientId": "string", "items": [ { "productId": "string" } ] }' ``` --- # Get production settings `GET https://api-stage.guidelab.co/production/settings` Retrieves the production configuration settings for the current lab. Returns an unpersisted default projection when no row exists; writes occur only through the manager-guarded update command. Documentation: https://docs.guidelab.co/api-reference/production/getProductionSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Lab production settings - `settings` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `isEnabled` (boolean) **(required)**: - `cutoffTime` (string) **(required)**: - `bufferDays` (number) **(required)**: - `showPricesInOrderDetails` (boolean) **(required)**: - `taskPageHeaders` (object,null) **(required)**: - `excludedCategoryIds` (array,null) **(required)**: - `excludedProductIds` (array,null) **(required)**: - `useDoneDate` (boolean) **(required)**: - `defaultUnitCapacity` (number) **(required)**: - `enableBarcodeScanning` (boolean) **(required)**: - `organizeByDate` (boolean) **(required)**: - `defaultSortField` (string) **(required)**: Values: `scheduledDate`, `dueDate`, `orderNumber`, `priority` - `defaultGroupBy` (string) **(required)**: Values: `room`, `assignee`, `status`, `date` - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — missing or invalid session ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/settings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update production settings `PUT https://api-stage.guidelab.co/production/settings` Updates the production configuration settings for the current lab. Documentation: https://docs.guidelab.co/api-reference/production/updateProductionSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `isEnabled` (boolean): - `cutoffTime` (string): - `bufferDays` (integer): - `showPricesInOrderDetails` (boolean): - `taskPageHeaders` (object): - `showClinic` (boolean): (default: `true`) - `showPatient` (boolean): (default: `true`) - `showOrderNumber` (boolean): (default: `true`) - `showDueDate` (boolean): (default: `true`) - `showProduct` (boolean): (default: `true`) - `excludedCategoryIds` (string[]): - `excludedProductIds` (string[]): - `useDoneDate` (boolean): - `defaultUnitCapacity` (integer): - `enableBarcodeScanning` (boolean): - `organizeByDate` (boolean): - `defaultSortField` (string): Values: `scheduledDate`, `dueDate`, `orderNumber`, `priority` - `defaultGroupBy` (string): Values: `room`, `assignee`, `status`, `date` ## Responses ### 200: Settings updated successfully - `settings` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `isEnabled` (boolean) **(required)**: - `cutoffTime` (string) **(required)**: - `bufferDays` (number) **(required)**: - `showPricesInOrderDetails` (boolean) **(required)**: - `taskPageHeaders` (object,null) **(required)**: - `excludedCategoryIds` (array,null) **(required)**: - `excludedProductIds` (array,null) **(required)**: - `useDoneDate` (boolean) **(required)**: - `defaultUnitCapacity` (number) **(required)**: - `enableBarcodeScanning` (boolean) **(required)**: - `organizeByDate` (boolean) **(required)**: - `defaultSortField` (string) **(required)**: Values: `scheduledDate`, `dueDate`, `orderNumber`, `priority` - `defaultGroupBy` (string) **(required)**: Values: `room`, `assignee`, `status`, `date` - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — missing or invalid session ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/production/settings" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # List production rooms `GET https://api-stage.guidelab.co/production/rooms` Retrieves a paginated list of production rooms for the current lab. Supports filtering by active status and search by name. Documentation: https://docs.guidelab.co/api-reference/production/listProductionRooms ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` () (in: query): Default: `false` - `search` (string) (in: query): - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `50` ## Responses ### 200: Paginated list of production rooms - `rooms` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `color` (string) **(required)**: - `icon` (string,null) **(required)**: - `layoutType` (string) **(required)**: Values: `default`, `acceptance`, `shipping`, `production` - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — missing or invalid session ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/rooms" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a production room `POST https://api-stage.guidelab.co/production/rooms` Creates a new production room in the current lab. Automatically assigns the next sort order if not specified. Documentation: https://docs.guidelab.co/api-reference/production/createProductionRoom ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `description` (string): - `color` (string): (default: `#6366f1`) - `icon` (string): - `layoutType` (string): (default: `default`) Values: `default`, `acceptance`, `shipping`, `production` - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Room created successfully - `room` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `color` (string) **(required)**: - `icon` (string,null) **(required)**: - `layoutType` (string) **(required)**: Values: `default`, `acceptance`, `shipping`, `production` - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — missing or invalid session ## Example ```bash curl -X POST "https://api-stage.guidelab.co/production/rooms" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string" }' ``` --- # Reorder production rooms `PUT https://api-stage.guidelab.co/production/rooms/reorder` Updates the sort order of multiple production rooms in a single batch operation. Documentation: https://docs.guidelab.co/api-reference/production/reorderProductionRooms ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `items` (object[]) **(required)**: - `id` (string) **(required)**: - `sortOrder` (integer) **(required)**: ## Responses ### 200: Rooms reordered successfully - `success` (boolean) **(required)**: ### 401: Unauthorized — missing or invalid session ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/production/rooms/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "items": [ { "id": "string", "sortOrder": 0 } ] }' ``` --- # Get a production room `GET https://api-stage.guidelab.co/production/rooms/{id}` Retrieves a single production room by its ID. Only returns rooms belonging to the current lab. Documentation: https://docs.guidelab.co/api-reference/production/getProductionRoom ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Room ID ## Responses ### 200: Room details - `room` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `color` (string) **(required)**: - `icon` (string,null) **(required)**: - `layoutType` (string) **(required)**: Values: `default`, `acceptance`, `shipping`, `production` - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — missing or invalid session ### 404: Room not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/rooms/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete a production room `DELETE https://api-stage.guidelab.co/production/rooms/{id}` Permanently deletes a production room. Tasks assigned to this room will need to be reassigned. Documentation: https://docs.guidelab.co/api-reference/production/deleteProductionRoom ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Room ID ## Responses ### 200: Room deleted successfully - `success` (boolean) **(required)**: ### 401: Unauthorized — missing or invalid session ### 404: Room not found ### 409: Room is still used by an active order ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/production/rooms/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a production room `PUT https://api-stage.guidelab.co/production/rooms/{id}` Updates an existing production room's properties such as name, description, color, icon, sort order, or active status. Documentation: https://docs.guidelab.co/api-reference/production/updateProductionRoom ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Room ID ## Request Body Content-Type: `application/json` - `name` (string): - `description` (string): - `color` (string): (default: `#6366f1`) - `icon` (string): - `layoutType` (string): (default: `default`) Values: `default`, `acceptance`, `shipping`, `production` - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 200: Room updated successfully - `room` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `color` (string) **(required)**: - `icon` (string,null) **(required)**: - `layoutType` (string) **(required)**: Values: `default`, `acceptance`, `shipping`, `production` - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — missing or invalid session ### 404: Room not found ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/production/rooms/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # List orders assigned to a production room `GET https://api-stage.guidelab.co/production/rooms/{id}/orders` Returns the orders relevant to a room together with the per-task done-ness (computed from orderActivity). Documentation: https://docs.guidelab.co/api-reference/production/listRoomRuntimeOrders ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `material` (string) (in: query): - `scheduledDate` (string) (in: query): Optional YYYY-MM-DD filter. When provided, only orders with at least one task scheduled for this date in the given room are returned. - `onlyMine` () (in: query): When true, only return orders whose current task in this room resolves to the current member (per-order override if present, otherwise the task's defaultAssigneeMemberId). Default: `false` ## Responses ### 200: Orders + tasks - `orders` (object[]) **(required)**: - `orderPhaseId` (string) **(required)**: - `treatmentPhaseId` (string) **(required)**: - `phaseName` (string) **(required)**: - `phaseSortOrder` (integer) **(required)**: - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: - `status` (string) **(required)**: Values: `draft`, `submitted`, `active`, `completed`, `cancelled`, `on_hold` - `patient` (object,null) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `clinic` (object,null) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `dentist` (string,null) **(required)**: - `items` (object[]) **(required)**: - `id` (string) **(required)**: - `productName` (string,null) **(required)**: - `material` (string,null) **(required)**: - `quantity` (number) **(required)**: - `currentPhaseTaskId` (string,null) **(required)**: - `tasks` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `color` (string,null) **(required)**: - `style` (string) **(required)**: Values: `primary`, `secondary`, `danger`, `default` - `completionTrigger` (string) **(required)**: Values: `acknowledge`, `assign_tray`, `upload_file`, `change_status`, `decision`, `set_manual_file_path`, `surgical_report` - `completionTriggerConfig` (object) **(required)**: - `sideEffects` (array) **(required)**: - `captureConfig` (object) **(required)**: - `requireNotes` (boolean): (default: `false`) - `requirePhoto` (boolean): (default: `false`) - `notesPlaceholder` (string): - `notesMaxLength` (integer): - `roomId` (string,null) **(required)**: - `sortOrder` (integer) **(required)**: - `advancesPhase` (boolean) **(required)**: - `done` (boolean) **(required)**: - `isCurrent` (boolean) **(required)**: - `assignedToMemberId` (string,null) **(required)**: - `scheduledDate` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `phaseTasks` (object[]) **(required)**: - `id` (string) **(required)**: - `sortOrder` (integer) **(required)**: - `task` (object) **(required)**: - `name` (string) **(required)**: - `color` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `progress` (object) **(required)**: - `completed` (number) **(required)**: - `total` (number) **(required)**: - `hasOverdueTask` (boolean) **(required)**: - `trayId` (string,null) **(required)**: - `trayCode` (string,null) **(required)**: - `trayColor` (string,null) **(required)**: - `submittedAt` (string,null) **(required)**: - `dueDate` (string,null) **(required)**: - `plannedDate` (string,null) **(required)**: ### 404: Room not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/rooms/{id}/orders" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Per-day scheduled-stage counts for a production room `GET https://api-stage.guidelab.co/production/rooms/{id}/schedule-counts` Returns a map of YYYY-MM-DD → number of distinct active stages with a task scheduled that day in the room. Powers the production date picker's per-day badges. Documentation: https://docs.guidelab.co/api-reference/production/getRoomScheduleCounts ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `startDate` (string) **(required)** (in: query): - `endDate` (string) **(required)** (in: query): ## Responses ### 200: Per-day counts - `counts` (object) **(required)**: Map of YYYY-MM-DD → number of distinct active stages scheduled in the room that day. (example: `[object Object]`) ### 404: Room not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/rooms/{id}/schedule-counts" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List printers `GET https://api-stage.guidelab.co/production/printers` Retrieves the list of printers for the current lab. Joins room and current batch. Documentation: https://docs.guidelab.co/api-reference/production/listPrinters ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `roomId` (string) (in: query): - `includeInactive` () (in: query): Default: `false` ## Responses ### 200: List of printers - `printers` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `roomId` (string) **(required)**: - `name` (string) **(required)**: - `model` (string,null) **(required)**: - `material` (string) **(required)**: - `status` (string) **(required)**: Values: `idle`, `running`, `finished`, `error`, `maintenance` - `currentBatchId` (string,null) **(required)**: - `sortOrder` (number,null) **(required)**: - `isActive` (boolean,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `room` (object,null): - `id` (string) **(required)**: - `name` (string) **(required)**: - `color` (string,null) **(required)**: - `currentBatch` (object,null): - `id` (string) **(required)**: - `name` (string) **(required)**: - `status` (string) **(required)**: - `startedAt` (string,null) **(required)**: - `orderItems` (object[]): - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string,null): - `productName` (string,null): - `material` (string,null): ### 401: Unauthorized — missing or invalid session ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/printers" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a printer `POST https://api-stage.guidelab.co/production/printers` Creates a new printer. The assigned room must belong to the current lab and have layoutType='production'. Documentation: https://docs.guidelab.co/api-reference/production/createPrinter ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `roomId` (string) **(required)**: - `name` (string) **(required)**: - `model` (string,null): - `material` (string): (default: ``) - `status` (string): (default: `idle`) Values: `idle`, `finished`, `error`, `maintenance` - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Printer created - `printer` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `roomId` (string) **(required)**: - `name` (string) **(required)**: - `model` (string,null) **(required)**: - `material` (string) **(required)**: - `status` (string) **(required)**: Values: `idle`, `running`, `finished`, `error`, `maintenance` - `currentBatchId` (string,null) **(required)**: - `sortOrder` (number,null) **(required)**: - `isActive` (boolean,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `room` (object,null): - `id` (string) **(required)**: - `name` (string) **(required)**: - `color` (string,null) **(required)**: - `currentBatch` (object,null): - `id` (string) **(required)**: - `name` (string) **(required)**: - `status` (string) **(required)**: - `startedAt` (string,null) **(required)**: - `orderItems` (object[]): - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string,null): - `productName` (string,null): - `material` (string,null): ### 400: Assigned room is not a production room or other validation error ### 401: Unauthorized — missing or invalid session ### 404: Room not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/production/printers" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "roomId": "string", "name": "string" }' ``` --- # Get a printer `GET https://api-stage.guidelab.co/production/printers/{id}` Retrieves a single printer by ID within the current lab. Documentation: https://docs.guidelab.co/api-reference/production/getPrinter ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Printer ID ## Responses ### 200: Printer - `printer` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `roomId` (string) **(required)**: - `name` (string) **(required)**: - `model` (string,null) **(required)**: - `material` (string) **(required)**: - `status` (string) **(required)**: Values: `idle`, `running`, `finished`, `error`, `maintenance` - `currentBatchId` (string,null) **(required)**: - `sortOrder` (number,null) **(required)**: - `isActive` (boolean,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `room` (object,null): - `id` (string) **(required)**: - `name` (string) **(required)**: - `color` (string,null) **(required)**: - `currentBatch` (object,null): - `id` (string) **(required)**: - `name` (string) **(required)**: - `status` (string) **(required)**: - `startedAt` (string,null) **(required)**: - `orderItems` (object[]): - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string,null): - `productName` (string,null): - `material` (string,null): ### 401: Unauthorized — missing or invalid session ### 404: Printer not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/printers/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete a printer `DELETE https://api-stage.guidelab.co/production/printers/{id}` Permanently deletes a printer. Rejected while a print batch is active. Documentation: https://docs.guidelab.co/api-reference/production/deletePrinter ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Printer ID ## Responses ### 200: Printer deleted - `success` (boolean) **(required)**: ### 400: Printer has an active batch ### 401: Unauthorized — missing or invalid session ### 404: Printer not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/production/printers/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a printer `PUT https://api-stage.guidelab.co/production/printers/{id}` Updates a printer. If roomId changes, the new room must be a production room in the current lab. Documentation: https://docs.guidelab.co/api-reference/production/updatePrinter ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Printer ID ## Request Body Content-Type: `application/json` - `roomId` (string): - `name` (string): - `model` (string,null): - `material` (string): (default: ``) - `status` (string): (default: `idle`) Values: `idle`, `finished`, `error`, `maintenance` - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 200: Printer updated - `printer` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `roomId` (string) **(required)**: - `name` (string) **(required)**: - `model` (string,null) **(required)**: - `material` (string) **(required)**: - `status` (string) **(required)**: Values: `idle`, `running`, `finished`, `error`, `maintenance` - `currentBatchId` (string,null) **(required)**: - `sortOrder` (number,null) **(required)**: - `isActive` (boolean,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `room` (object,null): - `id` (string) **(required)**: - `name` (string) **(required)**: - `color` (string,null) **(required)**: - `currentBatch` (object,null): - `id` (string) **(required)**: - `name` (string) **(required)**: - `status` (string) **(required)**: - `startedAt` (string,null) **(required)**: - `orderItems` (object[]): - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string,null): - `productName` (string,null): - `material` (string,null): ### 400: Invalid request ### 401: Unauthorized — missing or invalid session ### 404: Printer not found ### 409: Printer state changed concurrently ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/production/printers/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # List print batches `GET https://api-stage.guidelab.co/production/print-batches` Retrieves print batches for the current lab. Filter by printerId, roomId, or status. Joins order items. Documentation: https://docs.guidelab.co/api-reference/production/listPrintBatches ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `printerId` (string) (in: query): - `roomId` (string) (in: query): - `status` (string) (in: query): Values: `queued`, `printing`, `completed`, `failed` - `activeOnly` () (in: query): Return only batches that are queued or printing, newest first. Default: `false` - `cursor` (string) (in: query): Opaque cursor returned by the previous page. Pages are ordered by creation time and ID, newest first. - `limit` (integer) (in: query): Maximum batches to return Default: `100` ## Responses ### 200: List of print batches - `batches` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `printerId` (string) **(required)**: - `roomId` (string) **(required)**: - `name` (string) **(required)**: - `status` (string) **(required)**: Values: `queued`, `printing`, `completed`, `failed` - `startedAt` (string,null) **(required)**: - `completedAt` (string,null) **(required)**: - `createdByMemberId` (string,null) **(required)**: - `completedByMemberId` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `failureReason` (string,null) **(required)**: - `durationSeconds` (integer,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `orderItems` (object[]): - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string,null) **(required)**: - `productName` (string,null) **(required)**: - `material` (string,null) **(required)**: - `orderItemsTruncated` (boolean) **(required)**: - `pagination` (object) **(required)**: - `limit` (integer) **(required)**: - `hasMore` (boolean) **(required)**: - `nextCursor` (string,null) **(required)**: ### 401: Unauthorized — missing or invalid session ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/print-batches" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a print batch `POST https://api-stage.guidelab.co/production/print-batches` Creates a new print batch in queued state. Verifies printer is idle with no current batch and that all order items belong to the lab. Generates a sequential name Batch-YYYYMMDD-XX. Documentation: https://docs.guidelab.co/api-reference/production/createPrintBatch ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `printerId` (string) **(required)**: - `orderItemIds` (string[]) **(required)**: - `notes` (string): ## Responses ### 201: Print batch created - `batch` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `printerId` (string) **(required)**: - `roomId` (string) **(required)**: - `name` (string) **(required)**: - `status` (string) **(required)**: Values: `queued`, `printing`, `completed`, `failed` - `startedAt` (string,null) **(required)**: - `completedAt` (string,null) **(required)**: - `createdByMemberId` (string,null) **(required)**: - `completedByMemberId` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `failureReason` (string,null) **(required)**: - `durationSeconds` (integer,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `orderItems` (object[]): - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string,null) **(required)**: - `productName` (string,null) **(required)**: - `material` (string,null) **(required)**: - `orderItemsTruncated` (boolean) **(required)**: ### 400: Printer not idle, inactive, or order items invalid ### 401: Unauthorized — missing or invalid session ### 404: Printer not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/production/print-batches" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "printerId": "string", "orderItemIds": [ "string" ], "notes": "string" }' ``` --- # Start a print batch `POST https://api-stage.guidelab.co/production/print-batches/{id}/start` Transitions a queued batch to printing. Printer running state is derived from the active batch. Documentation: https://docs.guidelab.co/api-reference/production/startPrintBatch ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Print batch ID ## Responses ### 200: Batch started - `batch` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `printerId` (string) **(required)**: - `roomId` (string) **(required)**: - `name` (string) **(required)**: - `status` (string) **(required)**: Values: `queued`, `printing`, `completed`, `failed` - `startedAt` (string,null) **(required)**: - `completedAt` (string,null) **(required)**: - `createdByMemberId` (string,null) **(required)**: - `completedByMemberId` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `failureReason` (string,null) **(required)**: - `durationSeconds` (integer,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `orderItems` (object[]): - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string,null) **(required)**: - `productName` (string,null) **(required)**: - `material` (string,null) **(required)**: - `orderItemsTruncated` (boolean) **(required)**: ### 400: Batch is not in a startable state ### 401: Unauthorized — missing or invalid session ### 404: Batch not found ### 409: Batch or printer state changed concurrently ## Example ```bash curl -X POST "https://api-stage.guidelab.co/production/print-batches/{id}/start" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Complete a print batch `POST https://api-stage.guidelab.co/production/print-batches/{id}/complete` Transitions a printing batch to completed and leaves the printer finished until a human clears it. Documentation: https://docs.guidelab.co/api-reference/production/completePrintBatch ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Print batch ID ## Responses ### 200: Batch completed - `batch` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `printerId` (string) **(required)**: - `roomId` (string) **(required)**: - `name` (string) **(required)**: - `status` (string) **(required)**: Values: `queued`, `printing`, `completed`, `failed` - `startedAt` (string,null) **(required)**: - `completedAt` (string,null) **(required)**: - `createdByMemberId` (string,null) **(required)**: - `completedByMemberId` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `failureReason` (string,null) **(required)**: - `durationSeconds` (integer,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `orderItems` (object[]): - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string,null) **(required)**: - `productName` (string,null) **(required)**: - `material` (string,null) **(required)**: - `orderItemsTruncated` (boolean) **(required)**: - `advanced` (string[]): - `skipped` (object[]): - `orderId` (string) **(required)**: - `reason` (string) **(required)**: - `requiresManualReview` (boolean) **(required)**: ### 400: Batch is not in a completable state ### 401: Unauthorized — missing or invalid session ### 404: Batch not found ### 409: Batch or printer state changed concurrently ## Example ```bash curl -X POST "https://api-stage.guidelab.co/production/print-batches/{id}/complete" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Mark a print batch as failed `POST https://api-stage.guidelab.co/production/print-batches/{id}/fail` Transitions a printing batch to failed, captures the reason, and leaves the printer in error until a human clears it. Documentation: https://docs.guidelab.co/api-reference/production/failPrintBatch ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Print batch ID ## Request Body Content-Type: `application/json` - `reason` (string): ## Responses ### 200: Batch marked failed - `batch` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `printerId` (string) **(required)**: - `roomId` (string) **(required)**: - `name` (string) **(required)**: - `status` (string) **(required)**: Values: `queued`, `printing`, `completed`, `failed` - `startedAt` (string,null) **(required)**: - `completedAt` (string,null) **(required)**: - `createdByMemberId` (string,null) **(required)**: - `completedByMemberId` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `failureReason` (string,null) **(required)**: - `durationSeconds` (integer,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `orderItems` (object[]): - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string,null) **(required)**: - `productName` (string,null) **(required)**: - `material` (string,null) **(required)**: - `orderItemsTruncated` (boolean) **(required)**: ### 400: Batch is not in a failable state ### 401: Unauthorized — missing or invalid session ### 404: Batch not found ### 409: Batch or printer state changed concurrently ## Example ```bash curl -X POST "https://api-stage.guidelab.co/production/print-batches/{id}/fail" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "reason": "string" }' ``` --- # Get a print batch `GET https://api-stage.guidelab.co/production/print-batches/{id}` Retrieves a single batch by ID with its order items. Documentation: https://docs.guidelab.co/api-reference/production/getPrintBatch ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Print batch ID ## Responses ### 200: Batch - `batch` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `printerId` (string) **(required)**: - `roomId` (string) **(required)**: - `name` (string) **(required)**: - `status` (string) **(required)**: Values: `queued`, `printing`, `completed`, `failed` - `startedAt` (string,null) **(required)**: - `completedAt` (string,null) **(required)**: - `createdByMemberId` (string,null) **(required)**: - `completedByMemberId` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `failureReason` (string,null) **(required)**: - `durationSeconds` (integer,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `orderItems` (object[]): - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string,null) **(required)**: - `productName` (string,null) **(required)**: - `material` (string,null) **(required)**: - `orderItemsTruncated` (boolean) **(required)**: ### 401: Unauthorized — missing or invalid session ### 404: Batch not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/print-batches/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete a print batch `DELETE https://api-stage.guidelab.co/production/print-batches/{id}` Deletes a print batch. Only allowed if status is queued. Documentation: https://docs.guidelab.co/api-reference/production/deletePrintBatch ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Print batch ID ## Responses ### 200: Batch deleted - `success` (boolean) **(required)**: ### 400: Batch is not in a deletable state ### 401: Unauthorized — missing or invalid session ### 404: Batch not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/production/print-batches/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List completed and failed print batches `GET https://api-stage.guidelab.co/production/print-batches/history` Paginated history of batches with status completed or failed. Joins printer, room, and member display names. Ordered by completedAt DESC. Documentation: https://docs.guidelab.co/api-reference/production/listPrintBatchHistory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `printerId` (string) (in: query): - `roomId` (string) (in: query): - `status` (string) (in: query): Values: `completed`, `failed` - `operatorId` (string) (in: query): - `from` (string) (in: query): - `to` (string) (in: query): - `page` (integer) (in: query): Default: `1` - `pageSize` (integer) (in: query): Default: `50` ## Responses ### 200: History page - `items` (array) **(required)**: - `total` (number) **(required)**: - `page` (number) **(required)**: - `pageSize` (number) **(required)**: ### 401: Unauthorized — missing or invalid session ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/print-batches/history" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Aggregate stats for a printer over a trailing window `GET https://api-stage.guidelab.co/production/print-batches/printers/{printerId}/history-stats` Total runtime, average duration, and success rate over the last N days (default 30). Based on completed+failed batches. Documentation: https://docs.guidelab.co/api-reference/production/getPrinterHistoryStats ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `printerId` (string) **(required)** (in: path): Printer ID - `windowDays` (integer) (in: query): Default: `30` ## Responses ### 200: Aggregate stats ### 401: Unauthorized — missing or invalid session ### 404: Printer not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/print-batches/printers/{printerId}/history-stats" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List production tasks `GET https://api-stage.guidelab.co/production/tasks` Returns the task library for the current lab. Filter by trigger, active flag, or free-text name search. Documentation: https://docs.guidelab.co/api-reference/production/listProductionTasks ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `isActive` (string) (in: query): Values: `true`, `false` - `completionTrigger` (string) (in: query): Values: `acknowledge`, `assign_tray`, `upload_file`, `change_status`, `decision`, `set_manual_file_path`, `surgical_report` - `search` (string) (in: query): ## Responses ### 200: List of tasks - `tasks` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `iconDefault` (string,null) **(required)**: - `colorDefault` (string,null) **(required)**: - `styleDefault` (string) **(required)**: Values: `primary`, `secondary`, `danger`, `default` - `completionTrigger` (string) **(required)**: Values: `acknowledge`, `assign_tray`, `upload_file`, `change_status`, `decision`, `set_manual_file_path`, `surgical_report` - `completionTriggerConfig` (object) **(required)**: - `sideEffects` (array) **(required)**: - `captureConfig` (object) **(required)**: - `requireNotes` (boolean): (default: `false`) - `requirePhoto` (boolean): (default: `false`) - `notesPlaceholder` (string): - `notesMaxLength` (integer): - `defaultAssigneeMemberId` (string,null) **(required)**: - `roomId` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/tasks" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a task `POST https://api-stage.guidelab.co/production/tasks` Create a new task definition in the lab's task library. Documentation: https://docs.guidelab.co/api-reference/production/createProductionTask ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `description` (string,null): - `iconDefault` (string,null): - `colorDefault` (string,null): - `styleDefault` (string): (default: `default`) Values: `primary`, `secondary`, `danger`, `default` - `completionTrigger` (string) **(required)**: Values: `acknowledge`, `assign_tray`, `upload_file`, `change_status`, `decision`, `set_manual_file_path`, `surgical_report` - `completionTriggerConfig` (object) **(required)**: - `sideEffects` (array): (default: ``) - `captureConfig` (object): (default: `[object Object]`) - `requireNotes` (boolean): (default: `false`) - `requirePhoto` (boolean): (default: `false`) - `notesPlaceholder` (string): - `notesMaxLength` (integer): - `defaultAssigneeMemberId` (string,null): - `roomId` (string,null): - `isActive` (boolean): (default: `true`) ## Responses ### 201: Task created - `task` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `iconDefault` (string,null) **(required)**: - `colorDefault` (string,null) **(required)**: - `styleDefault` (string) **(required)**: Values: `primary`, `secondary`, `danger`, `default` - `completionTrigger` (string) **(required)**: Values: `acknowledge`, `assign_tray`, `upload_file`, `change_status`, `decision`, `set_manual_file_path`, `surgical_report` - `completionTriggerConfig` (object) **(required)**: - `sideEffects` (array) **(required)**: - `captureConfig` (object) **(required)**: - `requireNotes` (boolean): (default: `false`) - `requirePhoto` (boolean): (default: `false`) - `notesPlaceholder` (string): - `notesMaxLength` (integer): - `defaultAssigneeMemberId` (string,null) **(required)**: - `roomId` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ## Example ```bash curl -X POST "https://api-stage.guidelab.co/production/tasks" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "completionTrigger": "acknowledge", "completionTriggerConfig": "string" }' ``` --- # Get a task `GET https://api-stage.guidelab.co/production/tasks/{id}` Documentation: https://docs.guidelab.co/api-reference/production/getProductionTask ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Task - `task` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `iconDefault` (string,null) **(required)**: - `colorDefault` (string,null) **(required)**: - `styleDefault` (string) **(required)**: Values: `primary`, `secondary`, `danger`, `default` - `completionTrigger` (string) **(required)**: Values: `acknowledge`, `assign_tray`, `upload_file`, `change_status`, `decision`, `set_manual_file_path`, `surgical_report` - `completionTriggerConfig` (object) **(required)**: - `sideEffects` (array) **(required)**: - `captureConfig` (object) **(required)**: - `requireNotes` (boolean): (default: `false`) - `requirePhoto` (boolean): (default: `false`) - `notesPlaceholder` (string): - `notesMaxLength` (integer): - `defaultAssigneeMemberId` (string,null) **(required)**: - `roomId` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 404: Task not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/tasks/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a task `PATCH https://api-stage.guidelab.co/production/tasks/{id}` Documentation: https://docs.guidelab.co/api-reference/production/updateProductionTask ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `name` (string): - `description` (string,null): - `iconDefault` (string,null): - `colorDefault` (string,null): - `styleDefault` (string): (default: `default`) Values: `primary`, `secondary`, `danger`, `default` - `completionTrigger` (string): Values: `acknowledge`, `assign_tray`, `upload_file`, `change_status`, `decision`, `set_manual_file_path`, `surgical_report` - `completionTriggerConfig` (object): - `sideEffects` (array): (default: ``) - `captureConfig` (object): (default: `[object Object]`) - `requireNotes` (boolean): (default: `false`) - `requirePhoto` (boolean): (default: `false`) - `notesPlaceholder` (string): - `notesMaxLength` (integer): - `defaultAssigneeMemberId` (string,null): - `roomId` (string,null): - `isActive` (boolean): (default: `true`) ## Responses ### 200: Updated task - `task` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `iconDefault` (string,null) **(required)**: - `colorDefault` (string,null) **(required)**: - `styleDefault` (string) **(required)**: Values: `primary`, `secondary`, `danger`, `default` - `completionTrigger` (string) **(required)**: Values: `acknowledge`, `assign_tray`, `upload_file`, `change_status`, `decision`, `set_manual_file_path`, `surgical_report` - `completionTriggerConfig` (object) **(required)**: - `sideEffects` (array) **(required)**: - `captureConfig` (object) **(required)**: - `requireNotes` (boolean): (default: `false`) - `requirePhoto` (boolean): (default: `false`) - `notesPlaceholder` (string): - `notesMaxLength` (integer): - `defaultAssigneeMemberId` (string,null) **(required)**: - `roomId` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 404: Task not found ### 409: The update would leave an active treatment phase without an active task - `error` (string) **(required)**: ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/production/tasks/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Delete a task `DELETE https://api-stage.guidelab.co/production/tasks/{id}` Documentation: https://docs.guidelab.co/api-reference/production/deleteProductionTask ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Deleted - `success` (boolean) **(required)**: ### 404: Task not found ### 409: Task is still used by a treatment phase - `error` (string) **(required)**: ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/production/tasks/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Bulk update tasks `POST https://api-stage.guidelab.co/production/tasks/bulk` Activate, deactivate, set the default assignee, or delete several tasks at once. Only affects tasks owned by the current lab. Documentation: https://docs.guidelab.co/api-reference/production/bulkUpdateProductionTasks ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` ## Responses ### 200: Bulk result - `affected` (number) **(required)**: ### 409: A task is still referenced or deactivation would leave an active phase without a task - `error` (string) **(required)**: ## Example ```bash curl -X POST "https://api-stage.guidelab.co/production/tasks/bulk" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '"string"' ``` --- # Fire a task (runs trigger + side effects, logs activity) `POST https://api-stage.guidelab.co/production/tasks/{orderPhaseTaskId}/fire` Single entry point for completing an immutable order phase task snapshot. Documentation: https://docs.guidelab.co/api-reference/production/fireProductionTask ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `orderPhaseTaskId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `orderId` (string) **(required)**: - `orderPhaseId` (string) **(required)**: - `decisionKey` (string): - `trayId` (string): - `fileIds` (string[]): - `toStatus` (string): Values: `draft`, `submitted`, `active`, `completed`, `cancelled`, `on_hold` - `manualFilePath` (string): - `commandId` (string): [uuid] - `reportFileIds` (string[]): - `extraFileIds` (string[]): - `projectUrl` (string,null): [uri] - `notes` (string): - `attachmentIds` (string[]): - `confirmed` (boolean): ## Responses ### 200: Activity row recorded - `activity` (object) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderPhaseTaskId` (string,null) **(required)**: - `eventType` (string) **(required)**: Values: `task_fired`, `task_review_event`, `status_changed`, `phase_changed`, `tray_assigned`, `file_uploaded`, `note_added`, `system`, `hold_requirement_changed` - `actorMemberId` (string,null) **(required)**: - `actorUserId` (string,null) **(required)**: - `phaseAtTime` (string,null) **(required)**: - `statusAtTime` (string,null) **(required)**: Values: `draft`, `submitted`, `active`, `completed`, `cancelled`, `on_hold`, `null` - `payload` (object) **(required)**: - `notes` (string,null) **(required)**: - `attachmentIds` (string[]) **(required)**: - `createdAt` (string) **(required)**: ### 400: Invalid trigger input ### 404: Task or order not found ### 409: Confirmation required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/production/tasks/{orderPhaseTaskId}/fire" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "orderId": "string", "orderPhaseId": "string" }' ``` --- # Set per-order assignee/date/notes for a task `POST https://api-stage.guidelab.co/production/task-assignments` Updates assignee, date, or notes on the immutable task row for an order phase. Documentation: https://docs.guidelab.co/api-reference/production/updateOrderPhaseTaskAssignment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `orderPhaseTaskId` (string) **(required)**: - `orderId` (string) **(required)**: - `orderPhaseId` (string) **(required)**: - `assignedToMemberId` (string,null): - `scheduledDate` (string,null): - `notes` (string,null): ## Responses ### 200: Updated assignment - `assignment` (object) **(required)**: - `orderPhaseTaskId` (string) **(required)**: - `orderId` (string) **(required)**: - `orderPhaseId` (string) **(required)**: - `assignedToMemberId` (string,null) **(required)**: - `scheduledDate` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ## Example ```bash curl -X POST "https://api-stage.guidelab.co/production/task-assignments" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "orderPhaseTaskId": "string", "orderId": "string", "orderPhaseId": "string", "assignedToMemberId": "string", "scheduledDate": "string", "notes": "string" }' ``` --- # Clear assignment fields for an order phase task `DELETE https://api-stage.guidelab.co/production/task-assignments` Documentation: https://docs.guidelab.co/api-reference/production/clearOrderPhaseTaskAssignment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `orderPhaseTaskId` (string) **(required)**: - `orderId` (string) **(required)**: - `orderPhaseId` (string) **(required)**: ## Responses ### 200: Cleared - `success` (boolean) **(required)**: ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/production/task-assignments" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "orderPhaseTaskId": "string", "orderId": "string", "orderPhaseId": "string" }' ``` --- # Cronologia: list activity rows for an order `GET https://api-stage.guidelab.co/production/orders/{id}/activity` Returns activity rows ordered by createdAt DESC. Powers the Cronologia rail and acts as the source of truth for the per-phase-visit done-ness calculation. Documentation: https://docs.guidelab.co/api-reference/production/listOrderActivity ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `eventType` (string) (in: query): Values: `task_fired`, `task_review_event`, `status_changed`, `phase_changed`, `tray_assigned`, `file_uploaded`, `note_added`, `system`, `hold_requirement_changed` - `limit` (integer) (in: query): Default: `100` ## Responses ### 200: Activity rows - `activity` (object[]) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderPhaseTaskId` (string,null) **(required)**: - `eventType` (string) **(required)**: Values: `task_fired`, `task_review_event`, `status_changed`, `phase_changed`, `tray_assigned`, `file_uploaded`, `note_added`, `system`, `hold_requirement_changed` - `actorMemberId` (string,null) **(required)**: - `actorUserId` (string,null) **(required)**: - `phaseAtTime` (string,null) **(required)**: - `statusAtTime` (string,null) **(required)**: Values: `draft`, `submitted`, `active`, `completed`, `cancelled`, `on_hold`, `null` - `payload` (object) **(required)**: - `notes` (string,null) **(required)**: - `attachmentIds` (string[]) **(required)**: - `createdAt` (string) **(required)**: ### 404: Order not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/orders/{id}/activity" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get the task plan for an order `GET https://api-stage.guidelab.co/production/orders/{id}/task-plan` Returns every task applicable to this order grouped by phase → room → task, with assignment overrides and done-ness. Documentation: https://docs.guidelab.co/api-reference/production/getOrderTaskPlan ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Task plan - `phases` (object[]) **(required)**: - `orderPhaseId` (string) **(required)**: - `treatmentPhaseId` (string) **(required)**: - `name` (string) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `workTrayId` (string,null) **(required)**: - `rooms` (object[]) **(required)**: - `roomId` (string) **(required)**: - `name` (string) **(required)**: - `color` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `layoutType` (string) **(required)**: - `tasks` (object[]) **(required)**: - `task` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `color` (string,null) **(required)**: - `style` (string) **(required)**: Values: `primary`, `secondary`, `danger`, `default` - `completionTrigger` (string) **(required)**: Values: `acknowledge`, `assign_tray`, `upload_file`, `change_status`, `decision`, `set_manual_file_path`, `surgical_report` - `completionTriggerConfig` (object) **(required)**: - `sideEffects` (array) **(required)**: - `captureConfig` (object) **(required)**: - `requireNotes` (boolean): (default: `false`) - `requirePhoto` (boolean): (default: `false`) - `notesPlaceholder` (string): - `notesMaxLength` (integer): - `roomId` (string,null) **(required)**: - `sortOrder` (integer) **(required)**: - `advancesPhase` (boolean) **(required)**: - `done` (boolean) **(required)**: - `isCurrent` (boolean) **(required)**: - `assignedToMemberId` (string,null) **(required)**: - `scheduledDate` (string,null) **(required)**: - `notes` (string,null) **(required)**: ### 404: Order not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/orders/{id}/task-plan" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Storico: lab-wide activity feed `GET https://api-stage.guidelab.co/production/activity` Returns activity rows across all orders in the current lab, joined with order/member/user/task metadata. Supports event-type filter and createdAt cursor-based pagination. Documentation: https://docs.guidelab.co/api-reference/production/listProductionActivityFeed ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `days` (integer) (in: query): - `limit` (integer) (in: query): Default: `100` - `cursor` (string) (in: query): ISO timestamp of the last item returned in the previous page. Items with createdAt < cursor are returned. - `eventType` (string) (in: query): Values: `task_fired`, `task_review_event`, `status_changed`, `phase_changed`, `tray_assigned`, `file_uploaded`, `note_added`, `system`, `hold_requirement_changed` ## Responses ### 200: Activity feed items - `items` (object[]) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string) **(required)**: - `eventType` (string) **(required)**: Values: `task_fired`, `task_review_event`, `status_changed`, `phase_changed`, `tray_assigned`, `file_uploaded`, `note_added`, `system`, `hold_requirement_changed` - `taskName` (string,null) **(required)**: - `actorName` (string) **(required)**: - `isSystemActor` (boolean) **(required)**: - `actorKind` (string) **(required)**: Values: `system`, `user`, `anonymized_user` - `createdAt` (string) **(required)**: - `payload` (object) **(required)**: - `phaseAtTime` (string,null) **(required)**: - `statusAtTime` (string,null) **(required)**: Values: `draft`, `submitted`, `active`, `completed`, `cancelled`, `on_hold`, `null` - `nextCursor` (string): ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/activity" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List production teammates `GET https://api-stage.guidelab.co/production/teammates` Retrieves a paginated list of lab members with their production room assignments. Supports filtering by room and search by name or email. Documentation: https://docs.guidelab.co/api-reference/production/listProductionTeammates ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `roomId` (string) (in: query): - `search` (string) (in: query): - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `50` ## Responses ### 200: Paginated list of teammates with room assignments - `teammates` (object[]) **(required)**: - `id` (string) **(required)**: - `userId` (string) **(required)**: - `role` (string) **(required)**: - `user` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `email` (string) **(required)**: - `image` (string,null) **(required)**: - `rooms` (object[]) **(required)**: - `id` (string) **(required)**: - `memberId` (string) **(required)**: - `roomId` (string) **(required)**: - `canView` (boolean) **(required)**: - `canWork` (boolean) **(required)**: - `canAssign` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `room` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `color` (string) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — missing or invalid session ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/teammates" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get teammate room assignments `GET https://api-stage.guidelab.co/production/teammates/{memberId}/rooms` Retrieves all production room assignments for a specific lab member, including room details and permission flags (canView, canWork, canAssign). Documentation: https://docs.guidelab.co/api-reference/production/getTeammateRoomAssignments ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `memberId` (string) **(required)** (in: path): Member ID ## Responses ### 200: List of room assignments with permissions - `rooms` (object[]) **(required)**: - `id` (string) **(required)**: - `memberId` (string) **(required)**: - `roomId` (string) **(required)**: - `canView` (boolean) **(required)**: - `canWork` (boolean) **(required)**: - `canAssign` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `room` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `color` (string) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — missing or invalid session ### 404: Member not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/teammates/{memberId}/rooms" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Assign a room to a teammate `POST https://api-stage.guidelab.co/production/teammates/{memberId}/rooms` Assigns a production room to a lab member with configurable permissions (canView, canWork, canAssign). Returns a 409 if the member is already assigned to the room. Documentation: https://docs.guidelab.co/api-reference/production/assignTeammateRoom ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `memberId` (string) **(required)** (in: path): Member ID ## Responses ### 201: Room assignment created successfully - `assignment` (object) **(required)**: - `id` (string) **(required)**: - `memberId` (string) **(required)**: - `roomId` (string) **(required)**: - `canView` (boolean) **(required)**: - `canWork` (boolean) **(required)**: - `canAssign` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `room` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `color` (string) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — missing or invalid session ### 404: Member or room not found ### 409: Member is already assigned to this room ## Example ```bash curl -X POST "https://api-stage.guidelab.co/production/teammates/{memberId}/rooms" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Remove a teammate room assignment `DELETE https://api-stage.guidelab.co/production/teammates/{memberId}/rooms` Removes a production room assignment from a lab member. The roomId must be provided in the request body. Documentation: https://docs.guidelab.co/api-reference/production/removeTeammateRoomAssignment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `memberId` (string) **(required)** (in: path): Member ID ## Responses ### 200: Room assignment removed successfully - `success` (boolean) **(required)**: ### 401: Unauthorized — missing or invalid session ### 404: Member or room assignment not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/production/teammates/{memberId}/rooms" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update teammate room permissions `PUT https://api-stage.guidelab.co/production/teammates/{memberId}/rooms` Updates a member's permissions for a specific production room assignment, including canView, canWork, and canAssign flags. Documentation: https://docs.guidelab.co/api-reference/production/updateTeammateRoomPermissions ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `memberId` (string) **(required)** (in: path): Member ID ## Responses ### 200: Room permissions updated successfully - `assignment` (object) **(required)**: - `id` (string) **(required)**: - `memberId` (string) **(required)**: - `roomId` (string) **(required)**: - `canView` (boolean) **(required)**: - `canWork` (boolean) **(required)**: - `canAssign` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — missing or invalid session ### 404: Member or room assignment not found ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/production/teammates/{memberId}/rooms" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get teammate production settings `GET https://api-stage.guidelab.co/production/teammates/{memberId}/settings` Retrieves production-specific settings for a lab member, including daily unit capacity, access level, default room, and unassigned task visibility. Returns defaults if no settings are configured. Documentation: https://docs.guidelab.co/api-reference/production/getTeammateSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `memberId` (string) **(required)** (in: path): Member ID ## Responses ### 200: Member production settings - `settings` (object) **(required)**: - `memberId` (string) **(required)**: - `dailyUnitCapacity` (number) **(required)**: - `accessLevel` (string) **(required)**: - `showUnassignedTasks` (boolean) **(required)**: - `defaultRoomId` (string,null) **(required)**: - `defaultRoom` (object,null) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `color` (string) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — missing or invalid session ### 404: Member not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/teammates/{memberId}/settings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update teammate production settings `PUT https://api-stage.guidelab.co/production/teammates/{memberId}/settings` Creates or updates production-specific settings for a lab member. Upserts the settings record, creating one with defaults if it does not exist yet. Documentation: https://docs.guidelab.co/api-reference/production/updateTeammateSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `memberId` (string) **(required)** (in: path): Member ID ## Responses ### 200: Member settings updated successfully - `settings` (object) **(required)**: - `id` (string) **(required)**: - `memberId` (string) **(required)**: - `dailyUnitCapacity` (number) **(required)**: - `accessLevel` (string) **(required)**: - `showUnassignedTasks` (boolean) **(required)**: - `defaultRoomId` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — missing or invalid session ### 404: Member not found ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/production/teammates/{memberId}/settings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get production statistics overview `GET https://api-stage.guidelab.co/production/statistics/overview` Returns a minimal production statistics overview computed from the activity log. Detailed per-room / per-member breakdowns are TODO under the new task model. Documentation: https://docs.guidelab.co/api-reference/production/getProductionStatisticsOverview ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `startDate` (string) (in: query): - `endDate` (string) (in: query): ## Responses ### 200: Statistics overview - `overview` (object) **(required)**: - `totalTasks` (number) **(required)**: - `completedTasks` (number) **(required)**: - `inProgressTasks` (number) **(required)**: - `pendingTasks` (number) **(required)**: - `averageCompletionTime` (number,null) **(required)**: - `capacityUsage` (number) **(required)**: - `byRoom` (array): (default: ``) - `byMember` (array): (default: ``) - `dailyTrend` (object[]) **(required)**: - `date` (string) **(required)**: - `completed` (number) **(required)**: - `total` (number) **(required)**: - `dateRange` (object) **(required)**: - `startDate` (string) **(required)**: - `endDate` (string) **(required)**: ### 409: Organization timezone is not a valid IANA zone - `error` (string) **(required)**: - `code` (string) **(required)**: Values: `ORGANIZATION_CONFIGURATION_INVALID` ## Example ```bash curl -X GET "https://api-stage.guidelab.co/production/statistics/overview" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List inventory categories `GET https://api-stage.guidelab.co/inventory/categories` Returns all inventory categories for the current organization, ordered by sort order and name. Optionally includes inactive categories. Documentation: https://docs.guidelab.co/api-reference/inventory/listInventoryCategories ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` (string) (in: query): Set to 'true' to include inactive categories ## Responses ### 200: List of inventory categories - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `parentId` (string,null) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/inventory/categories" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create an inventory category `POST https://api-stage.guidelab.co/inventory/categories` Creates a new inventory category for organizing inventory items. Supports hierarchical parent-child relationships. Documentation: https://docs.guidelab.co/api-reference/inventory/createInventoryCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `description` (string): - `parentId` (string): - `icon` (string): - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Category created successfully - `data` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `parentId` (string,null) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized - valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/categories" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "parentId": "string", "icon": "string", "sortOrder": 0, "isActive": true }' ``` --- # Reorder inventory categories `POST https://api-stage.guidelab.co/inventory/categories/reorder` Updates the sort order of inventory categories based on the provided ordered list of category IDs. All IDs must belong to the current organization. Documentation: https://docs.guidelab.co/api-reference/inventory/reorderInventoryCategories ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `categoryIds` (string[]) **(required)**: ## Responses ### 200: Categories reordered successfully - `success` (boolean) **(required)**: ### 400: Invalid request body ### 401: Unauthorized - valid session required ### 404: One or more categories not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/categories/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "categoryIds": [ "string" ] }' ``` --- # Seed default inventory categories `POST https://api-stage.guidelab.co/inventory/categories/seed` Populates the organization with preset inventory categories based on the organization type (lab or clinic). This is idempotent and will not re-seed if already done. Documentation: https://docs.guidelab.co/api-reference/inventory/seedInventoryCategories ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Categories already seeded - `data` (object) **(required)**: - `alreadySeeded` (boolean): - `seeded` (number): ### 201: Default categories seeded successfully - `data` (object) **(required)**: - `seeded` (number) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/categories/seed" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get an inventory category `GET https://api-stage.guidelab.co/inventory/categories/{id}` Retrieves the full details of a single inventory category by its ID. Documentation: https://docs.guidelab.co/api-reference/inventory/getInventoryCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Category ID ## Responses ### 200: Category details - `data` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `parentId` (string,null) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized - valid session required ### 404: Category not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/inventory/categories/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete an inventory category `DELETE https://api-stage.guidelab.co/inventory/categories/{id}` Permanently deletes an inventory category. Items in this category will lose their category association. Documentation: https://docs.guidelab.co/api-reference/inventory/deleteInventoryCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Category ID ## Responses ### 200: Category deleted successfully - `success` (boolean) **(required)**: ### 401: Unauthorized - valid session required ### 404: Category not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/inventory/categories/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update an inventory category `PUT https://api-stage.guidelab.co/inventory/categories/{id}` Updates the properties of an existing inventory category such as name, description, icon, or active status. Documentation: https://docs.guidelab.co/api-reference/inventory/updateInventoryCategory ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Category ID ## Request Body Content-Type: `application/json` - `name` (string): - `description` (string): - `parentId` (string): - `icon` (string): - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 200: Updated category - `data` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `parentId` (string,null) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `icon` (string,null) **(required)**: - `sortOrder` (number) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized - valid session required ### 404: Category not found ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/inventory/categories/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "parentId": "string", "icon": "string", "sortOrder": 0, "isActive": true }' ``` --- # List inventory items `GET https://api-stage.guidelab.co/inventory/items` Returns a paginated list of inventory items for the current organization. Supports filtering by category, supplier, low stock, expiring soon, and search by name or SKU. Documentation: https://docs.guidelab.co/api-reference/inventory/listInventoryItems ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `search` (string) (in: query): - `categoryId` (string) (in: query): - `supplierId` (string) (in: query): - `lowStock` () (in: query): Default: `false` - `expiringSoon` () (in: query): Default: `false` - `includeInactive` () (in: query): Default: `false` - `sortBy` (string) (in: query): Values: `name`, `sku`, `currentQuantity`, `unitCost`, `expirationDate`, `createdAt` Default: `name` - `sortOrder` (string) (in: query): Values: `asc`, `desc` Default: `asc` ## Responses ### 200: Paginated list of inventory items with category and supplier names - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `supplierId` (string,null) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `description` (string,null) **(required)**: - `unit` (string) **(required)**: - `currentQuantity` (string) **(required)**: - `minQuantity` (string,null) **(required)**: - `maxQuantity` (string,null) **(required)**: - `unitCost` (string,null) **(required)**: - `currency` (string) **(required)**: - `storageLocation` (string,null) **(required)**: - `lotNumber` (string,null) **(required)**: - `expirationDate` (string,null) **(required)**: - `barcode` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `categoryName` (string,null) **(required)**: - `supplierName` (string,null) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/inventory/items" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create an inventory item `POST https://api-stage.guidelab.co/inventory/items` Creates a new inventory item in the organization's catalog. If the initial quantity is greater than zero, an initial stock adjustment is automatically recorded. Documentation: https://docs.guidelab.co/api-reference/inventory/createInventoryItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `sku` (string): - `description` (string): - `categoryId` (string): - `supplierId` (string): - `unit` (string): (default: `pcs`) Values: `pcs`, `g`, `kg`, `ml`, `L`, `box`, `roll`, `pack`, `set`, `pair`, `sheet`, `tube`, `bottle`, `cartridge`, `syringe`, `capsule` - `currentQuantity` (object): (default: `0`) - `minQuantity` (object): - `maxQuantity` (object): - `unitCost` (string,null): - `currency` (string): (default: `GBP`) Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `storageLocation` (string): - `lotNumber` (string): - `expirationDate` (string,null): - `barcode` (string): - `notes` (string): ## Responses ### 201: Inventory item created successfully - `data` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `unit` (string) **(required)**: - `currentQuantity` (string) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized - valid session required ### 409: An item with this SKU already exists ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/items" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string" }' ``` --- # Get an inventory item `GET https://api-stage.guidelab.co/inventory/items/{id}` Retrieves the full details of a single inventory item by its ID, including category name. Documentation: https://docs.guidelab.co/api-reference/inventory/getInventoryItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Inventory item ID ## Responses ### 200: Inventory item details with category name - `data` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `categoryId` (string,null) **(required)**: - `supplierId` (string,null) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `description` (string,null) **(required)**: - `unit` (string) **(required)**: - `currentQuantity` (string) **(required)**: - `minQuantity` (string,null) **(required)**: - `maxQuantity` (string,null) **(required)**: - `unitCost` (string,null) **(required)**: - `currency` (string) **(required)**: - `storageLocation` (string,null) **(required)**: - `lotNumber` (string,null) **(required)**: - `expirationDate` (string,null) **(required)**: - `barcode` (string,null) **(required)**: - `imageKey` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `categoryName` (string,null) **(required)**: ### 401: Unauthorized - valid session required ### 404: Item not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/inventory/items/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Archive an inventory item `DELETE https://api-stage.guidelab.co/inventory/items/{id}` Soft-deletes an inventory item by marking it as inactive and setting the archived timestamp. The item remains in the database for historical reference. Documentation: https://docs.guidelab.co/api-reference/inventory/archiveInventoryItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Inventory item ID ## Responses ### 200: Item archived successfully - `success` (boolean) **(required)**: ### 401: Unauthorized - valid session required ### 404: Item not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/inventory/items/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update an inventory item `PUT https://api-stage.guidelab.co/inventory/items/{id}` Updates the metadata of an existing inventory item. Does not change the current quantity - use stock adjustments for that. Documentation: https://docs.guidelab.co/api-reference/inventory/updateInventoryItem ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Inventory item ID ## Request Body Content-Type: `application/json` - `name` (string): - `sku` (string): - `description` (string): - `categoryId` (string): - `supplierId` (string): - `unit` (string): (default: `pcs`) Values: `pcs`, `g`, `kg`, `ml`, `L`, `box`, `roll`, `pack`, `set`, `pair`, `sheet`, `tube`, `bottle`, `cartridge`, `syringe`, `capsule` - `currentQuantity` (object): (default: `0`) - `minQuantity` (object): - `maxQuantity` (object): - `unitCost` (string,null): - `currency` (string): (default: `GBP`) Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `storageLocation` (string): - `lotNumber` (string): - `expirationDate` (string,null): - `barcode` (string): - `notes` (string): ## Responses ### 200: Updated inventory item - `data` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `unit` (string) **(required)**: - `currentQuantity` (string) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized - valid session required ### 404: Item not found ### 409: An item with this SKU already exists ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/inventory/items/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Get an inventory item image `GET https://api-stage.guidelab.co/inventory/items/{id}/image` Serves the managed image attached to an inventory item. Documentation: https://docs.guidelab.co/api-reference/inventory/getInventoryItemImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Inventory item image binary ### 404: Item or image not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/inventory/items/{id}/image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Upload an inventory item image `POST https://api-stage.guidelab.co/inventory/items/{id}/image` Uploads or replaces the managed image for an inventory item. Documentation: https://docs.guidelab.co/api-reference/inventory/uploadInventoryItemImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Inventory item image attached - `imageKey` (string) **(required)**: ### 400: Invalid image ### 404: Item not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/items/{id}/image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete an inventory item image `DELETE https://api-stage.guidelab.co/inventory/items/{id}/image` Detaches an inventory item image and queues object deletion. Documentation: https://docs.guidelab.co/api-reference/inventory/deleteInventoryItemImage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Inventory item image removed - `success` (boolean) **(required)**: ### 404: Item or image not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/inventory/items/{id}/image" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List suppliers `GET https://api-stage.guidelab.co/inventory/suppliers` Returns a paginated list of suppliers for the current organization. Supports search by name, code, or email and optional inclusion of inactive suppliers. Documentation: https://docs.guidelab.co/api-reference/inventory/listSuppliers ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `search` (string) (in: query): - `includeInactive` () (in: query): Default: `false` ## Responses ### 200: Paginated list of suppliers - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `contactName` (string,null) **(required)**: - `email` (string,null) **(required)**: - `phone` (string,null) **(required)**: - `website` (string,null) **(required)**: - `country` (string) **(required)**: - `currency` (string) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/inventory/suppliers" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a supplier `POST https://api-stage.guidelab.co/inventory/suppliers` Creates a new supplier record for the organization, including contact details, payment terms, and delivery preferences. Documentation: https://docs.guidelab.co/api-reference/inventory/createSupplier ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `code` (string): - `contactName` (string): - `email` (object): - `phone` (string): - `website` (string): - `address` (string): - `addressLine2` (string): - `city` (string): - `postcode` (string): - `country` (string): (default: `GB`) - `paymentTerms` (string): - `leadTimeDays` (integer,null): - `minimumOrderValue` (string,null): - `currency` (string): (default: `GBP`) Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `notes` (string): ## Responses ### 201: Supplier created successfully - `data` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `country` (string) **(required)**: - `currency` (string) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized - valid session required ### 409: A supplier with this code already exists ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/suppliers" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string" }' ``` --- # Get a supplier `GET https://api-stage.guidelab.co/inventory/suppliers/{id}` Retrieves the full details of a single supplier by its ID. Documentation: https://docs.guidelab.co/api-reference/inventory/getSupplier ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Supplier ID ## Responses ### 200: Supplier details - `data` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `contactName` (string,null) **(required)**: - `email` (string,null) **(required)**: - `phone` (string,null) **(required)**: - `website` (string,null) **(required)**: - `country` (string) **(required)**: - `currency` (string) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized - valid session required ### 404: Supplier not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/inventory/suppliers/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Archive a supplier `DELETE https://api-stage.guidelab.co/inventory/suppliers/{id}` Soft-deletes a supplier by marking it as inactive and setting the archived timestamp. The supplier remains in the database for historical reference. Documentation: https://docs.guidelab.co/api-reference/inventory/archiveSupplier ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Supplier ID ## Responses ### 200: Supplier archived successfully - `success` (boolean) **(required)**: ### 401: Unauthorized - valid session required ### 404: Supplier not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/inventory/suppliers/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a supplier `PUT https://api-stage.guidelab.co/inventory/suppliers/{id}` Updates the details of an existing supplier including contact information, payment terms, and delivery preferences. Documentation: https://docs.guidelab.co/api-reference/inventory/updateSupplier ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Supplier ID ## Request Body Content-Type: `application/json` - `name` (string): - `code` (string): - `contactName` (string): - `email` (object): - `phone` (string): - `website` (string): - `address` (string): - `addressLine2` (string): - `city` (string): - `postcode` (string): - `country` (string): (default: `GB`) - `paymentTerms` (string): - `leadTimeDays` (integer,null): - `minimumOrderValue` (string,null): - `currency` (string): (default: `GBP`) Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `notes` (string): ## Responses ### 200: Updated supplier - `data` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `name` (string) **(required)**: - `code` (string,null) **(required)**: - `country` (string) **(required)**: - `currency` (string) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized - valid session required ### 404: Supplier not found ### 409: A supplier with this code already exists ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/inventory/suppliers/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # List stock adjustments `GET https://api-stage.guidelab.co/inventory/adjustments` Returns a paginated list of stock adjustment history for the current organization. Supports filtering by item, reason, and date range. Documentation: https://docs.guidelab.co/api-reference/inventory/listStockAdjustments ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `inventoryItemId` (string) (in: query): - `reason` (string) (in: query): - `source` (string) (in: query): Values: `manual`, `order_consumption`, `order_reversal`, `purchase_receipt`, `system` - `dateFrom` (string) (in: query): - `dateTo` (string) (in: query): - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` ## Responses ### 200: Paginated list of stock adjustments with item and user names - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `inventoryItemId` (string) **(required)**: - `quantityBefore` (string) **(required)**: - `quantityChange` (string) **(required)**: - `quantityAfter` (string) **(required)**: - `source` (string) **(required)**: Values: `manual`, `order_consumption`, `order_reversal`, `purchase_receipt`, `system` - `reason` (string) **(required)**: - `notes` (string,null) **(required)**: - `orderId` (string,null) **(required)**: - `orderItemId` (string,null) **(required)**: - `purchaseOrderId` (string,null) **(required)**: - `purchaseOrderItemId` (string,null) **(required)**: - `purchaseOrderReceiptId` (string,null) **(required)**: - `lotNumber` (string,null) **(required)**: - `expirationDate` (string,null) **(required)**: - `reversesAdjustmentId` (string,null) **(required)**: - `adjustedBy` (string) **(required)**: - `createdAt` (string) **(required)**: - `itemName` (string,null) **(required)**: - `adjustedByName` (string,null) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/inventory/adjustments" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a stock adjustment `POST https://api-stage.guidelab.co/inventory/adjustments` Records a manual stock adjustment for an inventory item. The quantity change can be positive (adding stock) or negative (removing stock). The item's current quantity is updated atomically. Documentation: https://docs.guidelab.co/api-reference/inventory/createStockAdjustment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `inventoryItemId` (string) **(required)**: - `quantityChange` (object) **(required)**: - `reason` (string) **(required)**: - `notes` (string): - `orderId` (string): - `orderItemId` (string): ## Responses ### 201: Stock adjustment recorded and item quantity updated - `data` (object) **(required)**: - `id` (string) **(required)**: - `inventoryItemId` (string) **(required)**: - `organizationId` (string) **(required)**: - `quantityBefore` (string) **(required)**: - `quantityChange` (string) **(required)**: - `quantityAfter` (string) **(required)**: - `source` (string) **(required)**: Values: `manual` - `reason` (string) **(required)**: - `notes` (string,null) **(required)**: - `adjustedBy` (string) **(required)**: - `createdAt` (string) **(required)**: ### 400: Invalid request body or stock cannot go below zero ### 401: Unauthorized - valid session required ### 404: Inventory item not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/adjustments" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "inventoryItemId": "string", "quantityChange": "string", "reason": "string", "notes": "string", "orderId": "string", "orderItemId": "string" }' ``` --- # List adjustment reasons `GET https://api-stage.guidelab.co/inventory/adjustment-reasons` Returns all stock adjustment reasons for the current organization, ordered by sort order and label. Optionally includes inactive reasons. Documentation: https://docs.guidelab.co/api-reference/inventory/listAdjustmentReasons ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` (string) (in: query): Set to 'true' to include inactive reasons ## Responses ### 200: List of adjustment reasons - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `key` (string) **(required)**: - `label` (string) **(required)**: - `isSystem` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/inventory/adjustment-reasons" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create an adjustment reason `POST https://api-stage.guidelab.co/inventory/adjustment-reasons` Creates a custom stock adjustment reason for the organization. A unique key is auto-generated from the label if not provided. Documentation: https://docs.guidelab.co/api-reference/inventory/createAdjustmentReason ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `label` (string) **(required)**: - `key` (string): ## Responses ### 201: Adjustment reason created successfully - `data` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `key` (string) **(required)**: - `label` (string) **(required)**: - `isSystem` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body or could not generate a valid key ### 401: Unauthorized - valid session required ### 409: A reason with this key already exists ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/adjustment-reasons" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "label": "string", "key": "string" }' ``` --- # Reorder adjustment reasons `POST https://api-stage.guidelab.co/inventory/adjustment-reasons/reorder` Updates the sort order of adjustment reasons based on the provided ordered list of reason IDs. All IDs must belong to the current organization. Documentation: https://docs.guidelab.co/api-reference/inventory/reorderAdjustmentReasons ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `reasonIds` (string[]) **(required)**: ## Responses ### 200: Reasons reordered successfully - `success` (boolean) **(required)**: ### 400: Invalid request body ### 401: Unauthorized - valid session required ### 404: One or more reasons not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/adjustment-reasons/reorder" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "reasonIds": [ "string" ] }' ``` --- # Seed default adjustment reasons `POST https://api-stage.guidelab.co/inventory/adjustment-reasons/seed` Populates the organization with a default set of stock adjustment reasons (e.g. damaged, expired, manual correction). This is idempotent and will not re-seed if already done. Documentation: https://docs.guidelab.co/api-reference/inventory/seedAdjustmentReasons ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Reasons already seeded - `data` (object) **(required)**: - `alreadySeeded` (boolean): - `seeded` (number): ### 201: Default adjustment reasons seeded successfully - `data` (object) **(required)**: - `seeded` (number) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/adjustment-reasons/seed" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete an adjustment reason `DELETE https://api-stage.guidelab.co/inventory/adjustment-reasons/{id}` Permanently deletes a custom stock adjustment reason. System-provided reasons cannot be deleted. Documentation: https://docs.guidelab.co/api-reference/inventory/deleteAdjustmentReason ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Reason ID ## Responses ### 200: Reason deleted successfully - `success` (boolean) **(required)**: ### 401: Unauthorized - valid session required ### 403: System reasons cannot be deleted ### 404: Reason not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/inventory/adjustment-reasons/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update an adjustment reason `PUT https://api-stage.guidelab.co/inventory/adjustment-reasons/{id}` Updates the label of an existing stock adjustment reason. Documentation: https://docs.guidelab.co/api-reference/inventory/updateAdjustmentReason ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Reason ID ## Request Body Content-Type: `application/json` - `label` (string) **(required)**: ## Responses ### 200: Updated adjustment reason - `data` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `key` (string) **(required)**: - `label` (string) **(required)**: - `isSystem` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized - valid session required ### 404: Reason not found ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/inventory/adjustment-reasons/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "label": "string" }' ``` --- # List purchase orders `GET https://api-stage.guidelab.co/inventory/purchase-orders` Returns a paginated list of purchase orders for the current organization. Supports filtering by status and supplier. Documentation: https://docs.guidelab.co/api-reference/inventory/listPurchaseOrders ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `status` (string) (in: query): Values: `draft`, `sent`, `partially_received`, `received`, `cancelled` - `supplierId` (string) (in: query): ## Responses ### 200: Paginated list of purchase orders with supplier names - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `poNumber` (string) **(required)**: - `status` (string) **(required)**: - `supplierId` (string) **(required)**: - `subtotal` (string,null) **(required)**: - `taxAmount` (string,null) **(required)**: - `totalAmount` (string,null) **(required)**: - `currency` (string) **(required)**: - `orderDate` (string,null) **(required)**: - `expectedDeliveryDate` (string,null) **(required)**: - `receivedDate` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `supplierName` (string,null) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/inventory/purchase-orders" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a purchase order `POST https://api-stage.guidelab.co/inventory/purchase-orders` Creates a new purchase order with line items for the specified supplier. Automatically generates a sequential PO number and calculates totals. Documentation: https://docs.guidelab.co/api-reference/inventory/createPurchaseOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `supplierId` (string) **(required)**: - `expectedDeliveryDate` (string): - `notes` (string): - `internalNotes` (string): - `items` (object[]) **(required)**: - `inventoryItemId` (string) **(required)**: - `quantityOrdered` (object) **(required)**: - `unitCost` (string) **(required)**: - `notes` (string): ## Responses ### 201: Purchase order created successfully - `data` (object) **(required)**: - `id` (string) **(required)**: - `poNumber` (string) **(required)**: - `status` (string) **(required)**: - `supplierId` (string) **(required)**: - `subtotal` (string,null) **(required)**: - `totalAmount` (string,null) **(required)**: - `currency` (string) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized - valid session required ### 404: Supplier not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/purchase-orders" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "supplierId": "string", "expectedDeliveryDate": "string", "notes": "string", "internalNotes": "string", "items": [ { "inventoryItemId": "string", "quantityOrdered": "string", "unitCost": "string", "notes": "string" } ] }' ``` --- # Get a purchase order `GET https://api-stage.guidelab.co/inventory/purchase-orders/{id}` Retrieves the full details of a purchase order including all line items with their associated inventory item names, SKUs, and units. Documentation: https://docs.guidelab.co/api-reference/inventory/getPurchaseOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Purchase order ID ## Responses ### 200: Purchase order details with line items - `data` (object) **(required)**: - `id` (string) **(required)**: - `poNumber` (string) **(required)**: - `status` (string) **(required)**: - `supplierId` (string) **(required)**: - `subtotal` (string,null) **(required)**: - `taxAmount` (string,null) **(required)**: - `totalAmount` (string,null) **(required)**: - `currency` (string) **(required)**: - `orderDate` (string,null) **(required)**: - `expectedDeliveryDate` (string,null) **(required)**: - `receivedDate` (string,null) **(required)**: - `notes` (string,null) **(required)**: - `internalNotes` (string,null) **(required)**: - `createdBy` (string) **(required)**: - `createdAt` (string) **(required)**: - `supplierName` (string,null) **(required)**: - `items` (object[]) **(required)**: - `id` (string) **(required)**: - `inventoryItemId` (string) **(required)**: - `quantityOrdered` (string) **(required)**: - `quantityReceived` (string) **(required)**: - `unitCost` (string) **(required)**: - `totalCost` (string) **(required)**: - `notes` (string,null) **(required)**: - `itemName` (string,null) **(required)**: - `itemSku` (string,null) **(required)**: - `itemUnit` (string,null) **(required)**: ### 401: Unauthorized - valid session required ### 404: Purchase order not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/inventory/purchase-orders/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete a purchase order `DELETE https://api-stage.guidelab.co/inventory/purchase-orders/{id}` Permanently deletes a purchase order. Only draft orders can be deleted; sent or received orders must be cancelled instead. Documentation: https://docs.guidelab.co/api-reference/inventory/deletePurchaseOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Purchase order ID ## Responses ### 200: Purchase order deleted successfully - `success` (boolean) **(required)**: ### 400: Only draft purchase orders can be deleted ### 401: Unauthorized - valid session required ### 404: Purchase order not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/inventory/purchase-orders/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Send a purchase order `POST https://api-stage.guidelab.co/inventory/purchase-orders/{id}/send` Transitions a draft purchase order to 'sent' status and records the order date. Only draft orders can be sent. Documentation: https://docs.guidelab.co/api-reference/inventory/sendPurchaseOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Purchase order ID ## Responses ### 200: Purchase order marked as sent - `data` (object) **(required)**: - `id` (string) **(required)**: - `poNumber` (string) **(required)**: - `status` (string) **(required)**: - `orderDate` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Only draft orders can be sent ### 401: Unauthorized - valid session required ### 404: Purchase order not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/purchase-orders/{id}/send" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Cancel a purchase order `POST https://api-stage.guidelab.co/inventory/purchase-orders/{id}/cancel` Cancels a purchase order. Cannot cancel orders that are already received or cancelled. Documentation: https://docs.guidelab.co/api-reference/inventory/cancelPurchaseOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Purchase order ID ## Responses ### 200: Purchase order cancelled - `data` (object) **(required)**: - `id` (string) **(required)**: - `poNumber` (string) **(required)**: - `status` (string) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Cannot cancel a received or already cancelled order ### 401: Unauthorized - valid session required ### 404: Purchase order not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/purchase-orders/{id}/cancel" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Receive purchase order items `POST https://api-stage.guidelab.co/inventory/purchase-orders/{id}/receive` Records the receipt of items from a purchase order. Updates inventory quantities, creates stock adjustments, and transitions the PO status to 'partially_received' or 'received' based on whether all items are fully received. Documentation: https://docs.guidelab.co/api-reference/inventory/receivePurchaseOrderItems ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Purchase order ID ## Request Body Content-Type: `application/json` - `commandId` (string) **(required)**: - `items` (object[]) **(required)**: - `purchaseOrderItemId` (string) **(required)**: - `quantityReceived` (object) **(required)**: - `lotNumber` (string): - `expirationDate` (string): ## Responses ### 200: Items received and inventory updated - `data` (object) **(required)**: - `status` (string) **(required)**: ### 400: Only sent or partially received orders can receive items ### 401: Unauthorized - valid session required ### 404: Purchase order not found ### 409: Receipt request is already being processed ### 422: commandId was reused with different receipt parameters ## Example ```bash curl -X POST "https://api-stage.guidelab.co/inventory/purchase-orders/{id}/receive" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "commandId": "string", "items": [ { "purchaseOrderItemId": "string", "quantityReceived": "string", "lotNumber": "string", "expirationDate": "string" } ] }' ``` --- # Get inventory settings `GET https://api-stage.guidelab.co/inventory/settings` Retrieves the user-editable inventory settings for the current organization. Returns sensible defaults if no settings have been configured yet. Documentation: https://docs.guidelab.co/api-reference/inventory/getInventorySettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Inventory settings for the organization - `data` (object) **(required)**: - `lowStockAlertEnabled` (boolean) **(required)**: - `expirationAlertDays` (number) **(required)**: - `autoDeductOnOrderComplete` (boolean) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/inventory/settings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update inventory settings `PUT https://api-stage.guidelab.co/inventory/settings` Creates or updates the inventory module settings for the current organization. Performs an upsert - creates the settings row if it does not exist yet. Documentation: https://docs.guidelab.co/api-reference/inventory/updateInventorySettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `lowStockAlertEnabled` (boolean): - `expirationAlertDays` (integer): - `autoDeductOnOrderComplete` (boolean): ## Responses ### 200: Updated inventory settings - `data` (object) **(required)**: - `id` (string) **(required)**: - `organizationId` (string) **(required)**: - `lowStockAlertEnabled` (boolean) **(required)**: - `expirationAlertDays` (number) **(required)**: - `autoDeductOnOrderComplete` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 401: Unauthorized - valid session required ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/inventory/settings" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "lowStockAlertEnabled": true, "expirationAlertDays": 0, "autoDeductOnOrderComplete": true }' ``` --- # Get inventory dashboard statistics `GET https://api-stage.guidelab.co/inventory/dashboard/stats` Returns a comprehensive dashboard overview including total item count, total inventory value, low-stock and out-of-stock counts, expiring items, top 10 low-stock items, top 10 expiring items, recent stock adjustments, and category breakdown with values. Documentation: https://docs.guidelab.co/api-reference/inventory/getInventoryDashboardStats ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Inventory dashboard statistics and alerts - `data` (object) **(required)**: - `totalItems` (number) **(required)**: - `totalValue` (string) **(required)**: - `lowStockCount` (number) **(required)**: - `outOfStockCount` (number) **(required)**: - `expiringCount` (number) **(required)**: - `expirationAlertDays` (number) **(required)**: - `lowStockItems` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `currentQuantity` (string) **(required)**: - `minQuantity` (string,null) **(required)**: - `unit` (string) **(required)**: - `expiringItems` (object[]) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `sku` (string,null) **(required)**: - `expirationDate` (string,null) **(required)**: - `currentQuantity` (string) **(required)**: - `unit` (string) **(required)**: - `recentAdjustments` (object[]) **(required)**: - `id` (string) **(required)**: - `inventoryItemId` (string) **(required)**: - `quantityChange` (string) **(required)**: - `source` (string) **(required)**: Values: `manual`, `order_consumption`, `order_reversal`, `purchase_receipt`, `system` - `reason` (string) **(required)**: - `notes` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `itemName` (string,null) **(required)**: - `adjustedByName` (string,null) **(required)**: - `categoryBreakdown` (object[]) **(required)**: - `categoryId` (string,null) **(required)**: - `categoryName` (string,null) **(required)**: - `categoryDescription` (string,null) **(required)**: - `categoryIcon` (string,null) **(required)**: - `itemCount` (number) **(required)**: - `totalValue` (string) **(required)**: ### 401: Unauthorized - valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/inventory/dashboard/stats" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Start Stripe Connect O Auth `POST https://api-stage.guidelab.co/stripe-connect/oauth/start` Start a one-time Stripe Standard OAuth flow. The lab owner can sign into an existing Stripe account or create a new one on Stripe. Documentation: https://docs.guidelab.co/api-reference/stripe-connect/startStripeConnectOAuth ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `returnUrl` (string): ## Responses ### 200: Stripe Standard OAuth authorization URL - `url` (string) **(required)**: [uri] - `accountId` (string,null) **(required)**: - `flow` (string) **(required)**: Values: `oauth` ### 409: The lab already has an active Stripe connection ### 500: Stripe Connect OAuth is not configured ### 503: Stripe environment is not configured safely ## Example ```bash curl -X POST "https://api-stage.guidelab.co/stripe-connect/oauth/start" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "returnUrl": "string" }' ``` --- # Onboard Stripe Connect `POST https://api-stage.guidelab.co/stripe-connect/onboard` Compatibility alias for the Stripe Standard OAuth start command. No account is created until the user selects or creates one on Stripe. Documentation: https://docs.guidelab.co/api-reference/stripe-connect/onboardStripeConnect ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `returnUrl` (string): ## Responses ### 200: Stripe Standard OAuth authorization URL - `url` (string) **(required)**: [uri] - `accountId` (string,null) **(required)**: - `flow` (string) **(required)**: Values: `oauth` ### 409: The lab already has an active Stripe connection ### 500: Stripe Connect OAuth is not configured ### 503: Stripe environment is not configured safely ## Example ```bash curl -X POST "https://api-stage.guidelab.co/stripe-connect/onboard" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "returnUrl": "string" }' ``` --- # Handle Stripe Connect O Auth Callback `GET https://api-stage.guidelab.co/stripe-connect/oauth/callback` Consume a lab-owner-bound OAuth state, exchange Stripe's one-time code, retain the connection generation, reconcile account requirements, and redirect safely to the app. Documentation: https://docs.guidelab.co/api-reference/stripe-connect/handleStripeConnectOAuthCallback ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `code` (string) (in: query): - `state` (string) (in: query): - `error` (string) (in: query): - `error_description` (string) (in: query): ## Responses ### 302: Redirect to the same-origin lab finance settings view ### 401: The initiating user session is unavailable ## Example ```bash curl -X GET "https://api-stage.guidelab.co/stripe-connect/oauth/callback" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Stripe Connect Status `GET https://api-stage.guidelab.co/stripe-connect/status` Return the cached active Stripe connection and its latest requirements snapshot without contacting Stripe. Documentation: https://docs.guidelab.co/api-reference/stripe-connect/getStripeConnectStatus ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Cached Stripe Connect status - `connected` (boolean) **(required)**: - `connectionId` (string,null) **(required)**: - `accountId` (string,null) **(required)**: - `accountType` (string,null) **(required)**: Values: `standard`, `express`, `custom`, `null` - `chargesEnabled` (boolean) **(required)**: - `payoutsEnabled` (boolean) **(required)**: - `onboardingComplete` (boolean) **(required)**: - `detailsSubmitted` (boolean) **(required)**: - `email` (string,null) **(required)**: - `businessName` (string,null) **(required)**: - `country` (string,null) **(required)**: - `requirements` (object) **(required)**: - `currentlyDue` (string[]) **(required)**: - `eventuallyDue` (string[]) **(required)**: - `pastDue` (string[]) **(required)**: - `pendingVerification` (string[]) **(required)**: - `disabledReason` (string,null) **(required)**: - `currentDeadline` (string,null) **(required)**: [date-time] - `connectedAt` (string,null) **(required)**: [date-time] - `lastProviderEventId` (string,null) **(required)**: - `lastProviderEventAt` (string,null) **(required)**: [date-time] ## Example ```bash curl -X GET "https://api-stage.guidelab.co/stripe-connect/status" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Refresh Stripe Connect Status `POST https://api-stage.guidelab.co/stripe-connect/status/refresh` Retrieve the active account from Stripe and reconcile its capabilities, onboarding state, and requirements snapshot. Documentation: https://docs.guidelab.co/api-reference/stripe-connect/refreshStripeConnectStatus ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Reconciled Stripe Connect status - `connected` (boolean) **(required)**: - `connectionId` (string,null) **(required)**: - `accountId` (string,null) **(required)**: - `accountType` (string,null) **(required)**: Values: `standard`, `express`, `custom`, `null` - `chargesEnabled` (boolean) **(required)**: - `payoutsEnabled` (boolean) **(required)**: - `onboardingComplete` (boolean) **(required)**: - `detailsSubmitted` (boolean) **(required)**: - `email` (string,null) **(required)**: - `businessName` (string,null) **(required)**: - `country` (string,null) **(required)**: - `requirements` (object) **(required)**: - `currentlyDue` (string[]) **(required)**: - `eventuallyDue` (string[]) **(required)**: - `pastDue` (string[]) **(required)**: - `pendingVerification` (string[]) **(required)**: - `disabledReason` (string,null) **(required)**: - `currentDeadline` (string,null) **(required)**: [date-time] - `connectedAt` (string,null) **(required)**: [date-time] - `lastProviderEventId` (string,null) **(required)**: - `lastProviderEventAt` (string,null) **(required)**: [date-time] ### 500: Stripe is not configured ### 502: Stripe account status is temporarily unavailable ### 503: Stripe environment is not configured safely ## Example ```bash curl -X POST "https://api-stage.guidelab.co/stripe-connect/status/refresh" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get Stripe Connect Dashboard Link `GET https://api-stage.guidelab.co/stripe-connect/dashboard-link` Return the Stripe Dashboard URL for Standard accounts, with legacy login-link support for Express accounts. Documentation: https://docs.guidelab.co/api-reference/stripe-connect/getStripeConnectDashboardLink ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Stripe Dashboard URL and account type - `url` (string) **(required)**: [uri] - `type` (string) **(required)**: ### 400: No Stripe account is connected ### 502: Stripe Dashboard is temporarily unavailable ## Example ```bash curl -X GET "https://api-stage.guidelab.co/stripe-connect/dashboard-link" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Disconnect Stripe Connect `POST https://api-stage.guidelab.co/stripe-connect/disconnect` Revoke the Standard OAuth authorization and deactivate the current local connection while retaining its account and lifecycle history. Documentation: https://docs.guidelab.co/api-reference/stripe-connect/disconnectStripeConnect ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Stripe account disconnected - `success` (boolean) **(required)**: Values: `true` - `message` (string) **(required)**: ### 400: No Stripe account is connected ### 409: Disconnect is blocked while payment, autopay, or refund commands are unsettled - `error` (string) **(required)**: - `blockers` (string[]) **(required)**: ### 500: Stripe Connect OAuth is not configured ### 502: Stripe rejected the disconnection ### 503: Stripe environment is not configured safely ## Example ```bash curl -X POST "https://api-stage.guidelab.co/stripe-connect/disconnect" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Payment Intent `POST https://api-stage.guidelab.co/checkout/create-payment-intent` Create a Stripe PaymentIntent for the authenticated clinic to pay invoices or an order basket. Clinic-only. Prices are resolved from the lab catalog. Documentation: https://docs.guidelab.co/api-reference/checkout/createPaymentIntent ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `labId` (string) **(required)**: Lab ID to pay - `idempotencyKey` (string) **(required)**: Stable key for this payment attempt; reuse it only for an exact retry - `invoiceIds` (string[]): - `items` (object[]): - `productId` (string) **(required)**: - `toothGroups` (object[]): - `id` (string) **(required)**: - `type` (string) **(required)**: Values: `single`, `bridge` - `teeth` (object[]) **(required)**: - `fdi` (integer) **(required)**: - `role` (string) **(required)**: Values: `crown`, `pontic` - `support` (string): Values: `natural`, `implant` - `implantSystemId` (string): - `implantPlatform` (string): - `quantity` (integer): (default: `1`) - `materialId` (string): - `material` (string): - `shadeSystemId` (string): - `shadeOcclusal` (string): - `shadeMiddle` (string): - `shadeGingival` (string): - `shadeNotes` (string): - `defaultImplantSystemId` (string): - `defaultImplantPlatform` (string): - `notes` (string): - `customFieldValues` (object): - `value` (object): - `fileIds` (string[]): - `bundleId` (string): - `bundleInstanceId` (string): - `draftOrderId` (string): ## Responses ### 200: PaymentIntent created with client secret for Stripe.js confirmation - `clientSecret` (string,null) **(required)**: - `paymentIntentId` (string) **(required)**: - `amount` (number) **(required)**: - `amountDisplay` (string) **(required)**: - `currency` (string) **(required)**: - `status` (string) **(required)**: - `convertedOrderId` (string,null) **(required)**: - `taxAmount` (string,null) **(required)**: - `taxMode` (string,null) **(required)**: Values: `none`, `exclusive`, `inclusive`, `null` - `taxIncludedInPrices` (boolean,null) **(required)**: ### 400: Invalid request, invoices not payable, or lab has not connected Stripe - `error` (string) **(required)**: - `details` (object): - `code` (string) **(required)**: Values: `payment_amount_exceeds_provider_limit` - `maxMinor` (string) **(required)**: Values: `99999999` - `currency` (string) **(required)**: ### 409: Payment attempt conflicts with an existing claim ### 500: Stripe secret key not configured ## Example ```bash curl -X POST "https://api-stage.guidelab.co/checkout/create-payment-intent" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "labId": "string", "idempotencyKey": "string", "invoiceIds": [ "string" ], "items": [ { "productId": "string" } ], "draftOrderId": "string" }' ``` --- # Confirm Checkout Payment `POST https://api-stage.guidelab.co/checkout/confirm-order` Verify that a Stripe PaymentIntent has succeeded after the client-side payment flow completes. Clinic-only. Used as a server-side confirmation step before updating order/invoice status. Documentation: https://docs.guidelab.co/api-reference/checkout/confirmCheckoutPayment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `paymentIntentId` (string) **(required)**: Stripe PaymentIntent ID to verify - `labId` (string) **(required)**: Lab ID the payment was made to ## Responses ### 200: Payment verified successfully with amount and currency details - `verified` (boolean) **(required)**: - `paymentIntentId` (string) **(required)**: - `amount` (number) **(required)**: - `currency` (string) **(required)**: - `convertedOrderId` (string) **(required)**: ### 400: Payment not completed, missing parameters, or lab not connected to Stripe ### 500: Stripe secret key not configured ## Example ```bash curl -X POST "https://api-stage.guidelab.co/checkout/confirm-order" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "paymentIntentId": "string", "labId": "string" }' ``` --- # Cancel Checkout Order Payment `POST https://api-stage.guidelab.co/checkout/cancel-order-payment` Cancel or reconcile the authenticated clinic's active upfront order payment before unlocking its prepared draft. Documentation: https://docs.guidelab.co/api-reference/checkout/cancelCheckoutOrderPayment ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `labId` (string) **(required)**: - `draftOrderId` (string) **(required)**: ## Responses ### 200: Payment canceled or reconciled - `unlocked` (boolean) **(required)**: - `convertedOrderId` (string,null) **(required)**: - `paymentIntentId` (string,null) **(required)**: ### 409: Payment is already final or cannot be canceled safely ### 500: Stripe secret key not configured ## Example ```bash curl -X POST "https://api-stage.guidelab.co/checkout/cancel-order-payment" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "labId": "string", "draftOrderId": "string" }' ``` --- # List Clinic Payment Methods `GET https://api-stage.guidelab.co/clinic-payment-methods` List saved payment methods for the authenticated clinic with a specific lab. Clinic-owner only. Requires labId query parameter to identify the lab's Stripe Connect account. Documentation: https://docs.guidelab.co/api-reference/clinic-payment-methods/listClinicPaymentMethods ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `labId` (string) **(required)** (in: query): Lab ID to retrieve payment methods for ## Responses ### 200: List of saved payment methods with card details and default status - `paymentMethods` (object[]) **(required)**: - `id` (string) **(required)**: - `type` (string) **(required)**: - `brand` (string,null) **(required)**: - `last4` (string,null) **(required)**: - `expMonth` (number,null) **(required)**: - `expYear` (number,null) **(required)**: - `isDefault` (boolean) **(required)**: ### 400: Missing labId parameter - `error` (string) **(required)**: ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic-payment-methods" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Delete Clinic Payment Method `DELETE https://api-stage.guidelab.co/clinic-payment-methods/{id}` Detach and remove a saved payment method from the authenticated clinic's Stripe customer. Clinic-owner only. Requires labId query parameter. Documentation: https://docs.guidelab.co/api-reference/clinic-payment-methods/deleteClinicPaymentMethod ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Stripe payment method ID to detach - `labId` (string) **(required)** (in: query): Lab ID the payment method belongs to ## Responses ### 200: Payment method detached successfully - `success` (boolean) **(required)**: ### 400: Missing labId or lab has not connected Stripe - `error` (string) **(required)**: ### 404: Customer, partnership, or payment method not found ### 409: Payment method is used by active autopay or the Stripe connection changed ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/clinic-payment-methods/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Set Default Clinic Payment Method `PUT https://api-stage.guidelab.co/clinic-payment-methods/{id}` Set a saved payment method as the default for the authenticated clinic with a specific lab. Clinic-owner only. Documentation: https://docs.guidelab.co/api-reference/clinic-payment-methods/setDefaultClinicPaymentMethod ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Stripe payment method ID ## Request Body Content-Type: `application/json` - `labId` (string) **(required)**: Lab ID the payment method belongs to ## Responses ### 200: Payment method set as default successfully - `success` (boolean) **(required)**: ### 400: Missing labId or lab has not connected Stripe - `error` (string) **(required)**: ### 404: No Stripe customer mapping found for this clinic-lab pair - `error` (string) **(required)**: ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/clinic-payment-methods/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "labId": "string" }' ``` --- # Create Clinic Setup Intent `POST https://api-stage.guidelab.co/clinic-payment-methods/setup-intent` Create a Stripe SetupIntent to save a new payment method for the authenticated clinic with a specific lab. Clinic-owner only. Automatically creates a Stripe customer if one does not exist. Documentation: https://docs.guidelab.co/api-reference/clinic-payment-methods/createClinicSetupIntent ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `labId` (string) **(required)**: Lab ID to create the setup intent for ## Responses ### 200: Setup intent created with client secret for Stripe.js confirmation - `clientSecret` (string,null) **(required)**: - `stripeAccountId` (string) **(required)**: ### 400: Missing labId or lab has not connected Stripe - `error` (string) **(required)**: ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/clinic-payment-methods/setup-intent" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "labId": "string" }' ``` --- # Get clinic autopay consent `GET https://api-stage.guidelab.co/clinic-payment-methods/autopay/{partnershipId}` Returns the clinic-owned saved-card autopay state for a partnership. Both partnership parties may read it; labs cannot mutate it. Documentation: https://docs.guidelab.co/api-reference/clinic-payment-methods/getClinicAutopayMandate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `partnershipId` (string) **(required)** (in: path): ## Responses ### 200: Autopay mandate state - `enabled` (boolean) **(required)**: - `status` (string,null) **(required)**: Values: `active`, `suspended`, `revoked`, `null` - `consentedAt` (string,null) **(required)**: [date-time] - `revokedAt` (string,null) **(required)**: [date-time] - `suspendedAt` (string,null) **(required)**: [date-time] ### 404: Partnership not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic-payment-methods/autopay/{partnershipId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Revoke clinic-owned autopay `DELETE https://api-stage.guidelab.co/clinic-payment-methods/autopay/{partnershipId}` Revokes future off-session charges for this partnership. Only a clinic owner can perform this operation; labs have read-only visibility. Documentation: https://docs.guidelab.co/api-reference/clinic-payment-methods/revokeClinicAutopayMandate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `partnershipId` (string) **(required)** (in: path): ## Responses ### 200: Autopay revoked - `enabled` (boolean) **(required)**: - `status` (string,null) **(required)**: Values: `active`, `suspended`, `revoked`, `null` - `consentedAt` (string,null) **(required)**: [date-time] - `revokedAt` (string,null) **(required)**: [date-time] - `suspendedAt` (string,null) **(required)**: [date-time] ### 404: Partnership not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/clinic-payment-methods/autopay/{partnershipId}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Enable clinic-owned saved-card autopay `POST https://api-stage.guidelab.co/clinic-payment-methods/autopay` Lets a clinic owner consent to off-session card charges for one active lab partnership. The selected card must already belong to that lab's connected Stripe customer. Documentation: https://docs.guidelab.co/api-reference/clinic-payment-methods/enableClinicAutopayMandate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `partnershipId` (string) **(required)**: - `paymentMethodId` (string) **(required)**: ## Responses ### 200: Autopay enabled - `enabled` (boolean) **(required)**: - `status` (string,null) **(required)**: Values: `active`, `suspended`, `revoked`, `null` - `consentedAt` (string,null) **(required)**: [date-time] - `revokedAt` (string,null) **(required)**: [date-time] - `suspendedAt` (string,null) **(required)**: [date-time] ### 400: Stripe is unavailable for this partnership ### 404: Partnership, customer, or card not found ### 409: The lab's connected account changed ### 500: Stripe is not configured ## Example ```bash curl -X POST "https://api-stage.guidelab.co/clinic-payment-methods/autopay" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "partnershipId": "string", "paymentMethodId": "string" }' ``` --- # Get lab dashboard statistics `GET https://api-stage.guidelab.co/dashboard/stats` Returns monthly order counts, revenue totals, completion rates, and deadline breakdown for the authenticated lab. Compares current month to previous month for trend calculation. Documentation: https://docs.guidelab.co/api-reference/dashboard/getLabDashboardStats ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Monthly stats, trends, and deadline counts - `monthly` (object) **(required)**: - `totalOrders` (number) **(required)**: - `completedOrders` (number) **(required)**: - `pendingOrders` (number) **(required)**: - `currency` (string) **(required)**: Currency scope of the legacy monetary fields; order counts include every currency. Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `revenue` (number) **(required)**: Compatibility projection of revenueExact for the lab currency. - `revenueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `avgOrderValue` (number) **(required)**: Compatibility projection of avgOrderValueExact for the lab currency. - `avgOrderValueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `currencyTotals` (object[]) **(required)**: - `currency` (string) **(required)**: Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `totalOrders` (number) **(required)**: - `completedOrders` (number) **(required)**: - `pendingOrders` (number) **(required)**: - `revenueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `previousRevenueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `avgOrderValueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `trends` (object) **(required)**: - `orders` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `completed` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `revenue` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `pending` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `trends` (object) **(required)**: - `orders` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `completed` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `revenue` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `pending` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `deadlines` (object) **(required)**: - `overdue` (number) **(required)**: - `today` (number) **(required)**: - `tomorrow` (number) **(required)**: - `thisWeek` (number) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/dashboard/stats" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get today's hourly breakdown `GET https://api-stage.guidelab.co/dashboard/today` Returns hourly order or revenue data for a given day (defaults to today). Includes cumulative totals and end-of-day projection. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/dashboard/getLabDashboardToday ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Hourly data points with cumulative totals and projection - `date` (string) **(required)**: - `metric` (string) **(required)**: Values: `orders`, `revenue` - `currency` (string,null) **(required)**: Currency of the numeric compatibility projection; null for the orders metric. Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR`, `null` - `dataPoints` (object[]) **(required)**: - `hour` (number) **(required)**: - `value` (number) **(required)**: - `cumulative` (number) **(required)**: - `valueExact` (string,null) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `cumulativeExact` (string,null) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `currencySeries` (object[]) **(required)**: - `currency` (string) **(required)**: Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `dataPoints` (object[]) **(required)**: - `hour` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `cumulativeExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `summary` (object) **(required)**: - `currentValueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `currentTime` (string) **(required)**: - `projectedEndOfDayExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `summary` (object) **(required)**: - `currentValue` (number) **(required)**: - `currentValueExact` (string,null) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `currentTime` (string) **(required)**: - `projectedEndOfDay` (number) **(required)**: - `projectedEndOfDayExact` (string,null) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/dashboard/today" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get order and revenue trends `GET https://api-stage.guidelab.co/dashboard/trends` Returns daily submitted and completed order counts and revenue over a date range (defaults to last 30 days). Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/dashboard/getLabDashboardTrends ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Daily series for submitted/completed orders with totals - `dateRange` (object) **(required)**: - `start` (string) **(required)**: - `end` (string) **(required)**: - `currency` (string) **(required)**: Currency scope of the legacy monetary fields; order counts include every currency. Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `series` (object) **(required)**: - `submitted` (object[]) **(required)**: - `date` (string) **(required)**: - `count` (number) **(required)**: - `value` (number) **(required)**: Compatibility projection of valueExact for the lab currency. - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `completed` (object[]) **(required)**: - `date` (string) **(required)**: - `count` (number) **(required)**: - `value` (number) **(required)**: Compatibility projection of valueExact for the lab currency. - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `currencySeries` (object[]) **(required)**: - `currency` (string) **(required)**: Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `series` (object) **(required)**: - `submitted` (object[]) **(required)**: - `date` (string) **(required)**: - `count` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `completed` (object[]) **(required)**: - `date` (string) **(required)**: - `count` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `totals` (object) **(required)**: - `submitted` (object) **(required)**: - `count` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `completed` (object) **(required)**: - `count` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `totals` (object) **(required)**: - `submitted` (object) **(required)**: - `count` (number) **(required)**: - `value` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `completed` (object) **(required)**: - `count` (number) **(required)**: - `value` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/dashboard/trends" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get active orders by deadline `GET https://api-stage.guidelab.co/dashboard/operations` Lists active orders filtered by deadline urgency (overdue, today, tomorrow, or all). Returns paginated results with patient, clinic, and category info. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/dashboard/getLabDashboardOperations ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `deadline` (string) (in: query): Values: `overdue`, `today`, `tomorrow`, `all` Default: `all` - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `20` - `status` (string) (in: query): ## Responses ### 200: Paginated list of active orders with deadline info - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: - `patient` (object,null) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `status` (string) **(required)**: - `practice` (object,null) **(required)**: - `name` (string) **(required)**: - `doctor` (string,null) **(required)**: - `category` (string,null) **(required)**: - `dueDate` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/dashboard/operations" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List orders currently blocked by an active hold `GET https://api-stage.guidelab.co/dashboard/blocked-orders` Returns a bounded cursor page of on-hold orders for the authenticated lab. Patient names honor the order's lab-masking policy. Documentation: https://docs.guidelab.co/api-reference/dashboard/getLabDashboardBlockedOrders ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `severity` (string) (in: query): Values: `critical`, `high`, `medium` - `cursor` (string) (in: query): - `limit` (integer) (in: query): Default: `10` ## Responses ### 200: Blocked orders ordered by newest active hold - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: - `holdId` (string) **(required)**: - `holdReasonName` (string) **(required)**: - `blockedAt` (string) **(required)**: - `blockedHours` (integer) **(required)**: - `overdueDays` (integer) **(required)**: - `severity` (string) **(required)**: Values: `critical`, `high`, `medium` - `deadline` (string,null) **(required)**: - `patientName` (string,null) **(required)**: - `practiceName` (string,null) **(required)**: - `deepLink` (string) **(required)**: - `counts` (object) **(required)**: - `all` (integer) **(required)**: - `critical` (integer) **(required)**: - `high` (integer) **(required)**: - `medium` (integer) **(required)**: - `nextCursor` (string,null) **(required)**: ### 400: Invalid cursor or query ### 401: Unauthorized ### 403: Only labs can list blocked orders ## Example ```bash curl -X GET "https://api-stage.guidelab.co/dashboard/blocked-orders" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get exact clinic dashboard counters `GET https://api-stage.guidelab.co/dashboard/clinic/stats` Returns tenant-scoped aggregate counters without loading or returning patient rows. Documentation: https://docs.guidelab.co/api-reference/dashboard/getClinicDashboardStats ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Clinic dashboard counters - `actionsRequired` (integer) **(required)**: - `awaitingApproval` (integer) **(required)**: - `activeOrders` (integer) **(required)**: - `deliveriesToday` (integer) **(required)**: ### 401: Unauthorized ### 403: Only clinics can read clinic dashboard stats ## Example ```bash curl -X GET "https://api-stage.guidelab.co/dashboard/clinic/stats" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List clinic actions `GET https://api-stage.guidelab.co/dashboard/clinic/actions` Returns a bounded, cursor-paginated union of current clinic actions. Deep links are derived from trusted source rows. Documentation: https://docs.guidelab.co/api-reference/dashboard/getClinicDashboardActions ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `cursor` (string) (in: query): - `limit` (integer) (in: query): Default: `6` ## Responses ### 200: Clinic action page - `data` (object[]) **(required)**: - `sourceKind` (string) **(required)**: - `sourceId` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string) **(required)**: - `actionType` (string) **(required)**: Values: `approve_surgical_report`, `upload_phase_files` - `priority` (string) **(required)**: Values: `high`, `medium`, `low` - `dueAt` (string,null) **(required)**: - `createdAt` (string) **(required)**: - `deepLink` (string) **(required)**: - `nextCursor` (string,null) **(required)**: ### 400: Invalid cursor or query ### 401: Unauthorized ### 403: Only clinics can list clinic actions ## Example ```bash curl -X GET "https://api-stage.guidelab.co/dashboard/clinic/actions" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List clinic-safe recent order activity `GET https://api-stage.guidelab.co/dashboard/clinic/activity` Returns only safe event classifications and order references. Raw activity payloads, notes, attachment IDs, and lab-internal task events are never selected. Documentation: https://docs.guidelab.co/api-reference/dashboard/getClinicDashboardActivity ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `cursor` (string) (in: query): - `limit` (integer) (in: query): Default: `4` ## Responses ### 200: Clinic activity page - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `orderId` (string) **(required)**: - `orderNumber` (string) **(required)**: - `eventType` (string) **(required)**: Values: `status_changed`, `phase_changed`, `file_uploaded`, `task_review_event` - `summaryKey` (string) **(required)**: - `createdAt` (string) **(required)**: - `deepLink` (string) **(required)**: - `nextCursor` (string,null) **(required)**: ### 400: Invalid cursor or query ### 401: Unauthorized ### 403: Only clinics can list clinic activity ## Example ```bash curl -X GET "https://api-stage.guidelab.co/dashboard/clinic/activity" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Bootstrap all lab dashboard panels in one call `GET https://api-stage.guidelab.co/dashboard/overview` Aggregates /dashboard/stats, /dashboard/today, /dashboard/trends, and /dashboard/operations into a single parallel request. Defaults: today's date, revenue metric, 30-day trends, all deadlines, page 1, limit 10. Documentation: https://docs.guidelab.co/api-reference/dashboard/getLabDashboardOverview ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Combined stats, today, trends, and operations payload - `stats` (object) **(required)**: - `monthly` (object) **(required)**: - `totalOrders` (number) **(required)**: - `completedOrders` (number) **(required)**: - `pendingOrders` (number) **(required)**: - `currency` (string) **(required)**: Currency scope of the legacy monetary fields; order counts include every currency. Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `revenue` (number) **(required)**: Compatibility projection of revenueExact for the lab currency. - `revenueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `avgOrderValue` (number) **(required)**: Compatibility projection of avgOrderValueExact for the lab currency. - `avgOrderValueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `currencyTotals` (object[]) **(required)**: - `currency` (string) **(required)**: Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `totalOrders` (number) **(required)**: - `completedOrders` (number) **(required)**: - `pendingOrders` (number) **(required)**: - `revenueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `previousRevenueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `avgOrderValueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `trends` (object) **(required)**: - `orders` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `completed` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `revenue` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `pending` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `trends` (object) **(required)**: - `orders` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `completed` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `revenue` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `pending` (object) **(required)**: - `change` (string) **(required)**: - `type` (string) **(required)**: Values: `increase`, `decrease`, `neutral` - `deadlines` (object) **(required)**: - `overdue` (number) **(required)**: - `today` (number) **(required)**: - `tomorrow` (number) **(required)**: - `thisWeek` (number) **(required)**: - `today` (object) **(required)**: - `date` (string) **(required)**: - `metric` (string) **(required)**: Values: `orders`, `revenue` - `currency` (string,null) **(required)**: Currency of the numeric compatibility projection; null for the orders metric. Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR`, `null` - `dataPoints` (object[]) **(required)**: - `hour` (number) **(required)**: - `value` (number) **(required)**: - `cumulative` (number) **(required)**: - `valueExact` (string,null) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `cumulativeExact` (string,null) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `currencySeries` (object[]) **(required)**: - `currency` (string) **(required)**: Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `dataPoints` (object[]) **(required)**: - `hour` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `cumulativeExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `summary` (object) **(required)**: - `currentValueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `currentTime` (string) **(required)**: - `projectedEndOfDayExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `summary` (object) **(required)**: - `currentValue` (number) **(required)**: - `currentValueExact` (string,null) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `currentTime` (string) **(required)**: - `projectedEndOfDay` (number) **(required)**: - `projectedEndOfDayExact` (string,null) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `trends` (object) **(required)**: - `dateRange` (object) **(required)**: - `start` (string) **(required)**: - `end` (string) **(required)**: - `currency` (string) **(required)**: Currency scope of the legacy monetary fields; order counts include every currency. Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `series` (object) **(required)**: - `submitted` (object[]) **(required)**: - `date` (string) **(required)**: - `count` (number) **(required)**: - `value` (number) **(required)**: Compatibility projection of valueExact for the lab currency. - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `completed` (object[]) **(required)**: - `date` (string) **(required)**: - `count` (number) **(required)**: - `value` (number) **(required)**: Compatibility projection of valueExact for the lab currency. - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `currencySeries` (object[]) **(required)**: - `currency` (string) **(required)**: Values: `GBP`, `EUR`, `USD`, `CAD`, `AUD`, `NZD`, `CHF`, `SEK`, `NOK`, `DKK`, `PLN`, `CZK`, `HUF`, `RON`, `INR`, `JPY`, `CNY`, `SGD`, `HKD`, `MXN`, `BRL`, `ZAR` - `series` (object) **(required)**: - `submitted` (object[]) **(required)**: - `date` (string) **(required)**: - `count` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `completed` (object[]) **(required)**: - `date` (string) **(required)**: - `count` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `totals` (object) **(required)**: - `submitted` (object) **(required)**: - `count` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `completed` (object) **(required)**: - `count` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `totals` (object) **(required)**: - `submitted` (object) **(required)**: - `count` (number) **(required)**: - `value` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `completed` (object) **(required)**: - `count` (number) **(required)**: - `value` (number) **(required)**: - `valueExact` (string) **(required)**: Exact decimal amount in major currency units. This string is authoritative; numeric money fields are compatibility projections. (example: `1234.56`) - `operations` (object): ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/dashboard/overview" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List time-off entries `GET https://api-stage.guidelab.co/calendar/time-off` Returns paginated time-off and bank holiday entries for the authenticated lab. Optionally includes inactive entries. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/calendar/listCalendarTimeOff ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` () (in: query): Default: `false` - `page` (number) (in: query): Default: `1` - `limit` (number) (in: query): Default: `50` ## Responses ### 200: Paginated list of time-off entries - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `startDate` (string) **(required)**: - `endDate` (string) **(required)**: - `isRecurringAnnually` (boolean) **(required)**: - `isBankHoliday` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/calendar/time-off" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a time-off entry `POST https://api-stage.guidelab.co/calendar/time-off` Creates a new time-off or bank holiday entry for the authenticated lab. Validates that the start date is before or equal to the end date. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/calendar/createCalendarTimeOff ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `startDate` (string) **(required)**: - `endDate` (string) **(required)**: - `isRecurringAnnually` (boolean): (default: `false`) - `isBankHoliday` (boolean): (default: `false`) - `isActive` (boolean): (default: `true`) - `sortOrder` (integer): (default: `0`) ## Responses ### 201: Time-off entry created successfully - `entry` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `startDate` (string) **(required)**: - `endDate` (string) **(required)**: - `isRecurringAnnually` (boolean) **(required)**: - `isBankHoliday` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/calendar/time-off" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "startDate": "string", "endDate": "string" }' ``` --- # Get a time-off entry by ID `GET https://api-stage.guidelab.co/calendar/time-off/{id}` Returns a single time-off entry by ID, scoped to the authenticated lab. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/calendar/getCalendarTimeOff ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Time-off entry ID ## Responses ### 200: Time-off entry details - `entry` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `startDate` (string) **(required)**: - `endDate` (string) **(required)**: - `isRecurringAnnually` (boolean) **(required)**: - `isBankHoliday` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — valid session required ### 404: Time-off entry not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/calendar/time-off/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Deactivate a time-off entry `DELETE https://api-stage.guidelab.co/calendar/time-off/{id}` Soft-deletes a time-off entry by setting it to inactive. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/calendar/deleteCalendarTimeOff ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Time-off entry ID ## Responses ### 200: Time-off entry deactivated successfully - `entry` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `isActive` (boolean) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `message` (string) **(required)**: ### 401: Unauthorized — valid session required ### 404: Time-off entry not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/calendar/time-off/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a time-off entry `PUT https://api-stage.guidelab.co/calendar/time-off/{id}` Updates an existing time-off entry by ID. Validates date ordering. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/calendar/updateCalendarTimeOff ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Time-off entry ID ## Request Body Content-Type: `application/json` - `name` (string): - `startDate` (string): - `endDate` (string): - `isRecurringAnnually` (boolean): - `isBankHoliday` (boolean): - `isActive` (boolean): - `sortOrder` (integer): ## Responses ### 200: Time-off entry updated successfully - `entry` (object) **(required)**: - `id` (string) **(required)**: - `name` (string) **(required)**: - `startDate` (string) **(required)**: - `endDate` (string) **(required)**: - `isRecurringAnnually` (boolean) **(required)**: - `isBankHoliday` (boolean) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — valid session required ### 404: Time-off entry not found ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/calendar/time-off/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Seed UK bank holidays `POST https://api-stage.guidelab.co/calendar/time-off/seed-holidays` Populates the lab's calendar with default UK bank holidays. Only seeds if the lab has no existing calendar entries. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/calendar/seedCalendarHolidays ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 201: Bank holidays seeded successfully - `message` (string) **(required)**: - `seeded` (boolean) **(required)**: - `count` (number) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/calendar/time-off/seed-holidays" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get organization working days `GET https://api-stage.guidelab.co/calendar/working-days` Returns the persisted working calendar for the authenticated organization or an explicitly selected active partner lab. Documentation: https://docs.guidelab.co/api-reference/calendar/getWorkingDays ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `labId` (string) (in: query): ## Responses ### 200: Array of working day numbers - `workingDays` (integer[]) **(required)**: - `timezone` (string) **(required)**: - `closures` (object[]) **(required)**: - `startDate` (string) **(required)**: - `endDate` (string) **(required)**: - `isRecurringAnnually` (boolean) **(required)**: ### 400: Requested organization is not a lab ### 401: Unauthorized — valid session required ### 403: The requested lab is not an active partner ### 404: Organization not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/calendar/working-days" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update organization working days `PUT https://api-stage.guidelab.co/calendar/working-days` Sets which days of the week (0=Sunday through 6=Saturday) the lab operates. At least one day must be selected. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/calendar/updateWorkingDays ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `workingDays` (integer[]) **(required)**: ## Responses ### 200: Working days updated successfully - `workingDays` (number[]) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/calendar/working-days" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "workingDays": [ 0 ] }' ``` --- # List reports `GET https://api-stage.guidelab.co/reports` Returns the persisted built-in and custom report definitions for the authenticated lab. Documentation: https://docs.guidelab.co/api-reference/reports/listReports ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `type` (string) (in: query): Values: `built_in`, `custom` ## Responses ### 200: List of report definitions Array of: - `id` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `icon` (string) **(required)**: - `type` (string) **(required)**: Values: `built_in`, `custom` - `templateSlug` (string,null) **(required)**: - `isPinned` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/reports" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a custom report `POST https://api-stage.guidelab.co/reports` Creates a custom report after validating every versioned field and operator against its code-owned data-source adapter. Lab owner/admin only. Documentation: https://docs.guidelab.co/api-reference/reports/createReport ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `description` (string): - `icon` (string): - `config` (object) **(required)**: - `definitionVersion` (string): (default: `v1`) Values: `v1` - `dataSource` (string) **(required)**: Values: `orders`, `order_items`, `clients`, `products` - `columns` (object[]) **(required)**: - `fieldKey` (string) **(required)**: - `label` (string): - `aggregation` (string): Values: `sum`, `count`, `avg`, `min`, `max` - `format` (string): - `width` (number): - `filters` (object[]): (default: ``) - `fieldKey` (string) **(required)**: - `operator` (string) **(required)**: Values: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains`, `not_contains`, `in`, `not_in`, `between`, `is_null`, `is_not_null` - `value` (object): - `groupBy` (string[]): (default: ``) - `sortBy` (object[]): (default: ``) - `fieldKey` (string) **(required)**: - `direction` (string) **(required)**: Values: `asc`, `desc` - `dateRange` (object): - `fieldKey` (string) **(required)**: - `preset` (string): Values: `today`, `yesterday`, `this_week`, `last_week`, `this_month`, `last_month`, `last_30_days`, `last_90_days`, `this_quarter`, `last_quarter`, `this_year`, `last_year`, `all_time` - `startDate` (string): - `endDate` (string): - `chart` (object): - `type` (string) **(required)**: Values: `bar`, `line`, `area`, `pie`, `donut` - `xAxisField` (string) **(required)**: - `yAxisFields` (string[]) **(required)**: - `enabled` (boolean) **(required)**: - `pageSize` (integer): - `isPinned` (boolean): ## Responses ### 201: Custom report created successfully - `id` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `icon` (string) **(required)**: - `type` (string) **(required)**: Values: `built_in`, `custom` - `templateSlug` (string,null) **(required)**: - `isPinned` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: ### 400: Invalid report configuration ### 401: Unauthorized — valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/reports" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "icon": "string", "config": { "dataSource": "orders", "columns": [ { "fieldKey": "string", "label": "string", "aggregation": "sum", "format": "string", "width": 0 } ] }, "isPinned": true }' ``` --- # List available report data sources `GET https://api-stage.guidelab.co/reports/data-sources` Returns the serializable field, type, aggregation, sort, and filter allowlists for all four code-owned report adapters. Documentation: https://docs.guidelab.co/api-reference/reports/listReportDataSources ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Versioned data-source definitions - `orders` (object) **(required)**: - `definitionVersion` (string) **(required)**: Values: `v1` - `key` (string) **(required)**: Values: `orders`, `order_items`, `clients`, `products` - `label` (string) **(required)**: - `description` (string) **(required)**: - `fields` (object[]) **(required)**: - `key` (string) **(required)**: - `label` (string) **(required)**: - `type` (string) **(required)**: Values: `string`, `number`, `date`, `boolean`, `currency` - `groupable` (boolean) **(required)**: - `sortable` (boolean) **(required)**: - `aggregations` (string[]): - `filterOperators` (string[]) **(required)**: - `enumValues` (object[]): - `value` (string) **(required)**: - `label` (string) **(required)**: - `description` (string): - `defaultDateField` (string) **(required)**: - `order_items` (object) **(required)**: - `definitionVersion` (string) **(required)**: Values: `v1` - `key` (string) **(required)**: Values: `orders`, `order_items`, `clients`, `products` - `label` (string) **(required)**: - `description` (string) **(required)**: - `fields` (object[]) **(required)**: - `key` (string) **(required)**: - `label` (string) **(required)**: - `type` (string) **(required)**: Values: `string`, `number`, `date`, `boolean`, `currency` - `groupable` (boolean) **(required)**: - `sortable` (boolean) **(required)**: - `aggregations` (string[]): - `filterOperators` (string[]) **(required)**: - `enumValues` (object[]): - `value` (string) **(required)**: - `label` (string) **(required)**: - `description` (string): - `defaultDateField` (string) **(required)**: - `clients` (object) **(required)**: - `definitionVersion` (string) **(required)**: Values: `v1` - `key` (string) **(required)**: Values: `orders`, `order_items`, `clients`, `products` - `label` (string) **(required)**: - `description` (string) **(required)**: - `fields` (object[]) **(required)**: - `key` (string) **(required)**: - `label` (string) **(required)**: - `type` (string) **(required)**: Values: `string`, `number`, `date`, `boolean`, `currency` - `groupable` (boolean) **(required)**: - `sortable` (boolean) **(required)**: - `aggregations` (string[]): - `filterOperators` (string[]) **(required)**: - `enumValues` (object[]): - `value` (string) **(required)**: - `label` (string) **(required)**: - `description` (string): - `defaultDateField` (string) **(required)**: - `products` (object) **(required)**: - `definitionVersion` (string) **(required)**: Values: `v1` - `key` (string) **(required)**: Values: `orders`, `order_items`, `clients`, `products` - `label` (string) **(required)**: - `description` (string) **(required)**: - `fields` (object[]) **(required)**: - `key` (string) **(required)**: - `label` (string) **(required)**: - `type` (string) **(required)**: Values: `string`, `number`, `date`, `boolean`, `currency` - `groupable` (boolean) **(required)**: - `sortable` (boolean) **(required)**: - `aggregations` (string[]): - `filterOperators` (string[]) **(required)**: - `enumValues` (object[]): - `value` (string) **(required)**: - `label` (string) **(required)**: - `description` (string): - `defaultDateField` (string) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/reports/data-sources" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get a report by ID `GET https://api-stage.guidelab.co/reports/{id}` Returns one tenant-scoped report. Built-in slugs are expanded into their explicit adapter-backed configuration. Documentation: https://docs.guidelab.co/api-reference/reports/getReport ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Report details with executable configuration - `id` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `icon` (string) **(required)**: - `type` (string) **(required)**: Values: `built_in`, `custom` - `templateSlug` (string,null) **(required)**: - `isPinned` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `config` (object) **(required)**: - `definitionVersion` (string): (default: `v1`) Values: `v1` - `dataSource` (string) **(required)**: Values: `orders`, `order_items`, `clients`, `products` - `columns` (object[]) **(required)**: - `fieldKey` (string) **(required)**: - `label` (string): - `aggregation` (string): Values: `sum`, `count`, `avg`, `min`, `max` - `format` (string): - `width` (number): - `filters` (object[]): (default: ``) - `fieldKey` (string) **(required)**: - `operator` (string) **(required)**: Values: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains`, `not_contains`, `in`, `not_in`, `between`, `is_null`, `is_not_null` - `value` (object): - `groupBy` (string[]): (default: ``) - `sortBy` (object[]): (default: ``) - `fieldKey` (string) **(required)**: - `direction` (string) **(required)**: Values: `asc`, `desc` - `dateRange` (object): - `fieldKey` (string) **(required)**: - `preset` (string): Values: `today`, `yesterday`, `this_week`, `last_week`, `this_month`, `last_month`, `last_30_days`, `last_90_days`, `this_quarter`, `last_quarter`, `this_year`, `last_year`, `all_time` - `startDate` (string): - `endDate` (string): - `chart` (object): - `type` (string) **(required)**: Values: `bar`, `line`, `area`, `pie`, `donut` - `xAxisField` (string) **(required)**: - `yAxisFields` (string[]) **(required)**: - `enabled` (boolean) **(required)**: - `pageSize` (integer): - `createdBy` (string,null) **(required)**: - `updatedAt` (string) **(required)**: ### 401: Unauthorized — valid session required ### 404: Report not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/reports/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a report `PATCH https://api-stage.guidelab.co/reports/{id}` Updates a tenant-scoped report. Built-in query definitions cannot be replaced. Lab owner/admin only. Documentation: https://docs.guidelab.co/api-reference/reports/updateReport ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `name` (string): - `description` (string): - `icon` (string): - `config` (object): - `definitionVersion` (string): (default: `v1`) Values: `v1` - `dataSource` (string) **(required)**: Values: `orders`, `order_items`, `clients`, `products` - `columns` (object[]) **(required)**: - `fieldKey` (string) **(required)**: - `label` (string): - `aggregation` (string): Values: `sum`, `count`, `avg`, `min`, `max` - `format` (string): - `width` (number): - `filters` (object[]): (default: ``) - `fieldKey` (string) **(required)**: - `operator` (string) **(required)**: Values: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains`, `not_contains`, `in`, `not_in`, `between`, `is_null`, `is_not_null` - `value` (object): - `groupBy` (string[]): (default: ``) - `sortBy` (object[]): (default: ``) - `fieldKey` (string) **(required)**: - `direction` (string) **(required)**: Values: `asc`, `desc` - `dateRange` (object): - `fieldKey` (string) **(required)**: - `preset` (string): Values: `today`, `yesterday`, `this_week`, `last_week`, `this_month`, `last_month`, `last_30_days`, `last_90_days`, `this_quarter`, `last_quarter`, `this_year`, `last_year`, `all_time` - `startDate` (string): - `endDate` (string): - `chart` (object): - `type` (string) **(required)**: Values: `bar`, `line`, `area`, `pie`, `donut` - `xAxisField` (string) **(required)**: - `yAxisFields` (string[]) **(required)**: - `enabled` (boolean) **(required)**: - `pageSize` (integer): - `isPinned` (boolean): - `sortOrder` (integer): ## Responses ### 200: Report updated successfully - `success` (boolean) **(required)**: ### 400: Invalid report configuration ### 401: Unauthorized — valid session required ### 403: Built-in query definitions are immutable ### 404: Report not found ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/reports/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "icon": "string", "config": { "dataSource": "orders", "columns": [ { "fieldKey": "string", "label": "string", "aggregation": "sum", "format": "string", "width": 0 } ] }, "isPinned": true, "sortOrder": 0 }' ``` --- # Delete a custom report `DELETE https://api-stage.guidelab.co/reports/{id}` Permanently deletes a custom report. Built-in reports cannot be deleted. Lab owner/admin only. Documentation: https://docs.guidelab.co/api-reference/reports/deleteReport ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Report deleted successfully - `success` (boolean) **(required)**: ### 401: Unauthorized — valid session required ### 403: Cannot delete built-in reports ### 404: Report not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/reports/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Execute a report query `POST https://api-stage.guidelab.co/reports/{id}/execute` Runs one adapter-backed, tenant-scoped report query with bounded fields, filters, sorts, pagination, and database time. Documentation: https://docs.guidelab.co/api-reference/reports/executeReport ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `page` (integer): (default: `1`) - `limit` (integer): (default: `50`) - `dateRange` (object): - `fieldKey` (string) **(required)**: - `preset` (string): Values: `today`, `yesterday`, `this_week`, `last_week`, `this_month`, `last_month`, `last_30_days`, `last_90_days`, `this_quarter`, `last_quarter`, `this_year`, `last_year`, `all_time` - `startDate` (string): - `endDate` (string): - `sortBy` (object[]): - `fieldKey` (string) **(required)**: - `direction` (string) **(required)**: Values: `asc`, `desc` - `additionalFilters` (object[]): - `fieldKey` (string) **(required)**: - `operator` (string) **(required)**: Values: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains`, `not_contains`, `in`, `not_in`, `between`, `is_null`, `is_not_null` - `value` (object): ## Responses ### 200: Paginated report execution results - `data` (object[]) **(required)**: - `columns` (object[]) **(required)**: - `key` (string) **(required)**: - `label` (string) **(required)**: - `type` (string) **(required)**: Values: `string`, `number`, `date`, `boolean`, `currency` - `format` (string): - `aggregation` (string): Values: `sum`, `count`, `avg`, `min`, `max` - `pagination` (object) **(required)**: - `page` (integer) **(required)**: - `limit` (integer) **(required)**: - `total` (integer) **(required)**: - `totalPages` (integer) **(required)**: ### 400: Invalid report configuration ### 401: Unauthorized — valid session required ### 404: Report not found ### 408: Report query exceeded its time limit ## Example ```bash curl -X POST "https://api-stage.guidelab.co/reports/{id}/execute" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "page": 0, "limit": 0, "dateRange": { "fieldKey": "string", "preset": "today", "startDate": "string", "endDate": "string" }, "sortBy": [ { "fieldKey": "string", "direction": "asc" } ], "additionalFilters": [ { "fieldKey": "string", "operator": "eq", "value": "string" } ] }' ``` --- # Export a report as CSV `POST https://api-stage.guidelab.co/reports/{id}/export` Executes one tenant-scoped report query and returns a synchronous CSV under fixed request, row, byte, time, and query-fan-out ceilings. Documentation: https://docs.guidelab.co/api-reference/reports/exportReport ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `dateRange` (object): - `fieldKey` (string) **(required)**: - `preset` (string): Values: `today`, `yesterday`, `this_week`, `last_week`, `this_month`, `last_month`, `last_30_days`, `last_90_days`, `this_quarter`, `last_quarter`, `this_year`, `last_year`, `all_time` - `startDate` (string): - `endDate` (string): - `sortBy` (object[]): - `fieldKey` (string) **(required)**: - `direction` (string) **(required)**: Values: `asc`, `desc` - `additionalFilters` (object[]): - `fieldKey` (string) **(required)**: - `operator` (string) **(required)**: Values: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains`, `not_contains`, `in`, `not_in`, `between`, `is_null`, `is_not_null` - `value` (object): - `format` (string): (default: `csv`) Values: `csv` ## Responses ### 200: Bounded CSV file download ### 400: Invalid report configuration ### 401: Unauthorized — valid session required ### 404: Report not found ### 408: Report export exceeded its time limit ### 413: Report export exceeded its row or byte limit ### 429: Report export request budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/reports/{id}/export" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "dateRange": { "fieldKey": "string", "preset": "today", "startDate": "string", "endDate": "string" }, "sortBy": [ { "fieldKey": "string", "direction": "asc" } ], "additionalFilters": [ { "fieldKey": "string", "operator": "eq", "value": "string" } ], "format": "csv" }' ``` --- # Export balance list as CSV `POST https://api-stage.guidelab.co/export/balance-list` Exports invoice/balance data for the lab's clients as a CSV file. Caller specifies which fields to include. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/export/exportBalanceList ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `fields` (string[]) **(required)**: ## Responses ### 200: CSV file download with balance list data ### 401: Unauthorized — valid session required ### 429: CSV export budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/export/balance-list" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "fields": [ "string" ] }' ``` --- # Export clients as CSV `POST https://api-stage.guidelab.co/export/clients` Exports partner clinic data including contact info, price list, and practice group as a CSV file. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/export/exportClients ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `fields` (string[]) **(required)**: ## Responses ### 200: CSV file download with client data ### 401: Unauthorized — valid session required ### 429: CSV export budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/export/clients" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "fields": [ "string" ] }' ``` --- # Export price lists as CSV `POST https://api-stage.guidelab.co/export/price-lists` Exports versioned product pricing rules with their stable book and publication metadata. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/export/exportPriceLists ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `fields` (string[]) **(required)**: ## Responses ### 200: CSV file download with price list data ### 401: Unauthorized — valid session required ### 413: CSV export lookup limit exceeded ### 429: CSV export budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/export/price-lists" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "fields": [ "string" ] }' ``` --- # Export products as CSV `POST https://api-stage.guidelab.co/export/products` Exports the lab's product catalog including categories, subcategories, standards, and pricing as a CSV file. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/export/exportProducts ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `fields` (string[]) **(required)**: ## Responses ### 200: CSV file download with product data ### 401: Unauthorized — valid session required ### 413: CSV export lookup limit exceeded ### 429: CSV export budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/export/products" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "fields": [ "string" ] }' ``` --- # Import balance list from CSV data `POST https://api-stage.guidelab.co/import/balance-list` Imports non-negative opening balances as new invoices. Preserves a supplied invoice number when it is unused and rejects existing invoice numbers rather than mutating issued documents. Optionally saves the column mapping for reuse. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/import/importBalanceList ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `mappings` (object[]) **(required)**: - `sourceColumn` (string) **(required)**: - `targetField` (string) **(required)**: - `confidence` (number): - `rows` (object[]) **(required)**: - `skipErrors` (boolean): (default: `false`) - `saveMappingName` (string): ## Responses ### 200: Import results with success/error counts and created/updated IDs - `success` (boolean) **(required)**: - `totalRows` (number) **(required)**: - `successCount` (number) **(required)**: - `errorCount` (number) **(required)**: - `errors` (object[]) **(required)**: - `row` (number) **(required)**: - `message` (string) **(required)**: - `createdIds` (string[]) **(required)**: - `updatedIds` (string[]) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/import/balance-list" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "mappings": [ { "sourceColumn": "string", "targetField": "string", "confidence": 0 } ], "rows": [ {} ], "skipErrors": true, "saveMappingName": "string" }' ``` --- # Import clients from CSV data `POST https://api-stage.guidelab.co/import/clients` Imports clinic/client data from mapped CSV rows. Creates new clinic organizations and partnerships, or identifies existing ones. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/import/importClients ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `mappings` (object[]) **(required)**: - `sourceColumn` (string) **(required)**: - `targetField` (string) **(required)**: - `confidence` (number): - `rows` (object[]) **(required)**: - `skipErrors` (boolean): (default: `false`) - `saveMappingName` (string): ## Responses ### 200: Import results with success/error counts and created/updated IDs - `success` (boolean) **(required)**: - `totalRows` (number) **(required)**: - `successCount` (number) **(required)**: - `errorCount` (number) **(required)**: - `errors` (object[]) **(required)**: - `row` (number) **(required)**: - `message` (string) **(required)**: - `createdIds` (string[]) **(required)**: - `updatedIds` (string[]) **(required)**: ### 401: Unauthorized — valid session required ### 409: Client relationships changed during the import ## Example ```bash curl -X POST "https://api-stage.guidelab.co/import/clients" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "mappings": [ { "sourceColumn": "string", "targetField": "string", "confidence": 0 } ], "rows": [ {} ], "skipErrors": true, "saveMappingName": "string" }' ``` --- # Import products from CSV data `POST https://api-stage.guidelab.co/import/products` Imports product data from mapped CSV rows. Creates new products or updates existing ones matched by SKU. Auto-creates categories and subcategories as needed. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/import/importProducts ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `mappings` (object[]) **(required)**: - `sourceColumn` (string) **(required)**: - `targetField` (string) **(required)**: - `confidence` (number): - `rows` (object[]) **(required)**: - `skipErrors` (boolean): (default: `false`) - `saveMappingName` (string): ## Responses ### 200: Import results with success/error counts and created/updated IDs - `success` (boolean) **(required)**: - `totalRows` (number) **(required)**: - `successCount` (number) **(required)**: - `errorCount` (number) **(required)**: - `errors` (object[]) **(required)**: - `row` (number) **(required)**: - `message` (string) **(required)**: - `createdIds` (string[]) **(required)**: - `updatedIds` (string[]) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/import/products" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "mappings": [ { "sourceColumn": "string", "targetField": "string", "confidence": 0 } ], "rows": [ {} ], "skipErrors": true, "saveMappingName": "string" }' ``` --- # Import price list items from CSV data `POST https://api-stage.guidelab.co/import/price-lists` Imports price list items from mapped CSV rows. Supports single or multiple price list mode. Matches products by SKU or name. Auto-creates price lists in multiple mode. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/import/importPriceLists ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `mappings` (object[]) **(required)**: - `sourceColumn` (string) **(required)**: - `targetField` (string) **(required)**: - `confidence` (number): - `rows` (object[]) **(required)**: - `priceListId` (string): - `mode` (string): (default: `single`) Values: `single`, `multiple` - `skipErrors` (boolean): (default: `false`) - `saveMappingName` (string): ## Responses ### 200: Import results with success/error counts and created/updated IDs - `success` (boolean) **(required)**: - `totalRows` (number) **(required)**: - `successCount` (number) **(required)**: - `errorCount` (number) **(required)**: - `errors` (object[]) **(required)**: - `row` (number) **(required)**: - `message` (string) **(required)**: - `createdIds` (string[]) **(required)**: - `updatedIds` (string[]) **(required)**: ### 401: Unauthorized — valid session required ### 409: Price-list draft changed during import ## Example ```bash curl -X POST "https://api-stage.guidelab.co/import/price-lists" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "mappings": [ { "sourceColumn": "string", "targetField": "string", "confidence": 0 } ], "rows": [ {} ], "priceListId": "string", "mode": "single", "skipErrors": true, "saveMappingName": "string" }' ``` --- # List saved import mappings `GET https://api-stage.guidelab.co/import/mappings` Returns saved column mapping templates for the lab. Optionally filter by import type (products, clients, price_lists, balance_list). Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/import/listImportMappings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of saved import mappings - `mappings` (array) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/import/mappings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Save an import mapping template `POST https://api-stage.guidelab.co/import/mappings` Saves a reusable column mapping template for future imports. Can be set as the default mapping for its import type. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/import/createImportMapping ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `importType` (string) **(required)**: Values: `products`, `clients`, `price_lists`, `balance_list` - `name` (string) **(required)**: - `mappings` (object[]) **(required)**: - `sourceColumn` (string) **(required)**: - `targetField` (string) **(required)**: - `confidence` (number): - `isDefault` (boolean): (default: `false`) ## Responses ### 201: Import mapping created successfully - `mapping` (object): ### 401: Unauthorized — valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/import/mappings" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "importType": "products", "name": "string", "mappings": [ { "sourceColumn": "string", "targetField": "string", "confidence": 0 } ], "isDefault": true }' ``` --- # Delete an import mapping template `DELETE https://api-stage.guidelab.co/import/mappings` Permanently deletes a saved import mapping template by ID (passed as query parameter). Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/import/deleteImportMapping ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Import mapping deleted successfully - `success` (boolean) **(required)**: ### 401: Unauthorized — valid session required ### 404: Mapping not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/import/mappings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Validate import data before importing `POST https://api-stage.guidelab.co/import/validate` Dry-run validation of mapped CSV rows for a given import type. Returns per-row validation results and a summary of valid/invalid counts without persisting anything. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/import/validateImportData ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `importType` (string) **(required)**: Values: `products`, `clients`, `price_lists`, `balance_list` - `mappings` (object[]) **(required)**: - `sourceColumn` (string) **(required)**: - `targetField` (string) **(required)**: - `confidence` (number): - `rows` (object[]) **(required)**: - `mode` (string): Values: `single`, `multiple` - `priceListId` (string): ## Responses ### 200: Validation results with per-row errors and summary - `rowResults` (object[]) **(required)**: - `rowIndex` (number) **(required)**: - `isValid` (boolean) **(required)**: - `errors` (object[]) **(required)**: - `field` (string) **(required)**: - `message` (string) **(required)**: - `data` (object): - `summary` (object) **(required)**: - `total` (number) **(required)**: - `valid` (number) **(required)**: - `invalid` (number) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X POST "https://api-stage.guidelab.co/import/validate" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "importType": "products", "mappings": [ { "sourceColumn": "string", "targetField": "string", "confidence": 0 } ], "rows": [ {} ], "mode": "single", "priceListId": "string" }' ``` --- # Export selected domains as a re-importable zip bundle `POST https://api-stage.guidelab.co/data-bundle/export` Streams a versioned zip containing the selected configuration domains (data files + binary assets + manifest). Lab owners only. Documentation: https://docs.guidelab.co/api-reference/data-bundle/exportDataBundle ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `domains` (string[]) **(required)**: - `includeFinanceTransactions` (boolean): (default: `false`) ## Responses ### 200: Zip bundle download ### 400: Invalid request ### 401: Unauthorized — valid session required ### 403: Lab owners only ### 429: Export budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/data-bundle/export" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "domains": [ "products" ], "includeFinanceTransactions": true }' ``` --- # Get a presigned PUT URL for uploading a bundle zip `POST https://api-stage.guidelab.co/data-bundle/import/presign` Returns a presigned R2 upload URL for a bundle zip (max 250MB). The returned durable session ID is passed to analyze/execute; the storage key remains server-controlled. Lab owners only. Documentation: https://docs.guidelab.co/api-reference/data-bundle/presignDataBundleUpload ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `fileName` (string) **(required)**: - `size` (integer) **(required)**: ## Responses ### 200: Presigned upload URL - `uploadUrl` (string) **(required)**: - `sessionId` (string) **(required)**: - `uploadContentType` (string) **(required)**: ### 400: Invalid request ### 401: Unauthorized — valid session required ### 403: Lab owners only ### 429: Upload issuance budget exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/data-bundle/import/presign" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "fileName": "string", "size": 0 }' ``` --- # Dry-run an uploaded bundle against the current organization `POST https://api-stage.guidelab.co/data-bundle/import/analyze` Parses the uploaded bundle and returns per-table created/updated/skipped counts plus warnings, without writing anything. Lab owners only. Documentation: https://docs.guidelab.co/api-reference/data-bundle/analyzeDataBundle ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `sessionId` (string) **(required)**: ## Responses ### 200: Dry-run result - `manifest` (object) **(required)**: - `formatVersion` (integer) **(required)**: - `bundleId` (string) **(required)**: - `exportedAt` (string) **(required)**: - `source` (object) **(required)**: - `orgId` (string) **(required)**: - `orgName` (string) **(required)**: - `orgType` (string) **(required)**: - `orgSlug` (string,null): - `host` (string): - `domains` (string[]) **(required)**: - `sameOrg` (boolean) **(required)**: - `crossEnv` (boolean) **(required)**: - `tables` (object[]) **(required)**: - `name` (string) **(required)**: - `domain` (string) **(required)**: Values: `products`, `production`, `templates`, `lab_settings`, `clients`, `finance`, `users` - `importable` (boolean) **(required)**: - `rowsInBundle` (integer) **(required)**: - `toCreate` (integer) **(required)**: - `toUpdate` (integer) **(required)**: - `toSkip` (integer) **(required)**: - `warnings` (object[]) **(required)**: - `code` (string) **(required)**: Values: `member_not_found`, `fk_missing`, `env_specific_stripped`, `columns_drift`, `export_only_table`, `json_id_dropped`, `ambiguous_match`, `tray_code_missing`, `row_invalid`, `asset_missing` - `message` (string) **(required)**: - `table` (string): - `count` (integer): - `sample` (string[]): - `assets` (object) **(required)**: - `count` (integer) **(required)**: - `totalBytes` (integer) **(required)**: - `blockers` (object[]) **(required)**: - `code` (string) **(required)**: Values: `format_version_unsupported`, `wrong_org_type`, `manifest_invalid`, `bundle_too_large`, `target_table_too_large`, `import_in_progress`, `category_cycle`, `target_organization_missing`, `catalog_money_invalid` - `message` (string) **(required)**: ### 400: Invalid request ### 401: Unauthorized — valid session required ### 403: Lab owners only ### 404: Uploaded bundle not found ### 409: Import session is terminal or already in use ## Example ```bash curl -X POST "https://api-stage.guidelab.co/data-bundle/import/analyze" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "sessionId": "string" }' ``` --- # Import an uploaded bundle into the current organization `POST https://api-stage.guidelab.co/data-bundle/import/execute` Re-plans the uploaded bundle and applies it: all ids are regenerated, references remapped, assets copied. One import at a time per organization. Lab owners only. Documentation: https://docs.guidelab.co/api-reference/data-bundle/executeDataBundleImport ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `sessionId` (string) **(required)**: - `domains` (string[]): - `conflictStrategy` (string): (default: `update`) Values: `update`, `skip` ## Responses ### 200: Import result - `success` (boolean) **(required)**: - `importLogId` (string): - `tables` (object[]) **(required)**: - `name` (string) **(required)**: - `domain` (string) **(required)**: Values: `products`, `production`, `templates`, `lab_settings`, `clients`, `finance`, `users` - `created` (integer) **(required)**: - `updated` (integer) **(required)**: - `skipped` (integer) **(required)**: - `warnings` (object[]) **(required)**: - `code` (string) **(required)**: Values: `member_not_found`, `fk_missing`, `env_specific_stripped`, `columns_drift`, `export_only_table`, `json_id_dropped`, `ambiguous_match`, `tray_code_missing`, `row_invalid`, `asset_missing` - `message` (string) **(required)**: - `table` (string): - `count` (integer): - `sample` (string[]): - `totals` (object) **(required)**: - `created` (integer) **(required)**: - `updated` (integer) **(required)**: - `skipped` (integer) **(required)**: - `warnings` (object[]) **(required)**: - `code` (string) **(required)**: Values: `member_not_found`, `fk_missing`, `env_specific_stripped`, `columns_drift`, `export_only_table`, `json_id_dropped`, `ambiguous_match`, `tray_code_missing`, `row_invalid`, `asset_missing` - `message` (string) **(required)**: - `table` (string): - `count` (integer): - `sample` (string[]): - `assetsCopied` (integer) **(required)**: ### 400: Invalid request or bundle has blockers ### 401: Unauthorized — valid session required ### 403: Lab owners only ### 404: Uploaded bundle not found ### 409: Another import is already running ## Example ```bash curl -X POST "https://api-stage.guidelab.co/data-bundle/import/execute" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "sessionId": "string", "domains": [ "products" ], "conflictStrategy": "update" }' ``` --- # Generate an AI message for a conversation `POST https://api-stage.guidelab.co/ai/generate` Uses GPT-4o-mini to generate a contextually appropriate message for a conversation after explicit data-processing consent. Returns a Server-Sent Events stream. Rate limited to 10 requests per minute per user. Documentation: https://docs.guidelab.co/api-reference/ai/generateAiMessage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `conversationId` (string) **(required)**: - `dataProcessingConsent` (boolean) **(required)**: Values: `true` - `instruction` (string): ## Responses ### 200: SSE stream of generated message tokens ### 401: Unauthorized — valid session required ### 409: Conversation deletion has been authorized ### 413: AI prompt input limit exceeded ### 429: Global, organization, or user AI usage limit exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/ai/generate" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "conversationId": "string", "dataProcessingConsent": true, "instruction": "string" }' ``` --- # Autocomplete a partially typed message `POST https://api-stage.guidelab.co/ai/autocomplete` Uses GPT-4o-mini to suggest a completion for a partially typed conversation message after explicit data-processing consent. Requires at least 10 characters of input. Rate limited to 30 requests per minute per user. Documentation: https://docs.guidelab.co/api-reference/ai/autocompleteAiMessage ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `conversationId` (string) **(required)**: - `currentText` (string) **(required)**: - `dataProcessingConsent` (boolean) **(required)**: Values: `true` ## Responses ### 200: Suggested message completion text - `completion` (string) **(required)**: ### 401: Unauthorized — valid session required ### 409: Conversation deletion has been authorized ### 413: AI prompt input limit exceeded ### 429: Global, organization, or user AI usage limit exceeded ## Example ```bash curl -X POST "https://api-stage.guidelab.co/ai/autocomplete" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "conversationId": "string", "currentText": "string", "dataProcessingConsent": true }' ``` --- # Global search across all entities `GET https://api-stage.guidelab.co/search` Performs a fuzzy search across orders, patients, organizations, products (lab only), invoices, and team members within the authenticated organization's scope. Returns ranked results grouped by entity type. Documentation: https://docs.guidelab.co/api-reference/search/searchGlobal ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `q` (string) **(required)** (in: query): - `limit` (integer) (in: query): Default: `5` ## Responses ### 200: Search results grouped by entity type with relevance scores - `results` (object) **(required)**: - `orders` (object[]) **(required)**: - `id` (string) **(required)**: - `label` (string) **(required)**: - `subtitle` (string,null) **(required)**: - `url` (string) **(required)**: - `relevance` (number) **(required)**: - `patients` (array) **(required)**: - `organizations` (array) **(required)**: - `products` (array) **(required)**: - `invoices` (array) **(required)**: - `members` (array) **(required)**: - `query` (string) **(required)**: - `degraded` (string[]) **(required)**: Categories whose query failed and degraded to an empty list. Empty when every category ran successfully. (example: ``) ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/search" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Download software installer for a platform `GET https://api-stage.guidelab.co/download/{software}/{platform}` Fetches the newest matching software release asset from the private release repository and streams it to an authenticated user. Documentation: https://docs.guidelab.co/api-reference/download/downloadSoftwareInstaller ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `software` (string) **(required)** (in: path): Values: `uploader` - `platform` (string) **(required)** (in: path): Values: `mac-arm`, `mac-intel`, `windows` ## Responses ### 200: Binary file download stream ### 302: Redirect to a short-lived signed release asset URL ### 400: Unknown software or invalid platform ### 401: Unauthorized — valid session required ### 404: No matching release asset found ### 413: Release asset exceeds the download ceiling ### 429: Release lookup budget exhausted ### 502: Release service unavailable ## Example ```bash curl -X GET "https://api-stage.guidelab.co/download/{software}/{platform}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Check for a signed uploader update `GET https://api-stage.guidelab.co/download/uploader/update/{target}/{arch}/{currentVersion}` Returns signed Tauri updater metadata for the authenticated device, or no content when its installed version is current. Documentation: https://docs.guidelab.co/api-reference/download/checkUploaderUpdate ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `target` (string) **(required)** (in: path): Values: `darwin`, `windows` - `arch` (string) **(required)** (in: path): Values: `aarch64`, `x86_64` - `currentVersion` (string) **(required)** (in: path): ## Responses ### 200: Signed updater metadata - `version` (string) **(required)**: - `pub_date` (string): - `url` (string) **(required)**: [uri] - `signature` (string) **(required)**: - `notes` (string): ### 204: The installed version is current ### 400: Unsupported target or invalid version ### 401: Unauthorized — native device credential required ### 404: No signed update found ### 413: Release asset exceeds the download ceiling ### 429: Release lookup budget exhausted ### 502: Release service unavailable ## Example ```bash curl -X GET "https://api-stage.guidelab.co/download/uploader/update/{target}/{arch}/{currentVersion}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Download a signed uploader update bundle `GET https://api-stage.guidelab.co/download/uploader/update-asset/{version}/{assetName}` Streams an allowlisted updater bundle from an exact private release version to an authenticated device. Documentation: https://docs.guidelab.co/api-reference/download/downloadUploaderUpdateAsset ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `version` (string) **(required)** (in: path): - `assetName` (string) **(required)** (in: path): Values: `GuideLab-Uploader_aarch64.app.tar.gz`, `GuideLab-Uploader_x64.app.tar.gz`, `GuideLab-Uploader_x64.exe` ## Responses ### 200: Signed updater bundle ### 302: Redirect to a short-lived signed release asset URL ### 400: Unsupported updater asset ### 401: Unauthorized — native device credential required ### 404: Update asset not found ### 413: Release asset exceeds the download ceiling ### 429: Release lookup budget exhausted ### 502: Release service unavailable ## Example ```bash curl -X GET "https://api-stage.guidelab.co/download/uploader/update-asset/{version}/{assetName}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List partner labs for the clinic `GET https://api-stage.guidelab.co/clinic/labs` Returns all labs that have a partnership with the authenticated clinic, including lab contact details and partnership status. Clinic-only endpoint. Documentation: https://docs.guidelab.co/api-reference/clinic/getClinicPartnerLabs ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of partner labs with contact info and partnership status - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `labName` (string) **(required)**: - `labLogo` (string,null) **(required)**: - `labCity` (string,null) **(required)**: - `labPhone` (string,null) **(required)**: - `labEmail` (string,null) **(required)**: - `status` (string) **(required)**: - `createdAt` (string) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic/labs" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List clinic clients (doctors) for a lab `GET https://api-stage.guidelab.co/clients` Returns paginated list of clinic owner members (doctors) from partner clinics. Supports search, filtering by clinic ID, and sorting by name, email, practice, or creation date. Includes per-doctor order counts. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/clients/listClients ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Paginated list of client members with order counts - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `userId` (string) **(required)**: - `userName` (string) **(required)**: - `userEmail` (string) **(required)**: - `userPhone` (string,null) **(required)**: - `role` (string) **(required)**: - `clinicId` (string) **(required)**: - `clinicName` (string) **(required)**: - `orderCount` (number) **(required)**: - `createdAt` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 401: Unauthorized — valid session required ### 403: Only labs can access this endpoint ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clients" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Automations `GET https://api-stage.guidelab.co/automations` Documentation: https://docs.guidelab.co/api-reference/automations/listAutomations ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `includeInactive` () (in: query): Default: `false` - `search` (string) (in: query): - `triggerType` (string) (in: query): Values: `order_created`, `order_status_changed`, `product_added_to_order`, `manual`, `qc_completed`, `scheduled_invoice_generation` - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `50` ## Responses ### 200: Paginated automations - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `triggerType` (string) **(required)**: - `triggerConfig` (object,null) **(required)**: - `flowDefinition` (object) **(required)**: - `activeRevisionId` (string,null) **(required)**: - `archivedAt` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query ### 403: Lab only ## Example ```bash curl -X GET "https://api-stage.guidelab.co/automations" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Automation `POST https://api-stage.guidelab.co/automations` Documentation: https://docs.guidelab.co/api-reference/automations/createAutomation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `name` (string) **(required)**: - `description` (string): - `triggerType` (string) **(required)**: Values: `order_created`, `order_status_changed`, `product_added_to_order`, `manual`, `qc_completed`, `scheduled_invoice_generation` - `triggerConfig` (object): - `flowDefinition` (object): - `nodes` (array) **(required)**: - `edges` (object[]) **(required)**: - `id` (string) **(required)**: - `source` (string) **(required)**: - `target` (string) **(required)**: - `sourceHandle` (string,null): - `targetHandle` (string,null): - `label` (string): - `sortOrder` (integer): (default: `0`) ## Responses ### 201: Created automation draft - `automation` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `triggerType` (string) **(required)**: - `triggerConfig` (object,null) **(required)**: - `flowDefinition` (object) **(required)**: - `activeRevisionId` (string,null) **(required)**: - `archivedAt` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid body ### 403: Lab only ## Example ```bash curl -X POST "https://api-stage.guidelab.co/automations" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "triggerType": "order_created", "triggerConfig": {}, "flowDefinition": { "nodes": [ "string" ], "edges": [ { "id": "string", "source": "string", "target": "string", "sourceHandle": "string", "targetHandle": "string", "label": "string" } ] }, "sortOrder": 0 }' ``` --- # Get Automation `GET https://api-stage.guidelab.co/automations/{id}` Documentation: https://docs.guidelab.co/api-reference/automations/getAutomation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Automation - `automation` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `triggerType` (string) **(required)**: - `triggerConfig` (object,null) **(required)**: - `flowDefinition` (object) **(required)**: - `activeRevisionId` (string,null) **(required)**: - `archivedAt` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 403: Lab only ### 404: Not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/automations/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Toggle Automation `PATCH https://api-stage.guidelab.co/automations/{id}` Documentation: https://docs.guidelab.co/api-reference/automations/toggleAutomation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `isActive` (boolean): ## Responses ### 200: Changed activation - `automation` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `triggerType` (string) **(required)**: - `triggerConfig` (object,null) **(required)**: - `flowDefinition` (object) **(required)**: - `activeRevisionId` (string,null) **(required)**: - `archivedAt` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Draft is not executable ### 403: Lab only ### 404: Not found ### 409: Archived ## Example ```bash curl -X PATCH "https://api-stage.guidelab.co/automations/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "isActive": true }' ``` --- # Delete Automation `DELETE https://api-stage.guidelab.co/automations/{id}` Documentation: https://docs.guidelab.co/api-reference/automations/deleteAutomation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Archived automation - `automation` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `triggerType` (string) **(required)**: - `triggerConfig` (object,null) **(required)**: - `flowDefinition` (object) **(required)**: - `activeRevisionId` (string,null) **(required)**: - `archivedAt` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `message` (string) **(required)**: ### 403: Lab only ### 404: Not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/automations/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Automation `PUT https://api-stage.guidelab.co/automations/{id}` Documentation: https://docs.guidelab.co/api-reference/automations/updateAutomation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `name` (string): - `description` (string,null): - `triggerType` (string): Values: `order_created`, `order_status_changed`, `product_added_to_order`, `manual`, `qc_completed`, `scheduled_invoice_generation` - `triggerConfig` (object,null): - `flowDefinition` (object): - `nodes` (array) **(required)**: - `edges` (object[]) **(required)**: - `id` (string) **(required)**: - `source` (string) **(required)**: - `target` (string) **(required)**: - `sourceHandle` (string,null): - `targetHandle` (string,null): - `label` (string): - `sortOrder` (integer): ## Responses ### 200: Updated draft - `automation` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `triggerType` (string) **(required)**: - `triggerConfig` (object,null) **(required)**: - `flowDefinition` (object) **(required)**: - `activeRevisionId` (string,null) **(required)**: - `archivedAt` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid body ### 403: Lab only ### 404: Not found ### 409: Invalid or archived draft ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/automations/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "description": "string", "triggerType": "order_created", "triggerConfig": "string", "flowDefinition": { "nodes": [ "string" ], "edges": [ { "id": "string", "source": "string", "target": "string", "sourceHandle": "string", "targetHandle": "string", "label": "string" } ] }, "sortOrder": 0 }' ``` --- # Publish Automation `POST https://api-stage.guidelab.co/automations/{id}/publish` Documentation: https://docs.guidelab.co/api-reference/automations/publishAutomation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `revisionKind` (string): (default: `published`) Values: `published`, `test` ## Responses ### 200: Published immutable revision - `automation` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `name` (string) **(required)**: - `description` (string,null) **(required)**: - `triggerType` (string) **(required)**: - `triggerConfig` (object,null) **(required)**: - `flowDefinition` (object) **(required)**: - `activeRevisionId` (string,null) **(required)**: - `archivedAt` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Draft is not executable ### 403: Lab only ### 404: Not found ### 409: Archived ## Example ```bash curl -X POST "https://api-stage.guidelab.co/automations/{id}/publish" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "revisionKind": "published" }' ``` --- # List Automation Executions `GET https://api-stage.guidelab.co/automations/{id}/executions` Documentation: https://docs.guidelab.co/api-reference/automations/listAutomationExecutions ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `status` (string) (in: query): Values: `queued`, `running`, `succeeded`, `failed`, `skipped`, `timed_out`, `cancelled` - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `50` ## Responses ### 200: Immutable execution history - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `automationId` (string) **(required)**: - `revisionId` (string) **(required)**: - `labId` (string) **(required)**: - `triggerKey` (string) **(required)**: - `triggerPayload` (object,null) **(required)**: - `acceptedByUserId` (string,null) **(required)**: - `status` (string) **(required)**: - `attemptCount` (number) **(required)**: - `queuedAt` (string) **(required)**: - `startedAt` (string,null) **(required)**: - `heartbeatAt` (string,null) **(required)**: - `completedAt` (string,null) **(required)**: - `error` (string,null) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 403: Lab only ## Example ```bash curl -X GET "https://api-stage.guidelab.co/automations/{id}/executions" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Run Automation `POST https://api-stage.guidelab.co/automations/{id}/run` Documentation: https://docs.guidelab.co/api-reference/automations/runAutomation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `triggerKey` (string) **(required)**: - `triggerPayload` (object): ## Responses ### 202: Execution durably accepted - `execution` (object) **(required)**: - `id` (string) **(required)**: - `automationId` (string) **(required)**: - `revisionId` (string) **(required)**: - `labId` (string) **(required)**: - `triggerKey` (string) **(required)**: - `triggerPayload` (object,null) **(required)**: - `acceptedByUserId` (string,null) **(required)**: - `status` (string) **(required)**: - `attemptCount` (number) **(required)**: - `queuedAt` (string) **(required)**: - `startedAt` (string,null) **(required)**: - `heartbeatAt` (string,null) **(required)**: - `completedAt` (string,null) **(required)**: - `error` (string,null) **(required)**: - `duplicate` (boolean) **(required)**: ### 400: Invalid body or trigger ### 403: Lab only ### 404: Not found ### 409: Inactive or conflicting trigger key ### 429: Manual automation acceptance budget exhausted ## Example ```bash curl -X POST "https://api-stage.guidelab.co/automations/{id}/run" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "triggerKey": "string", "triggerPayload": {} }' ``` --- # List archived orders `GET https://api-stage.guidelab.co/archive/orders` Returns paginated archived orders for active clinic partnerships. Hidden patient names are masked and excluded from search. Supports filtering by clinic ID. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/archive/listArchivedOrders ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Paginated list of archived orders with patient and clinic info - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: - `status` (string) **(required)**: - `createdAt` (string) **(required)**: - `archivedAt` (string) **(required)**: - `archivedByUser` (object): - `archivedByUserNameMissing` (boolean) **(required)**: - `patient` (object): - `patientFirstNameMissing` (boolean) **(required)**: - `clinic` (object): - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 401: Unauthorized — valid session required ### 403: Only labs can access the archive ## Example ```bash curl -X GET "https://api-stage.guidelab.co/archive/orders" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Archive an order `POST https://api-stage.guidelab.co/archive/orders` Archives a completed or cancelled order by setting its archivedAt timestamp. Shipment status is independent. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/archive/archiveOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Order archived successfully - `success` (boolean) **(required)**: - `order` (object) **(required)**: - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: - `archivedAt` (string): ### 400: Order is already archived or has invalid status ### 401: Unauthorized — valid session required ### 404: Order not found ### 409: Order changed before it could be archived ## Example ```bash curl -X POST "https://api-stage.guidelab.co/archive/orders" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Restore an archived order `POST https://api-stage.guidelab.co/archive/orders/restore` Removes the archived status from an order, making it active again. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/archive/restoreArchivedOrder ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Order restored successfully - `success` (boolean) **(required)**: - `order` (object) **(required)**: - `id` (string) **(required)**: - `orderNumber` (string) **(required)**: - `status` (string) **(required)**: ### 401: Unauthorized — valid session required ### 404: Archived order not found ### 409: Order changed before it could be restored ## Example ```bash curl -X POST "https://api-stage.guidelab.co/archive/orders/restore" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List archived patients `GET https://api-stage.guidelab.co/archive/patients` Returns paginated archived patients whose PII is shared through an active partnership or an explicit patient grant. Inaccessible patients are omitted. Supports search and clinic filtering. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/archive/listArchivedPatients ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Paginated list of archived patients with clinic and order info - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `clinicId` (string,null) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `fullName` (string) **(required)**: - `externalId` (string,null) **(required)**: - `clinic` (object): - `orderCount` (number) **(required)**: - `createdAt` (string) **(required)**: - `archivedAt` (string) **(required)**: - `archivedByUser` (object): - `archivedByUserNameMissing` (boolean) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 401: Unauthorized — valid session required ### 403: Only labs can access the archive ## Example ```bash curl -X GET "https://api-stage.guidelab.co/archive/patients" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Archive a patient `POST https://api-stage.guidelab.co/archive/patients` Archives a patient by setting its archivedAt timestamp. Fails if the patient has active (non-archived) orders. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/archive/archivePatient ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Patient archived successfully - `success` (boolean) **(required)**: - `patient` (object) **(required)**: - `id` (string) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: - `archivedAt` (string): - `warning` (string,null) **(required)**: ### 400: Patient already archived or has active orders ### 401: Unauthorized — valid session required ### 404: Patient not found ### 409: Patient changed before it could be archived ## Example ```bash curl -X POST "https://api-stage.guidelab.co/archive/patients" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Restore an archived patient `POST https://api-stage.guidelab.co/archive/patients/restore` Removes the archived status from a patient, making them active again. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/archive/restoreArchivedPatient ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Patient restored successfully - `success` (boolean) **(required)**: - `patient` (object) **(required)**: - `id` (string) **(required)**: - `firstName` (string) **(required)**: - `lastName` (string) **(required)**: ### 401: Unauthorized — valid session required ### 404: Archived patient not found ### 409: Patient changed before it could be restored ## Example ```bash curl -X POST "https://api-stage.guidelab.co/archive/patients/restore" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List forms with questions `GET https://api-stage.guidelab.co/forms` Returns forms for the authenticated lab with their associated questions. Supports filtering by scope, search, and active status. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/listForms ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of forms with embedded questions - `forms` (array) **(required)**: ### 401: Unauthorized — valid session required ### 403: Only labs can manage forms ## Example ```bash curl -X GET "https://api-stage.guidelab.co/forms" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a new form `POST https://api-stage.guidelab.co/forms` Creates a new form with optional initial question assignments. Auto-assigns sort order if not specified. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/createForm ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 201: Form created successfully - `form` (object): ### 401: Unauthorized — valid session required ### 403: Only labs can manage forms ## Example ```bash curl -X POST "https://api-stage.guidelab.co/forms" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get form feature settings `GET https://api-stage.guidelab.co/forms/settings` Returns the lab's form settings including whether order flow forms and registration forms are enabled. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/getFormSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Form settings object - `settings` (object): ### 401: Unauthorized — valid session required ### 403: Only labs can manage form settings ## Example ```bash curl -X GET "https://api-stage.guidelab.co/forms/settings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update form feature settings `PUT https://api-stage.guidelab.co/forms/settings` Updates the lab's form settings. Creates the settings record if it does not exist. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/updateFormSettings ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Form settings updated successfully - `settings` (object): ### 401: Unauthorized — valid session required ### 403: Only labs can manage form settings ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/forms/settings" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List all form questions `GET https://api-stage.guidelab.co/forms/questions` Returns paginated form questions for the authenticated lab. Supports filtering by scope, search, and active status. These are global questions that can be assigned to multiple forms. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/listFormQuestions ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: List of form questions - `questions` (array) **(required)**: ### 400: Invalid query parameters ### 401: Unauthorized — valid session required ### 403: Only labs can manage form questions ## Example ```bash curl -X GET "https://api-stage.guidelab.co/forms/questions" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a form question `POST https://api-stage.guidelab.co/forms/questions` Creates a new reusable form question. Auto-assigns sort order if not specified. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/createFormQuestion ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `scope` (string) **(required)**: Values: `order_flow`, `registration` - `label` (string) **(required)**: - `fieldType` (string) **(required)**: Values: `text`, `textarea`, `number`, `date`, `select`, `multiselect`, `checkbox`, `radio` - `placeholder` (string): - `helpText` (string): - `options` (object[]): - `value` (string) **(required)**: - `label` (string) **(required)**: - `isRequired` (boolean): (default: `false`) - `sortOrder` (integer): (default: `0`) - `isActive` (boolean): (default: `true`) ## Responses ### 201: Form question created successfully - `question` (object): ### 400: Invalid form question definition ### 401: Unauthorized — valid session required ### 403: Only labs can manage form questions ### 413: Question definition exceeds the raw-body ceiling ## Example ```bash curl -X POST "https://api-stage.guidelab.co/forms/questions" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "scope": "order_flow", "label": "string", "fieldType": "text" }' ``` --- # Reorder form questions globally `PUT https://api-stage.guidelab.co/forms/questions/reorder` Updates the sort order of multiple form questions at once. All specified questions must belong to the authenticated lab. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/reorderFormQuestions ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Questions reordered successfully - `questions` (array) **(required)**: ### 401: Unauthorized — valid session required ### 403: Only labs can manage form questions ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/forms/questions/reorder" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get a form question by ID `GET https://api-stage.guidelab.co/forms/questions/{id}` Returns a single form question by ID, scoped to the authenticated lab. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/getFormQuestion ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Form question ID ## Responses ### 200: Form question details - `question` (object): ### 401: Unauthorized — valid session required ### 404: Question not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/forms/questions/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Deactivate a form question `DELETE https://api-stage.guidelab.co/forms/questions/{id}` Soft-deletes a form question by setting it to inactive. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/deleteFormQuestion ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Form question ID ## Responses ### 200: Form question deactivated successfully - `question` (object): ### 401: Unauthorized — valid session required ### 404: Question not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/forms/questions/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a form question `PUT https://api-stage.guidelab.co/forms/questions/{id}` Updates a form question's label, field type, options, or other properties. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/updateFormQuestion ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Form question ID ## Request Body Content-Type: `application/json` - `scope` (string): Values: `order_flow`, `registration` - `label` (string): - `fieldType` (string): Values: `text`, `textarea`, `number`, `date`, `select`, `multiselect`, `checkbox`, `radio` - `placeholder` (string): - `helpText` (string): - `options` (array,null): - `value` (string) **(required)**: - `label` (string) **(required)**: - `isRequired` (boolean): - `sortOrder` (integer): - `isActive` (boolean): ## Responses ### 200: Form question updated successfully - `question` (object): ### 400: Invalid form question definition ### 401: Unauthorized — valid session required ### 404: Question not found ### 409: Question scope cannot change while it is assigned to a form ### 413: Question definition exceeds the raw-body ceiling ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/forms/questions/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{}' ``` --- # Publish an immutable form revision `POST https://api-stage.guidelab.co/forms/{id}/publish` Resolves the current element assignments into a self-contained immutable revision and activates it atomically. Documentation: https://docs.guidelab.co/api-reference/forms/publishFormRevision ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Published revision - `revision` (object): ### 400: The draft cannot be published ### 403: Only lab managers can publish forms ### 404: Form not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/forms/{id}/publish" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Submit answers for an order form `POST https://api-stage.guidelab.co/forms/{id}/orders/{orderId}/submission` Validates one immutable JSON answer document against the active pinned order-flow revision. Documentation: https://docs.guidelab.co/api-reference/forms/submitOrderForm ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `orderId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `answers` (object) **(required)**: ## Responses ### 201: Submission persisted ### 400: Answers do not satisfy the pinned revision ### 403: Organization is not an order participant ### 404: Order or form not found ### 409: Form is unpublished or already submitted ### 413: Answer document exceeds the raw-body ceiling ## Example ```bash curl -X POST "https://api-stage.guidelab.co/forms/{id}/orders/{orderId}/submission" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "answers": {} }' ``` --- # Submit answers for a partnership registration form `POST https://api-stage.guidelab.co/forms/{id}/partnerships/{partnershipId}/registration-submission` Validates one immutable JSON answer document against the active pinned registration revision. Documentation: https://docs.guidelab.co/api-reference/forms/submitPartnershipRegistrationForm ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): - `partnershipId` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `answers` (object) **(required)**: ## Responses ### 201: Submission persisted ### 400: Answers do not satisfy the pinned revision ### 403: Organization is not a partnership participant ### 404: Partnership or form not found ### 409: Form is unpublished or already submitted ### 413: Answer document exceeds the raw-body ceiling ## Example ```bash curl -X POST "https://api-stage.guidelab.co/forms/{id}/partnerships/{partnershipId}/registration-submission" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "answers": {} }' ``` --- # Get a form by ID `GET https://api-stage.guidelab.co/forms/{id}` Returns a single form with all its associated questions, scoped to the authenticated lab. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/getForm ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Form ID ## Responses ### 200: Form details with associated questions - `form` (object): ### 401: Unauthorized — valid session required ### 404: Form not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/forms/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Deactivate a form `DELETE https://api-stage.guidelab.co/forms/{id}` Soft-deletes a form by setting it to inactive. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/deleteForm ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Form ID ## Responses ### 200: Form deactivated successfully - `form` (object): ### 401: Unauthorized — valid session required ### 404: Form not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/forms/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a form `PUT https://api-stage.guidelab.co/forms/{id}` Updates a form's properties and optionally replaces its question assignments. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/updateForm ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Form ID ## Responses ### 200: Form updated successfully with questions - `form` (object): ### 401: Unauthorized — valid session required ### 404: Form not found ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/forms/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List questions assigned to a form `GET https://api-stage.guidelab.co/forms/{id}/questions` Returns all questions assigned to a specific form, ordered by sort order. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/listFormAssignedQuestions ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Form ID ## Responses ### 200: List of assigned questions with sort order - `questions` (array) **(required)**: ### 401: Unauthorized — valid session required ### 404: Form not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/forms/{id}/questions" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Add questions to a form `POST https://api-stage.guidelab.co/forms/{id}/questions` Assigns existing questions to a form. Skips questions already assigned. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/addQuestionsToForm ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Form ID ## Responses ### 200: Updated list of assigned questions - `questions` (array) **(required)**: ### 401: Unauthorized — valid session required ### 404: Form not found ## Example ```bash curl -X POST "https://api-stage.guidelab.co/forms/{id}/questions" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Remove a question from a form `DELETE https://api-stage.guidelab.co/forms/{id}/questions` Removes the association between a question and a form. The question itself is not deleted. Expects elementId in the request body. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/removeQuestionFromForm ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Form ID ## Responses ### 200: Question removed from form successfully - `success` (boolean) **(required)**: ### 401: Unauthorized — valid session required ### 404: Form not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/forms/{id}/questions" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Reorder questions within a form `PUT https://api-stage.guidelab.co/forms/{id}/questions` Updates the sort order of questions assigned to a specific form. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/forms/reorderFormAssignedQuestions ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Form ID ## Responses ### 200: Questions reordered successfully - `questions` (array) **(required)**: ### 401: Unauthorized — valid session required ### 404: Form not found ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/forms/{id}/questions" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List location routes `GET https://api-stage.guidelab.co/location-routes` Returns paginated delivery location routes for a lab. Labs see their own routes; clinics must specify a labId query parameter and must be active partners of that lab. Documentation: https://docs.guidelab.co/api-reference/location-routes/listLocationRoutes ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Paginated list of location routes - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 401: Unauthorized — valid session required ## Example ```bash curl -X GET "https://api-stage.guidelab.co/location-routes" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a location route `POST https://api-stage.guidelab.co/location-routes` Creates a new delivery location route. If set as default, the previous default is unset. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/location-routes/createLocationRoute ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 201: Location route created successfully - `route` (object): ### 401: Unauthorized — valid session required ### 403: Only labs can create location routes ## Example ```bash curl -X POST "https://api-stage.guidelab.co/location-routes" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get a location route by ID `GET https://api-stage.guidelab.co/location-routes/{id}` Returns a single location route by ID. Labs see their own routes; clinics can only access routes from partner labs. Documentation: https://docs.guidelab.co/api-reference/location-routes/getLocationRoute ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Location route ID ## Responses ### 200: Location route details - `route` (object): ### 401: Unauthorized — valid session required ### 404: Location route not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/location-routes/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Deactivate a location route `DELETE https://api-stage.guidelab.co/location-routes/{id}` Soft-deletes a location route by setting it to inactive. Cannot delete the default route. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/location-routes/deleteLocationRoute ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Location route ID ## Responses ### 200: Location route deactivated successfully - `route` (object): - `message` (string) **(required)**: ### 400: Cannot delete the default route ### 401: Unauthorized — valid session required ### 403: Only labs can delete location routes ### 404: Location route not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/location-routes/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a location route `PUT https://api-stage.guidelab.co/location-routes/{id}` Updates a location route's properties. If set as default, the previous default is unset. Lab-only endpoint. Documentation: https://docs.guidelab.co/api-reference/location-routes/updateLocationRoute ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Location route ID ## Responses ### 200: Location route updated successfully - `route` (object): ### 401: Unauthorized — valid session required ### 403: Only labs can update location routes ### 404: Location route not found ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/location-routes/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List clinic locations `GET https://api-stage.guidelab.co/clinic-locations` Returns paginated clinic locations. Clinics see their own locations; labs must specify a clinicId query parameter and must have an active partnership with that clinic. Documentation: https://docs.guidelab.co/api-reference/clinic-locations/listClinicLocations ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 200: Paginated list of clinic locations - `data` (array) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 401: Unauthorized — valid session required ### 403: Access denied to this clinic's locations ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic-locations" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create a clinic location `POST https://api-stage.guidelab.co/clinic-locations` Creates a new physical location for the authenticated clinic. If set as default, the previous default is unset. Clinic-only endpoint. Documentation: https://docs.guidelab.co/api-reference/clinic-locations/createClinicLocation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Responses ### 201: Clinic location created successfully - `location` (object): ### 401: Unauthorized — valid session required ### 403: Only clinics can create locations ## Example ```bash curl -X POST "https://api-stage.guidelab.co/clinic-locations" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Get a clinic location by ID `GET https://api-stage.guidelab.co/clinic-locations/{id}` Returns a single clinic location by ID. Documentation: https://docs.guidelab.co/api-reference/clinic-locations/getClinicLocation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Clinic location ID ## Responses ### 200: Clinic location details - `location` (object): ### 401: Unauthorized — valid session required ### 404: Location not found ## Example ```bash curl -X GET "https://api-stage.guidelab.co/clinic-locations/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Deactivate a clinic location `DELETE https://api-stage.guidelab.co/clinic-locations/{id}` Soft-deletes a clinic location by setting it to inactive. Cannot delete the default location. Clinic-only endpoint. Documentation: https://docs.guidelab.co/api-reference/clinic-locations/deleteClinicLocation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Clinic location ID ## Responses ### 200: Location deactivated successfully - `location` (object): - `message` (string) **(required)**: ### 400: Cannot delete the default location ### 401: Unauthorized — valid session required ### 403: Only clinics can delete locations ### 404: Location not found ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/clinic-locations/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update a clinic location `PUT https://api-stage.guidelab.co/clinic-locations/{id}` Updates a clinic location's properties. If set as default, the previous default is unset. Clinic-only endpoint. Documentation: https://docs.guidelab.co/api-reference/clinic-locations/updateClinicLocation ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): Clinic location ID ## Responses ### 200: Clinic location updated successfully - `location` (object): ### 401: Unauthorized — valid session required ### 403: Only clinics can update locations ### 404: Location not found ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/clinic-locations/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Handle Stripe Connect webhook events `POST https://api-stage.guidelab.co/webhooks/stripe-connect` Receives verified Stripe Connect account, PaymentIntent, refund, and dispute events. Public endpoint; provider signature authentication is required outside explicit local test mode. Documentation: https://docs.guidelab.co/api-reference/webhooks/handleStripeConnectWebhook ## Responses ### 200: Webhook event processed successfully - `received` (boolean) **(required)**: ### 400: Invalid signature, payload, mode, or provenance ### 413: Webhook body exceeds the allowed size ### 500: Webhook processing failed ### 503: Webhook authentication is not configured safely ## Example ```bash curl -X POST "https://api-stage.guidelab.co/webhooks/stripe-connect" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Handle Medit scanner webhook events `POST https://api-stage.guidelab.co/webhooks/medit` Receives Medit Link webhook events and requires the connection-specific HMAC signature. Public endpoint; no session authentication. Documentation: https://docs.guidelab.co/api-reference/webhooks/handleMeditWebhook ## Responses ### 200: Webhook event acknowledged - `ok` (boolean) **(required)**: ### 400: Invalid JSON payload ### 401: Missing or invalid webhook signature ### 413: Webhook body exceeds the allowed size ### 500: Webhook evidence could not be stored ### 503: Webhook signature is not configured ## Example ```bash curl -X POST "https://api-stage.guidelab.co/webhooks/medit" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Handle ShipEngine tracking webhook events `POST https://api-stage.guidelab.co/webhooks/ship-engine/{integrationId}/{token}` Receives exact ShipEngine API_TRACK payloads authenticated by a per-integration URL token and ShipEngine RSA signature. Documentation: https://docs.guidelab.co/api-reference/webhooks/handleShipEngineTrackingWebhook ## Parameters - `integrationId` (string) **(required)** (in: path): - `token` (string) **(required)** (in: path): ## Responses ### 200: Webhook evidence accepted - `ok` (boolean) **(required)**: - `duplicate` (boolean) **(required)**: ### 400: Invalid webhook payload ### 401: Missing, invalid, or expired provider signature ### 404: Webhook endpoint not found ### 413: Webhook body exceeds the allowed size ### 429: Webhook verification budget exhausted ### 500: Webhook evidence could not be stored ## Example ```bash curl -X POST "https://api-stage.guidelab.co/webhooks/ship-engine/{integrationId}/{token}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # List Work Trays `GET https://api-stage.guidelab.co/work-trays` List work trays for the current lab with pagination, search, and optional order filtering. Includes the currently assigned order for each tray. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/work-trays/listWorkTrays ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `page` (integer) (in: query): Default: `1` - `limit` (integer) (in: query): Default: `50` - `search` (string) (in: query): - `orderId` (string) (in: query): - `includeInactive` () (in: query): Default: `false` ## Responses ### 200: Paginated list of work trays with current order assignments - `data` (object[]) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `code` (string) **(required)**: - `color` (string,null): - `description` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `currentOrderId` (string,null) **(required)**: - `currentOrderNumber` (string,null) **(required)**: - `currentOrderPhaseId` (string,null) **(required)**: - `currentPhaseName` (string,null) **(required)**: - `pagination` (object) **(required)**: - `page` (number) **(required)**: - `limit` (number) **(required)**: - `total` (number) **(required)**: - `totalPages` (number) **(required)**: ### 400: Invalid query parameters ### 403: Only labs can access work trays ### 500: Internal server error ## Example ```bash curl -X GET "https://api-stage.guidelab.co/work-trays" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Create Work Tray `POST https://api-stage.guidelab.co/work-trays` Create a new work tray with a unique code. Lab-only operation. Returns 409 if a tray with the same code already exists. Documentation: https://docs.guidelab.co/api-reference/work-trays/createWorkTray ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `code` (string) **(required)**: - `color` (string): - `description` (string): - `isActive` (boolean): (default: `true`) - `sortOrder` (integer): (default: `0`) ## Responses ### 201: Newly created work tray - `tray` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `code` (string) **(required)**: - `color` (string,null): - `description` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 403: Only labs can create work trays ### 409: A tray with this code already exists ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/work-trays" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "code": "string", "color": "string", "description": "string", "isActive": true, "sortOrder": 0 }' ``` --- # Batch Create Work Trays `POST https://api-stage.guidelab.co/work-trays/batch` Bulk-create work trays from a pattern and quantity. Generates sequentially numbered codes (e.g. TRAY001, TRAY002). Skips duplicates. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/work-trays/batchCreateWorkTrays ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Request Body Content-Type: `application/json` - `pattern` (string) **(required)**: - `quantity` (integer) **(required)**: - `color` (string): - `description` (string): ## Responses ### 201: Batch creation result with created count and duplicate errors - `created` (number) **(required)**: - `total` (number) **(required)**: - `errors` (object[]) **(required)**: - `code` (string) **(required)**: - `error` (string) **(required)**: ### 400: Invalid request body ### 500: Internal server error ## Example ```bash curl -X POST "https://api-stage.guidelab.co/work-trays/batch" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "pattern": "string", "quantity": 0, "color": "string", "description": "string" }' ``` --- # Delete Work Tray `DELETE https://api-stage.guidelab.co/work-trays/{id}` Soft-delete a work tray by marking it as inactive. Unassigns the tray from any active orders before deactivating. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/work-trays/deleteWorkTray ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Responses ### 200: Tray deactivated and unassigned from active orders - `tray` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `code` (string) **(required)**: - `color` (string,null): - `description` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: - `message` (string) **(required)**: ### 403: Only labs can delete work trays ### 404: Tray not found ### 500: Internal server error ## Example ```bash curl -X DELETE "https://api-stage.guidelab.co/work-trays/{id}" \ -H "Authorization: Bearer gl_device_v1_" ``` --- # Update Work Tray `PUT https://api-stage.guidelab.co/work-trays/{id}` Update an existing work tray's code, color, description, active status, or sort order. Returns 409 if the new code conflicts with an existing tray. Lab-only operation. Documentation: https://docs.guidelab.co/api-reference/work-trays/updateWorkTray ## Authentication Requires an authenticated browser session (`__Secure-guidelab-prod.session_token` cookie) or a versioned GuideLab device credential in the `Authorization` header. Better Auth session tokens are cookie-only and are not valid bearer credentials. ``` Authorization: Bearer gl_device_v1_ ``` ## Parameters - `id` (string) **(required)** (in: path): ## Request Body Content-Type: `application/json` - `code` (string): - `color` (string): - `description` (string): - `isActive` (boolean): - `sortOrder` (integer): ## Responses ### 200: Successfully updated work tray - `tray` (object) **(required)**: - `id` (string) **(required)**: - `labId` (string) **(required)**: - `code` (string) **(required)**: - `color` (string,null): - `description` (string,null) **(required)**: - `isActive` (boolean) **(required)**: - `sortOrder` (number) **(required)**: - `createdAt` (string) **(required)**: - `updatedAt` (string) **(required)**: ### 400: Invalid request body ### 403: Only labs can update work trays ### 404: Tray not found ### 409: A tray with this code already exists ### 500: Internal server error ## Example ```bash curl -X PUT "https://api-stage.guidelab.co/work-trays/{id}" \ -H "Authorization: Bearer gl_device_v1_" \ -H "Content-Type: application/json" \ -d '{ "code": "string", "color": "string", "description": "string", "isActive": true, "sortOrder": 0 }' ```