### Getting Started Source: https://docs.sequencehq.com/llms.txt Guides users on how to automate their financial operations using the Sequence API. ```APIDOC ## GET /reference/gettingStarted ### Description Learn how to completely automate your financial operations. ### Method GET ### Endpoint /reference/gettingStarted ``` -------------------------------- ### Notification Channel Example Source: https://docs.sequencehq.com/reference/latest/notifications/remove-a-notification-type-from-a-policy An example of a notification channel. ```json WEBHOOK ``` -------------------------------- ### Merchant Details Example Source: https://docs.sequencehq.com/reference/latest/invoices/void-a-credit-note Example of merchant details including payment information and custom fields. ```json { "accountNumber": "12345678", "usAchDetails": { "accountNumber": "12345678", "accountName": "John Doe", "bankName": "Chase", "bankRoutingNumber": "123456789" }, "usWireDetails": { "accountNumber": "12345678", "accountName": "John Doe", "bankName": "Chase", "bankRoutingNumber": "123456789", "swiftCode": "CHASUS33", "bankAddress": { "line1": "JP Morgan Chase", "town": "New York City", "state": "NY", "postcode": "10017", "country": "US" } }, "caBankAccountDetails": { "transitNumber": "123", "institutionNumber": "12345", "accountNumber": "1234567" }, "canadianInternationalDestination": { "legalName": "John Doe", "accountNumber": "12345678", "transitNumber": "123", "bankName": "Chase", "bankAddress": { "line1": "JP Morgan Chase", "town": "New York City", "state": "NY", "postcode": "10017", "country": "US" }, "institutionNumber": "123", "swiftCode": "CHASUS33", "intermediaryBank": { "bankName": "Chase", "bankAddress": { "line1": "JP Morgan Chase", "town": "New York City", "state": "NY", "postcode": "10017", "country": "US" }, "swiftCode": "CHASUS33", "routingNumber": "123456789" } }, "australianDestination": { "legalName": "John Doe", "accountNumber": "12345678", "swiftCode": "CHASUS33", "bsb": "123456" }, "swedishBankgiroDestination": { "bankgiroNumber": "123-4567", "accountName": "The Merchant" }, "logoUrl": "logo", "legalCompanyName": "The Merchant", "primaryColour": "#000000", "customFields": [ { "key": "example-label", "value": "label-value" } ], "includeBeneficiaryAddressInPaymentDetails": false } ``` -------------------------------- ### Set Up Webhooks Source: https://docs.sequencehq.com/llms.txt Learn how to set up webhooks in Sequence. ```APIDOC ## Set Up Webhooks ### Description Learn how to set up webhooks in Sequence. ### Steps 1. **Navigate to Webhooks Settings**: In your Sequence dashboard, go to Settings > Webhooks. 2. **Add New Webhook**: Click the 'Add Webhook' button. 3. **Enter URL**: Provide the HTTPS URL where Sequence should send webhook events. 4. **Select Events**: Choose the specific events you want to subscribe to. 5. **Set Secret**: Generate and enter a webhook secret. This will be used to sign the requests. 6. **Save**: Save your webhook configuration. Sequence will then start sending events to your specified URL. Remember to implement signature verification on your endpoint to ensure the authenticity of incoming requests. ``` -------------------------------- ### Update Billing Schedule Request Example Source: https://docs.sequencehq.com/reference/latest/billing/update-billing-schedule Provides an example of the request body for updating a billing schedule. This includes details like start and end dates, recurrence, tax rates, and phase-specific information. ```json { "startDate": "2022-01-01", "endDate": "2022-12-01", "recurrenceDayOfMonth": 1, "taxRates": [ { "priceId": "bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730", "taxRateId": "50c0d53b-8460-41e6-b4e9-a4e157fc1a64" } ], "autoIssueInvoices": true, "purchaseOrderNumber": "PO123", "rollUpBilling": false, "phases": [ { "priceIds": [ "bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730" ], "startDate": "2022-01-01", "endDate": "2022-12-01", "discounts": [], "minimums": [], "listPriceIds": [ "b4d7e884-e007-4183-8355-4771865c5100" ], "recurrencePreference": "CONTINUE_FROM_PREVIOUS_PHASE", "phasePriceMetadata": [ { "priceId": "6dc54805-0ac8-4f17-9341-4d3f2db9dcd8", "arrCalculation": "INCLUDE" } ], "phaseListPriceMetadata": [ { "listPriceId": "b4d7e884-e007-4183-8355-4771865c5100", "arrCalculation": "INCLUDE" } ] } ], "attachmentAssetIds": [ "5055cd17-d5e8-4286-bddf-79729ddabf51" ], "defaultDueDateDays": 30, "memo": "Example Billing Schedule", "customFields": { "key": "value" } } ``` -------------------------------- ### OpenAPI Specification for Get Billing Schedule Payment Settings Source: https://docs.sequencehq.com/reference/latest/collections/get-billing-schedule-payment-settings This OpenAPI specification defines the GET endpoint for retrieving billing schedule payment settings. It includes request parameters, response schemas, and example payloads for successful and error responses. ```yaml collections.latest.product.live GET /payments/settings/billing-schedules/{id} openapi: 3.0.0 info: title: Collections description: Manage Payment Collection Settings version: '0.1' servers: - url: https://dev.seqhq.io/api description: DEV - url: https://sandbox.sequencehq.com/api description: SANDBOX - url: https://eu.sequencehq.com/api description: PRODUCTION security: [] tags: [] paths: /payments/settings/billing-schedules/{id}: servers: [] parameters: [] get: tags: - Billing Schedules summary: Get billing schedule payment settings description: >- Get payment settings for billing schedules. Invoices for billing schedules with payment settings contain payment links. If payment details are on file with Stripe or other payment providers, then payments are automatically collected when you finalise and send an invoice. Billing schedule payment settings override customer payment settings. You can also override billing schedule payment settings with invoice payment settings. operationId: getPaymentsSettingsBillingSchedulesById parameters: - name: id in: path description: Unique settings ID required: true schema: type: string - name: Authorization in: header description: >- Your [API credentials](/reference/authentication). Eg. `Basic {credentials}`. required: true schema: type: string - name: Sequence-Version in: header description: Use this header to select an API version required: false schema: type: string enum: - '2024-07-30' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/BillingScheduleSettings' example: id: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 sequenceAccountId: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 billingScheduleId: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 paymentProvider: STRIPE autoCharge: true examples: BillingScheduleSettings: summary: '' value: id: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 sequenceAccountId: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 billingScheduleId: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 paymentProvider: STRIPE autoCharge: true '400': description: Bad Request content: {} '401': description: Unauthorized content: {} '500': description: Internal Server Error content: {} components: schemas: BillingScheduleSettings: required: - autoCharge - billingScheduleId - id - paymentProvider - sequenceAccountId type: object example: id: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 sequenceAccountId: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 billingScheduleId: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 paymentProvider: STRIPE autoCharge: true properties: id: type: string description: Unique payment provider ID. example: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 sequenceAccountId: type: string description: Unique Sequence Account ID. example: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 billingScheduleId: type: string description: Unique payment provider ID. example: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 paymentProvider: $ref: '#/components/schemas/PaymentProvider' description: Payment provider autoCharge: type: boolean description: Automatically collect payments if payment details are available example: true PaymentProvider: type: string example: STRIPE enum: - STRIPE - GOCARDLESS - NONE ``` -------------------------------- ### List All Billing Schedules Response Example Source: https://docs.sequencehq.com/reference/latest/billing/list-all-billing-schedules This example shows the structure of a successful response when listing billing schedules. It includes detailed information about each schedule, its prices, phases, and associated metadata. ```json { "items": [ { "id": "b102e007-f5d7-4b1a-8a1d-9a51135ae73b", "customerId": "cca32597-b6b0-4499-9669-128aef8702e4", "status": "ACTIVE", "startDate": "2022-01-01", "endDate": "2022-12-01", "taxRates": [ { "priceId": "bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730", "taxRateId": "50c0d53b-8460-41e6-b4e9-a4e157fc1a64" } ], "firstBillingDate": "2022-02-02", "autoIssueInvoices": false, "purchaseOrderNumber": "PO123", "reference": "ref", "label": "label", "recurrenceDayOfMonth": 1, "prices": [ { "id": "bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730", "productId": "f409d651-c475-4142-aafd-a5d2bd74d4f9", "name": "Demo Product", "currency": "GBP", "structure": { "pricePerUnit": "0.25", "usageMetricId": "04c62961-04ba-48e6-b985-758bb7d3e712", "isPricePercentage": false, "pricingType": "LINEAR" }, "billingFrequency": "MONTHLY", "billingType": "IN_ARREARS", "createdAt": "2022-06-28T16:47:00Z", "updatedAt": "2022-06-28T16:47:00Z", "integrationIds": [], "customMetricParameters": [ { "parameterId": "94703530-1293-479b-bd37-ccad42fd9c8b", "value": "10" } ], "listPriceId": "b4d7e884-e007-4183-8355-4771865c5100", "status": "ACTIVE" } ], "createdAt": "2022-06-28T16:47:00Z", "updatedAt": "2022-06-28T16:47:00Z", "lastInvoiceId": "bdbf78a5-b007-4d46-aa7d-d0417a649d64", "phases": [ { "id": "6dc54805-0ac8-4f17-9341-4d3f2db9dcd8", "name": "Onboarding", "createdAt": "2022-06-28T16:47:00Z", "billingScheduleId": "b102e007-f5d7-4b1a-8a1d-9a51135ae73b", "priceIds": [ "6dc54805-0ac8-4f17-9341-4d3f2db9dcd8" ], "startDate": "2022-01-01", "endDate": "2022-06-30", "discounts": [ { "id": "4451f62c-0c1f-491c-aeb2-9eb41b28149c", "restrictToPrices": [ "6dc54805-0ac8-4f17-9341-4d3f2db9dcd8" ], "type": "PERCENTAGE", "amount": 15, "message": "15% Discount", "separateLineItem": true, "seatDiscountType": "ALL_SEATS" } ], "minimums": [ { "id": "6dc54805-0ac8-4f17-9341-4d3f2db9dcd8", "sequenceAccountId": "c4602d51-0fb4-4b48-b689-6ba28f540d1e", "billingScheduleId": "b102e007-f5d7-4b1a-8a1d-9a51135ae73b", "phaseId": "6dc54805-0ac8-4f17-9341-4d3f2db9dcd8", "amount": 100, "restrictToPrices": [ "6dc54805-0ac8-4f17-9341-4d3f2db9dcd8" ], "createdAt": "2022-06-28T16:47:00Z", "updatedAt": "2022-06-28T16:47:00Z" } ], "recurrencePreference": "CONTINUE_FROM_PREVIOUS_PHASE", "phasePriceMetadata": [ { "priceId": "6dc54805-0ac8-4f17-9341-4d3f2db9dcd8", "arrCalculation": "INCLUDE" } ] } ], "archivedAt": "2022-06-28T16:47:00Z", "rollUpBilling": false, "integrationIds": [ { "service": "Salesforce", "id": "a0CQy00000Ipz5VMAR", "lastSynced": "2024-08-14T17:14:17Z", "url": "https://sequence-b-dev-ed.develop.my.salesforce.com/lightning/r/sequence__Billing_Schedule__c/a0CQy00000Ipz5VMAR/view", "isPending": false } ], "attachmentAssets": [ { "id": "e007e884-5100-4183-8355-4771865cb4dd" } ] } ], "after": "MDE4NDUyNjYtNmQ2NC03N2M4LTlhZGYtNDQ4N2Q5NGQxNDU3", "before": "MDE4NDQyMWUtYTljYy03MTFiLWFmOTMtYmYwNTExZDRkODMz", "totalResultSize": 10 } ``` -------------------------------- ### Sequence User Response Example Source: https://docs.sequencehq.com/reference/latest/account/get-a-user This example shows the structure of a successful response when retrieving user information. It includes user ID, email, associated account IDs, state, and roles with their associated permissions. ```json { "id": "7b1f28b9-a4ad-450b-a0ea-fd647d5109b2", "email": "person@example.com", "sequenceAccountIds": [ "724c4f93-8606-4a38-bfbf-50a7045e4eaa" ], "state": "active", "roles": [ { "roleName": "salesUser", "permissions": [ { "resource": "org.customer", "actions": [ "create", "read", "update", "delete", "archive" ] }, { "resource": "org.billing", "actions": [ "read" ] }, { "resource": "org.product", "actions": [ "read" ] }, { "resource": "org.quote", "actions": [ "create", "read", "update", "delete", "archive", "publish", "accept" ] }, { "resource": "org.invoice", "actions": [ "read" ] }, { "resource": "org.creditNote", "actions": [ "read" ] }, { "resource": "org.usage", "actions": [ "read" ] }, { "resource": "org.revenueRecognition", "actions": [ "read" ] } ] } ] } ``` -------------------------------- ### Get Invoice Payment Settings by Invoice ID (OpenAPI) Source: https://docs.sequencehq.com/reference/latest/collections/get-invoice-payment-settings-by-invoice-id This OpenAPI definition describes the GET request to retrieve payment settings for a given invoice ID. It specifies the endpoint, parameters, and expected responses, including example data for a successful retrieval. ```yaml collections.latest.product.live GET /payments/settings/invoices/for-invoice/{id} openapi: 3.0.0 info: title: Collections description: Manage Payment Collection Settings version: '0.1' servers: - url: https://dev.seqhq.io/api description: DEV - url: https://sandbox.sequencehq.com/api description: SANDBOX - url: https://eu.sequencehq.com/api description: PRODUCTION security: [] tags: [] paths: /payments/settings/invoices/for-invoice/{id}: servers: [] parameters: [] get: tags: - Invoices summary: Get invoice payment settings by invoice ID description: >- Get payment settings for invoices by invoice ID. Invoices with payment settings contain payment links. If payment details are on file with Stripe or other payment providers, then payments are automatically collected when you finalise and send an invoice. Invoice payment settings override billing schedule payment settings and customer payment settings. operationId: getPaymentsSettingsInvoicesForInvoiceById parameters: - name: id in: path description: Unique invoice ID required: true schema: type: string - name: Authorization in: header description: >- Your [API credentials](/reference/authentication). Eg. `Basic {credentials}`. required: true schema: type: string - name: Sequence-Version in: header description: Use this header to select an API version required: false schema: type: string enum: - '2024-07-30' responses: '200': description: OK content: application/json: schema: $ref: >- #/components/schemas/GetByInvoiceIdProductGetInvoiceSettingsResponseModel example: id: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 sequenceAccountId: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 invoiceId: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 paymentProvider: STRIPE examples: GetByInvoiceIdProductGetInvoiceSettingsResponseModel: summary: '' value: id: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 sequenceAccountId: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 invoiceId: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 paymentProvider: STRIPE '400': description: Bad Request content: {} '401': description: Unauthorized content: {} '500': description: Internal Server Error content: {} components: schemas: GetByInvoiceIdProductGetInvoiceSettingsResponseModel: required: - id - invoiceId - paymentProvider - sequenceAccountId type: object example: id: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 sequenceAccountId: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 invoiceId: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 paymentProvider: STRIPE properties: id: type: string description: Unique payment provider id. example: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 sequenceAccountId: type: string description: Sequence Account ID. example: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 invoiceId: type: string description: Invoice ID. example: bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730 paymentProvider: $ref: '#/components/schemas/PaymentProvider' description: Sequence Account ID. PaymentProvider: type: string example: STRIPE enum: - STRIPE - GOCARDLESS - NONE ``` -------------------------------- ### Full Working Webhook Server Example Source: https://docs.sequencehq.com/reference/webhooks This TypeScript example demonstrates how to set up an Express.js server to receive and verify Sequence webhook signatures. It requires 'express' and 'crypto' modules. Ensure your webhook secret is correctly configured. ```typescript #!/usr/bin/env tsx const express = require("express"); const cryptoModule = require("crypto"); // Your webhook secret (from webhooks settings in the Sequence dashboard) const WEBHOOK_SECRET = "YOUR_WEBHOOK_SECRET"; const PORT = 8080; const app = express(); function verifyWebhookSignature(payloadBytes: Buffer, signatureHeader: string, secret: string): boolean { const payloadString = payloadBytes.toString("utf-8"); const parts = signatureHeader.split(","); const timestampPart = parts.find((p: string) => p.startsWith("t=")); const signaturePart = parts.find((p: string) => p.startsWith("s=")); if (!timestampPart || !signaturePart) return false; const timestamp = timestampPart.substring(2); const signatureFromHeader = signaturePart.substring(2); const dataToSign = `${timestamp}.${payloadString}`; const expectedSignature = cryptoModule .createHmac("sha256", secret) .update(dataToSign, "utf8") .digest("hex"); const signatureBuffer = Buffer.from(signatureFromHeader, "hex"); const expectedBuffer = Buffer.from(expectedSignature, "hex"); if (signatureBuffer.length !== expectedBuffer.length) return false; return cryptoModule.timingSafeEqual(signatureBuffer, expectedBuffer); } // Ensure webhook handler receives the raw bytes via express.raw() app.use("/webhook", express.raw({ type: "application/json" })); app.post("/webhook", (req: any, res: any) => { const payloadBytes: Buffer = req.body; const signatureHeader = req.headers["sequence-signature"] as string; if (!payloadBytes?.length || !signatureHeader) { return res.status(400).send("Bad Request"); } if (verifyWebhookSignature(payloadBytes, signatureHeader, WEBHOOK_SECRET)) { console.log("Webhook verified."); return res.status(200).send("OK"); } else { console.log("Verification failed."); return res.status(403).send("Verification failed"); } }); app.listen(PORT, "0.0.0.0", () => { console.log(`Webhook server listening on http://0.0.0.0:${PORT}/webhook`); }); ``` -------------------------------- ### List Credit Grants for a Customer (OpenAPI) Source: https://docs.sequencehq.com/reference/latest/billing/list-credit-grants-for-a-customer This OpenAPI definition describes the GET request to list credit grants for a customer. It specifies the endpoint, parameters, and response structure, including example data. ```yaml openapi: 3.0.0 info: title: Billing description: Manage Billing version: '0.1' servers: - url: https://dev.seqhq.io/api description: DEV - url: https://sandbox.sequencehq.com/api description: SANDBOX - url: https://eu.sequencehq.com/api description: PRODUCTION security: [] tags: [] paths: /credits/{customerId}/grants: servers: [] parameters: [] get: tags: - Credits summary: List Credit Grants for a customer description: >- List all Credit Grants and their outstanding balances where the balance is non-zero operationId: getCreditsByCustomerIdGrants parameters: - name: customerId in: path description: Customer ID required: true schema: type: string - name: Authorization in: header description: >- Your [API credentials](/reference/authentication). Eg. `Basic {credentials}`. required: true schema: type: string - name: Sequence-Version in: header description: Use this header to select an API version required: false schema: type: string enum: - '2024-07-30' responses: '200': description: OK content: application/json: schema: $ref: >- #/components/schemas/ListCreditGrantsForCustomerEndpointCreditGrantsResponse example: items: - id: 22efb229-c474-407c-bbf7-f5e113ee8b20 name: API Calls grantAmount: 1000 balance: 324 issueDate: '2022-02-22' expiryDate: '2030-03-03' examples: ListCreditGrantsForCustomerEndpointCreditGrantsResponse: summary: '' value: items: - id: 22efb229-c474-407c-bbf7-f5e113ee8b20 name: API Calls grantAmount: 1000 balance: 324 issueDate: '2022-02-22' expiryDate: '2030-03-03' '400': description: Bad Request content: {} '401': description: Unauthorized content: {} '500': description: Internal Server Error content: {} components: schemas: ListCreditGrantsForCustomerEndpointCreditGrantsResponse: required: - items type: object example: items: - id: 22efb229-c474-407c-bbf7-f5e113ee8b20 name: API Calls grantAmount: 1000 balance: 324 issueDate: '2022-02-22' expiryDate: '2030-03-03' properties: items: type: array description: Credit Grants example: - id: 22efb229-c474-407c-bbf7-f5e113ee8b20 name: API Calls grantAmount: 1000 balance: 324 issueDate: '2022-02-22' expiryDate: '2030-03-03' items: $ref: >- #/components/schemas/ListCreditGrantsForCustomerEndpointCreditGrantResponseItem ListCreditGrantsForCustomerEndpointCreditGrantResponseItem: required: - balance - grantAmount - id - issueDate - name type: object example: id: 22efb229-c474-407c-bbf7-f5e113ee8b20 name: API Calls grantAmount: 1000 balance: 324 issueDate: '2022-02-22' expiryDate: '2030-03-03' properties: id: type: string description: Credit Grant ID example: 22efb229-c474-407c-bbf7-f5e113ee8b20 name: type: string description: Credit Grant Name example: API Calls grantAmount: type: number description: Amount of Credits Granted example: 1000 balance: type: number description: Amount remaining of Credits Granted example: 324 issueDate: type: string description: Grant Issue Date format: date example: '2022-02-22' expiryDate: type: string description: Grant Expiry Date format: date example: '2030-03-03' ``` -------------------------------- ### Product Creation Response Source: https://docs.sequencehq.com/seats/api-guide Example JSON response after successfully creating a product. It includes the unique ID and details of the created product. ```json { "id": "c7326e0d-d2fb-434e-ae8f-f5ae6142a476", "name": "Example product", "label": "Example product", "createdAt": "2024-05-02T14:26:48.63792Z", "updatedAt": "2024-05-02T14:26:48.637932Z" } ``` -------------------------------- ### OpenAPI Specification for Calculate Usage Metric Source: https://docs.sequencehq.com/reference/latest/usage/calculate-usage-metric-for-customer-and-timeframe This OpenAPI 3.0.0 specification defines the GET /usage-metrics/{usageMetricId}/calculate endpoint. It includes details on request parameters such as usageMetricId, Authorization, customerAliases, periodStart, periodEnd, and optional customParameters. The response schema 'UsageMetricCalculationResponse' is also defined, along with example responses for successful requests and error codes. ```yaml openapi: 3.0.0 info: title: Usage description: Manage usage events and metrics version: '0.1' servers: - url: https://dev.seqhq.io/api description: DEV - url: https://sandbox.sequencehq.com/api description: SANDBOX - url: https://eu.sequencehq.com/api description: PRODUCTION security: [] tags: [] paths: /usage-metrics/{usageMetricId}/calculate: servers: [] parameters: [] get: tags: - Usage Metrics summary: Calculate usage metric for customer and timeframe description: Calculate usage metric for customer and timeframe operationId: getUsageMetricsByUsageMetricIdCalculate parameters: - name: usageMetricId in: path description: Usage Metric ID required: true schema: type: string - name: Authorization in: header description: >- Your [API credentials](/reference/authentication). Eg. `Basic {credentials}`. required: true schema: type: string - name: customerAliases in: query description: Customer Aliases / internal IDs required: true schema: type: string - name: periodStart in: query description: Billing period start required: true schema: type: string - name: periodEnd in: query description: Billing period end (inclusive) required: true schema: type: string - name: customParameters in: query description: Custom parameter values required: false schema: type: string - name: Sequence-Version in: header description: Use this header to select an API version required: false schema: type: string enum: - '2024-07-30' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/UsageMetricCalculationResponse' example: name: total_messages_sent metricType: GROUPED eventType: message_sent aggregationType: SUM eventCount: 5 value: 150.035 unit: bytes minEventId: 0183d0f1-6b5a-74d4-9129-1f4b90191666 maxEventId: 0183ea03-aca0-7019-b80d-6aacce344e92 examples: UsageMetricCalculationResponse: summary: '' value: name: total_messages_sent metricType: GROUPED eventType: message_sent aggregationType: SUM eventCount: 5 value: 150.035 unit: bytes minEventId: 0183d0f1-6b5a-74d4-9129-1f4b90191666 maxEventId: 0183ea03-aca0-7019-b80d-6aacce344e92 '400': description: Bad Request content: {} '401': description: Unauthorized content: {} '500': description: Internal Server Error content: {} components: schemas: UsageMetricCalculationResponse: required: - aggregationType - eventCount - eventType - metricType - name - value type: object example: name: total_messages_sent metricType: GROUPED eventType: message_sent aggregationType: SUM eventCount: 5 value: 150.035 unit: bytes minEventId: 0183d0f1-6b5a-74d4-9129-1f4b90191666 maxEventId: 0183ea03-aca0-7019-b80d-6aacce344e92 properties: name: type: string example: total_messages_sent metricType: $ref: '#/components/schemas/MetricType' eventType: type: string example: message_sent aggregationType: $ref: '#/components/schemas/AggregationType' eventCount: type: integer example: 5 value: type: number example: 150.035 unit: type: string example: bytes minEventId: type: string example: 0183d0f1-6b5a-74d4-9129-1f4b90191666 maxEventId: type: string example: 0183ea03-aca0-7019-b80d-6aacce344e92 MetricType: type: string example: GROUPED enum: - SIMPLE - GROUPED AggregationType: type: string example: COUNT enum: - COUNT - UNIQUE - SUM - CUSTOM ``` -------------------------------- ### Create Credit Grant Request Example Source: https://docs.sequencehq.com/reference/latest/billing/create-a-new-credit-grant This example shows the structure of a request to create a new credit grant. It includes details such as account ID, customer ID, credit details, and invoicing options. ```yaml sequenceAccountId: dce9ae85-d8d0-42b4-bcad-f221a64363c6 customerId: 61b083e0-1faa-47ca-9aeb-6205da8f6c47 name: Onboarding Credits creditUnitType: CURRENCY currency: GBP metricId: f092246c-6b90-4106-bcca-304ccf06bf45 amount: 10 costOfCredit: 10 effectiveDate: '2023-01-01' expiryDate: '2023-01-31' createInvoice: true ``` -------------------------------- ### Create Billing Schedule Request Example Source: https://docs.sequencehq.com/reference/latest/billing/create-billing-schedule This example demonstrates the structure of a request body for creating a billing schedule. It includes details such as customer ID, date ranges, recurrence, tax rates, discounts, and payment provider. ```json { "customerId": "cca32597-b6b0-4499-9669-128aef8702e4", "startDate": "2022-01-01", "endDate": "2022-12-31", "recurrenceDayOfMonth": 1, "taxRates": [ { "priceId": "bc61d4b8-e9d6-4f4a-9bcf-f5dae874c730", "taxRateId": "50c0d53b-8460-41e6-b4e9-a4e157fc1a64" } ], "autoIssueInvoices": false, "purchaseOrderNumber": "PO123", "reference": "Example reference", "label": "Example label", "paymentProvider": "STRIPE", "isDraft": true, "rollUpBilling": false, "phases": [ { "name": "Trial Period", "priceIds": [ "6dc54805-0ac8-4f17-9341-4d3f2db9dcd8" ], "startDate": "2022-01-01", "endDate": "2022-06-30", "discounts": [ { "restrictToPrices": [ "6dc54805-0ac8-4f17-9341-4d3f2db9dcd8" ], "type": "PERCENTAGE", "amount": 8, "message": "8% Discount", "separateLineItem": true, "seatDiscountType": "ALL_SEATS" } ], "minimums": [ { "restrictToPrices": [ "9fe9986b-e205-42b7-a58f-42845c91f03f" ], "amount": 100 } ], "listPriceIds": [ "45e16eb7-2170-4632-b04f-9ecd90b85b1e" ], "recurrencePreference": "CONTINUE_FROM_PREVIOUS_PHASE", "phasePriceMetadata": [ { "priceId": "6dc54805-0ac8-4f17-9341-4d3f2db9dcd8", "arrCalculation": "INCLUDE" } ], "phaseListPriceMetadata": [ { "listPriceId": "45e16eb7-2170-4632-b04f-9ecd90b85b1e", "arrCalculation": "INCLUDE" } ] }, { "priceIds": [], "startDate": "2022-07-01", "endDate": "2022-12-31", "discounts": [], "minimums": [ { "restrictToPrices": [ "9fe9986b-e205-42b7-a58f-42845c91f03f" ], "amount": 100 } ], "listPriceIds": [ "45e16eb7-2170-4632-b04f-9ecd90b85b1e" ], "recurrencePreference": "CONTINUE_FROM_PREVIOUS_PHASE", "phasePriceMetadata": [ { "priceId": "6dc54805-0ac8-4f17-9341-4d3f2db9dcd8", "arrCalculation": "INCLUDE" } ], "phaseListPriceMetadata": [ { "listPriceId": "45e16eb7-2170-4632-b04f-9ecd90b85b1e", "arrCalculation": "INCLUDE" } ] } ], "attachmentAssetIds": [ "5055cd17-d5e8-4286-bddf-79729ddabf51" ], "autoCharge": true, "defaultDueDateDays": 30, "memo": "Example Billing Schedule", "customFields": { "key": "value" } } ``` -------------------------------- ### Notification Type Example Source: https://docs.sequencehq.com/reference/latest/notifications/remove-a-notification-type-from-a-policy An example of a single notification type. ```json CUSTOMER_CREATED ``` -------------------------------- ### Example Usage Event Structure Source: https://docs.sequencehq.com/metrics-events/usage-events This is a standard structure for a usage event in Sequence. It captures details about a customer's interaction with your product. ```json { "eventType": "transaction_processed", "customerAlias": "customer-id-2H4u5BBwBWsS5V2sroRFqJfTXpW", "eventTimestamp": "2022-10-01T00:00:00Z", "customerEventId": "event-id-H4twuTWpYx1rkd8OMTki2hTUcZ", "eventProperties": { "amount": 500, "currency": "GBP", "method": "bank_transfer" } } ```