API reference
Every HTTP operation the Tearleads server exposes, with the fields it accepts and returns and the rules it enforces.
Tearleads Protocol API, version 0.1.0. Download openapi.json
The HTTP API behind Tearleads clients. Document and key material is end-to-end encrypted, so request bodies carry ciphertext, signed manifests, and key envelopes that only the client SDK can produce or open.
This document is generated from the Zod operation registry in @tearleads/validators, which remains the runtime authority. Rules that JSON Schema cannot express are listed per operation under x-tearleads-runtime-refinements. See the protocol specification for message semantics, proofs, and failure handling.
Because documents and keys are end-to-end encrypted, the client SDK is the only practical client: this reference is for reviewing what the server accepts, returns, and enforces, not for writing a client.
These pages are rendered from that OpenAPI document, which is generated from the Zod operation registry; the Zod schemas stay the runtime authority. Message semantics and proofs are in the protocol specification, and protocol terms link to the glossary.
Health
Auth
- POST
/auth/challengeRequest an auth challenge - POST
/auth/logoutDestroy the current session - POST
/auth/registerRegister an identity and bootstrap its root state - DELETE
/auth/sessions/{sessionId}Destroy a user session - GET
/auth/sessionsList auth sessions - GET
/auth/user-identity/{userId}Get a complete user identity - POST
/auth/verifyVerify an auth challenge - POST
/auth/ws-ticketMint a one-time WebSocket ticket
Billing webhooks
Blobs
- PUT
/blobs/stages/multipart/{stageId}/parts/{partNumber}/bytesUpload multipart blob part bytes through the API - POST
/blobs/stages/multipart/{stageId}/parts/{partNumber}/uploadAuthorize a direct multipart blob part upload - GET
/blobs/stages/multipart/{stageId}Get multipart blob stage status - POST
/blobs/stages/multipartInitiate a multipart blob stage - POST
/blobs/{blobId}/attachment-bindings/{bindingId}/detachDetach a blob attachment - POST
/blobs/{blobId}/attachment-bindingsBind or replace a blob attachment - GET
/blobs/{blobId}/bytesGet committed blob bytes - GET
/blobs/{blobId}/downloadGet a blob download source
Containers
- POST
/containers/documents/queryList container documents by lane - POST
/containers/parent-lanes/queryList containers by parent lane - POST
/containers/with-metadata-documentCreate a container with its metadata document - GET
/containers/{containerId}/kek-logPage a container's KEK rotation log - POST
/containers/{containerId}/moveMove a container - POST
/containers/{containerId}/reciteRe-cite a held container's current ancestor path - POST
/containers/{containerId}/rekeyRekey a container - GET
/containers/{containerId}/replacement-authorizations/{replacesOrganizationId}Get a re-shared container's replacement lineage - POST
/containers/{containerId}/revokeRevoke a container grant - POST
/containers/{containerId}/shareShare a container - GET
/containers/{containerId}/writer-projectionGet a container writer projection - DELETE
/containers/{containerId}Delete a container - POST
/containersCreate a container
Documents
- GET
/documents/{documentId}/attachmentsList active document attachments - GET
/documents/{documentId}/attribution/rangesList document attribution ranges - GET
/documents/{documentId}/attributionGet document edit attribution - POST
/documents/{documentId}/linkLink a document to a container - GET
/documents/{documentId}/purgeGet a document purge proof - POST
/documents/{documentId}/purgePurge a document - POST
/documents/{documentId}/syncSync encrypted Loro updates - POST
/documents/{documentId}/unlinkUnlink a document from a container - GET
/documents/{documentId}/writer-projectionGet a document writer projection - POST
/documentsCreate a document
Organization memberships
- DELETE
/organization-memberships/{organizationId}/leave-requestWithdraw a request to leave an organization - PUT
/organization-memberships/{organizationId}/leave-requestRequest to leave an organization - PUT
/organization-memberships/{organizationId}Update an organization membership - GET
/organization-membershipsList your organization memberships
Organization billing
- GET
/organizations/{organizationId}/billing/historyGet organization billing history - GET
/organizations/{organizationId}/billing/management-urlGet the organization billing management URL - GET
/organizations/{organizationId}/billing/native/eligibilityGet native store purchase eligibility - POST
/organizations/{organizationId}/billing/native/{store}/claimClaim a native store subscription - POST
/organizations/{organizationId}/billing/stripe/cancelCancel the Stripe subscription - POST
/organizations/{organizationId}/billing/stripe/checkout-sessionCreate an embedded Stripe checkout session - POST
/organizations/{organizationId}/billing/stripe/checkoutCreate a Stripe checkout - GET
/organizations/{organizationId}/billing/stripe/optionsGet Stripe checkout options - POST
/organizations/{organizationId}/billing/stripe/portalCreate a Stripe customer portal session - POST
/organizations/{organizationId}/billing/trialStart an organization trial - GET
/organizations/{organizationId}/billingGet organization billing
Organizations
- GET
/organizations/{organizationId}/data-usageGet organization data usage - GET
/organizations/{organizationId}/groups/{groupId}/membersList organization group members - PUT
/organizations/{organizationId}/groups/{groupId}/policy-commitAdvance a group policy and its signed directory head - DELETE
/organizations/{organizationId}/groups/{groupId}Delete an organization group - POST
/organizations/{organizationId}/groupsCreate an organization group and advance its signed directory - GET
/organizations/{organizationId}/policy-historyPage organization policy history - PUT
/organizations/{organizationId}/profileUpdate the organization profile - GET
/organizations/{organizationId}/read-modelReconcile the organization read model - PUT
/organizations/{organizationId}/roster/{userId}Bind an encrypted roster profile document - POST
/organizationsCreate an organization
Principals
Root operator
- GET
/root/audit-eventsPage recorded operator actions - GET
/root/identities/{userId}/organizationsList an identity's organizations - DELETE
/root/identities/{userId}/suspensionLift an identity suspension - PUT
/root/identities/{userId}/suspensionSuspend an identity - GET
/root/identities/{userId}Get an identity - GET
/root/identitiesList identities - GET
/root/organizations/{organizationId}/data-usageGet an organization's data usage - GET
/root/organizations/{organizationId}/identitiesList an organization's identities - GET
/root/organizations/{organizationId}/revenuecat-eventsPage an organization's RevenueCat deliveries - GET
/root/organizations/{organizationId}Get an organization - GET
/root/organizationsList organizations - GET
/root/reports/data-usagePage data usage by organization - GET
/root/reports/ops-healthReport billing maintenance trouble - GET
/root/reports/revenuecat-eventsPage unmatched or ignored RevenueCat deliveries
Schemas
Named request and response shapes, each with its fields and the operations that use it.
- AccessEventBundleWireResponse
- AccessManifestBundleWireResponse
- BillingErrorResponse
- BlobAttachmentBindRequest
- BlobAttachmentBindResponse
- BlobAttachmentDetachRequest
- BlobAttachmentDetachResponse
- BlobAttachmentSummary
- BlobContentKeyBundleRequest
- BlobContentKeyBundleResponse
- BlobContentKeyTargetEnvelopeRequest
- BlobContentKeyTargetEnvelopeResponse
- BlobKekTargetsResponse
- BlobMutationFailureResponse
- BlobStagedBlobRequest
- ChallengeRequest
- ChallengeResponse
- CitedContainerKekLevel
- CommitOrganizationGroupPolicyConflictResponse
- CommitOrganizationGroupPolicyRequest
- CommitOrganizationGroupPolicyResponse
- ContainerCreateWithMetadataDocumentRequest
- ContainerCreateWithMetadataDocumentResponse
- ContainerDeleteResponse
- ContainerDocumentSummaryResponse
- ContainerDocumentSyncTombstoneResponse
- ContainerKekKeyringWireRecord
- ContainerKekLogEpochResponse
- ContainerKekLogResponse
- ContainerManifestRef
- ContainerManifestRefArrayArray
- ContainerMutationErrorCode
- ContainerMutationFailureResponse
- ContainerMutationRequest
- ContainerMutationResponse
- ContainerNotFoundErrorResponse
- ContainerReciteRequest
- ContainerReciteResponse
- ContainerRotationRequest
- ContainerRotationResponse
- ContainerSummaryResponse
- ContainerSyncTombstoneResponse
- ContainerWriterProjectionErrorResponse
- ContainerWriterProjectionWireResponse
- CreateOrganizationGroupRequest
- CreateOrganizationGroupResponse
- CreateOrganizationGroupWithPolicyRequest
- CreateOrganizationRequest
- CreateOrganizationResponse
- CurrentPrincipalMemberEnvelopesResponse
- DeleteOrganizationGroupRequest
- DeleteOrganizationGroupResponse
- DestroySessionResponse
- DocumentContentKeyBundleRequest
- DocumentContentKeyBundleResponse
- DocumentContentKeyTargetEnvelope
- DocumentContentKeyTargetEnvelopeResponse
- DocumentCreateRequest
- DocumentCreateResponse
- DocumentEditAttributionRangeResponse
- DocumentEditAttributionResponse
- DocumentEditAttributionSegmentResponse
- DocumentKekTargetsResponse
- DocumentLinkSetMutationRequest
- DocumentLinkSetMutationResponse
- DocumentMutationErrorCode
- DocumentMutationFailureResponse
- DocumentNotFoundErrorResponse
- DocumentOutgoingUpdate
- DocumentPurgeProofResponse
- DocumentPurgeRequest
- DocumentPurgeResponse
- DocumentSyncErrorResponse
- DocumentSyncPullPageResponse
- DocumentSyncRequest
- DocumentSyncResponse
- DocumentSyncUpdateResponse
- DocumentWriterProjectionErrorResponse
- DocumentWriterProjectionWireResponse
- ErrorResponse
- HealthResponse
- InitiateMultipartBlobStageRequest
- InitiateMultipartBlobStageResponse
- ListContainerDocumentLanesRequest
- ListContainerDocumentsResponse
- ListContainerParentLanesRequest
- ListContainerParentLanesResponse
- ListContainersResponse
- ListDocumentAttachmentsResponse
- ListDocumentEditAttributionRangesResponse
- ListSessionsResponse
- MultipartBlobPartDescriptor
- MultipartBlobPartUpload
- MultipartBlobPartUploadSource
- MultipartBlobStageConflictErrorResponse
- MultipartBlobStageNotFoundErrorResponse
- MultipartBlobStagePart
- MultipartBlobStageStatusResponse
- OrganizationBillingHistoryEntry
- OrganizationBillingHistoryResponse
- OrganizationBillingManagementUrlResponse
- OrganizationBillingResponse
- OrganizationDataUsageResponse
- OrganizationDirectoryUserResponse
- OrganizationGroupCurrentStateResponse
- OrganizationGroupMemberResponse
- OrganizationGroupMembersResponse
- OrganizationGroupSummaryResponse
- OrganizationLeaveRequest
- OrganizationMembershipResponse
- OrganizationMembershipsResponse
- OrganizationNativePurchaseEligibilityResponse
- OrganizationPolicyHistoryResponse
- OrganizationPresentationFailureResponse
- OrganizationPrincipalPolicyRequest
- OrganizationProfileResponse
- OrganizationReadModelFailureResponse
- OrganizationReadModelResponse
- OrganizationReplacementAuthorization
- PaymentRequiredErrorResponse
- PrincipalContainerGrantRequest
- PrincipalContainerGrantResponse
- PrincipalHistoryPreparationFailureResponse
- PrincipalHistoryPreparationResponse
- PrincipalMemberEnvelopeResponse
- PrincipalPolicyHistorySourceResponse
- PrincipalPolicyMutationResponse
- PrincipalPolicyPageResponse
- PrincipalPolicyReadResponse
- PrincipalPolicyRef
- PrincipalPolicyRefList
- PrincipalPolicySnapshotPageResponse
- PrincipalPolicyStaleErrorResponse
- PrincipalPolicyStateChainEntryResponse
- PrincipalPolicyUnchangedResponse
- PrincipalProjectionMemberResponse
- PrincipalStateExternalAuthorityResponse
- PrincipalStatePayloadResponse
- PrincipalStateResponse
- ProjectionPolicyEvidenceResponse
- ProvisionedDocumentRequest
- ProvisionedSystemContainerRequest
- PutPrincipalPolicyRequest
- ReferencedPrincipalStateResponse
- RegistrationRequest
- RegistrationResponse
- RevenueCatIncomingWebhookEvent
- RevenueCatSubscriberAttribute
- RevenueCatTransferWebhookEvent
- RevenueCatWebhookEvent
- RevenueCatWebhookRequest
- RevenueCatWebhookResponse
- RootAuditEventResponse
- RootAuditEventsResponse
- RootDataUsageReportResponse
- RootIdentitiesResponse
- RootIdentityDetailResponse
- RootIdentityOrganizationBillingResponse
- RootIdentityOrganizationResponse
- RootIdentityOrganizationsResponse
- RootIdentitySessionResponse
- RootIdentitySummaryResponse
- RootIdentitySuspensionResponse
- RootOpsHealthReportResponse
- RootOrganizationDetailResponse
- RootOrganizationIdentitiesResponse
- RootOrganizationIdentityResponse
- RootOrganizationRevenuecatEventResponse
- RootOrganizationRevenuecatEventsResponse
- RootOrganizationSummaryResponse
- RootOrganizationsResponse
- RootRevenuecatEventResponse
- RootRevenuecatEventsReportResponse
- SessionFailureResponse
- StripeCancelResponse
- StripeCheckoutIntentResponse
- StripeCheckoutOptionsResponse
- StripeCheckoutSessionResponse
- StripePortalResponse
- StripeReturnUrlRequest
- StripeSyncOptionResponse
- StripeWebhookResponse
- SyncWatermark
- UpdateOrganizationMembershipRequest
- UpdateOrganizationProfileRequest
- UpdateOrganizationRosterEntryRequest
- UploadMultipartBlobPartResponse
- UserIdentityResponse
- UserSessionResponse
- VerifyFailureResponse
- VerifyRequest
- VerifySuccessResponse
- WebSocketTicketResponse