Stykite
  1. Usage
Stykite
  • Introduction
  • Pre-requisites: Account & API Keys
  • Integration
    • Self-Serve Integration on your SaaS/AI App
    • Usage-Based Billing
    • Customer Facing Widgets
      • Pricing Widget Integration Guide
      • My Account Widget Integration
      • Subscribe Button
    • API Reference
      • Webhooks
        • Customer Subscription Status Update
        • Add-on Purchase Success
      • Usage
        • Send Usage
          POST
      • Customer
        • Create Customer with Auto Subscribe
        • Get Customer and Subscription Details
      • Subscription
        • Cancel Subscription
        • Update Subscription
  • Learning Stykite
    • Subscriptions & Plans
    • Add-ons
    • Pricing Versions
    • Manual Subscriptions & Exclusive Plans
    • Invoices
    • Payments
    • Sales Tax
    • Customers
    • Transactions & Refunds
    • Settings
  1. Usage

Send Usage

POST
/v1/company/{companyId}/country/{countryId}/customer/{customerIdentifier}/usage
This API endpoint allows you to send meter usage data for individual customers to the Stykite platform. The provided data will be used to generate invoices based on the recorded usage. This process ensures accurate billing and helps manage customer consumption effectively.

Request Parameters#

Path Parameters:
company_id (string, required): The unique identifier of the company.
country_id (string, required): The unique identifier of the country.
customer_identifier (string, required): A unique identifier for the customer.
Headers:
Authorization (string, required): The authorization token in the format Bearer .
Content-Type (string, required): The content type of the request, should be application/json.
Body Parameters:
An array of meter usage data objects.
timestamp (number, required): The timestamp of the meter reading.
meter_id (string, required): The unique identifier of the meter associated with the usage data.
qty (number, required): The quantity of usage recorded till timestamp.

Response#

Upon successful submission of the meter usage data, the API returns a response with status code 202 Accepted confirming the receipt of the data

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Path Params
companyId
string 
required
Example:
{{COMPANY_ID}}
countryId
string 
required
Example:
{{COUNTRY_ID}}
customerIdentifier
string 
required
Example:
{{CUSTOMER_IDENTIFIER}}
Header Params
Authorization
string 
required
Example:
Bearer {{AUTH_TOKEN}}
content-type
string 
required
Example:
application/json
Body Params application/json
array of:
timestamp
integer 
optional
meter_id
string 
optional
qty
integer 
optional
Example
[
    {
        "timestamp": 1697363618832,
        "meter_id": "MTR-0DWBEZWHFSBBQ",
        "qty": 26
    }
]

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location -g --request POST 'https://sandbox.api.stykite.com/v1/company/COM-0FR3TQHKW0YBJ/country/CON-0AZZVPQHM475V/customer/c56164ad-3d54-4eaa-ae3d-46fe3969972b/usage' \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJvbmthci5rb3JlQHN0eWtpdGUuY29tIiwiaWF0IjoxNzE1NzM2MzY1LCJleHAiOjQ4Mzk3ODc1NjV9.4-0nnrj9SQKmgIFvSnuASttviX1KlOj6YbgSb52ONNTU-emzJlGpQ1mk7ol1qUY1PFMOQmV_alrpKytPwcnGsg' \
--header 'content-type: application/json' \
--data-raw '[
    {
        "timestamp": 1697363618832,
        "meter_id": "MTR-0DWBEZWHFSBBQ",
        "qty": 26
    }
]'

Responses

🟢200Success
application/json
Body
object {0}
Example
{}
Modified at 2024-06-08 10:21:08
Previous
Add-on Purchase Success
Next
Create Customer with Auto Subscribe
Built with