Stykite
  1. Customer
Stykite
  • Introduction
    • What is Stykite?
    • Who should use Stykite?
    • When Stykite isn't the right fit?
    • Key Concepts
    • Pre-requisites: Account & API Keys
  • Getting Started
    • Setup your Tracking & Billing
    • Integrate Subscription Plans & Payments
    • Setup Payments
      • Configuring Razorpay Webhooks for Stykite
  • API Reference
    • 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
      • Customer
        • Create Customer with Auto Subscribe
          POST
        • Get Customer and Subscription Details
          GET
        • Update Customer Meter Entitlements
          PUT
      • Subscription
        • Create Subscription
        • Cancel Subscription
        • Update Subscription
      • Checkpoint
        • Track Checkpoint Usage API
  • Learning Stykite
    • Subscriptions & Plans
    • Add-ons
    • Pricing Versions
    • Manual Subscriptions & Exclusive Plans
    • Invoices
    • Payments
    • Sales Tax
    • Customers
    • Transactions & Refunds
    • Settings
  1. Customer

Create Customer with Auto Subscribe

POST
/v1/company/{companyId}/country/{countryId}/customer
This API endpoint allows you to create a new customer and automatically subscribe them to a specified plan in a single request. It simplifies the process by combining customer creation and subscription activation into one step.

Request Parameters#

Path Parameters:
company_id (string, required): The unique identifier of the company.
country_id (string, required): The unique identifier of the country.
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:
email (string, required): The email address of the customer.
customer_identifier (string, required): A unique identifier for the customer.
first_name (string): The first name of the customer.
last_name (string): The last name of the customer.
phone (string): The phone number of the customer.
country_code (string, required): The country code of the customer's location. ISO 3166-1 alpha-2 format. https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
state_code (string): The state code of the customer's location.
city (string): The city of the customer's location.
zipcode (string): The ZIP code of the customer's location. required if country_code is USA
trial_days (number): Use this parameter to specify custom trial days, overriding the default value.
plan_id (string): Use this parameter to specify auto assign plan on sign up, overriding the default value.

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Path Params

Header Params

Body Params application/json

Example
{
    "email": "onkar.kore@stykite.com",
    "customer_identifier": "{{CUSTOMER_IDENTIFIER}}",
    "first_name": "Onkar",
    "last_name": "Kore",
    "phone": 8149712450,
    "country_code": "IN",
    "state_code": "KA",
    "city": "Bangalore",
    "zipcode": 416013
}

Request Code 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' \
--header 'Authorization: Bearer <token>' \
--header 'content-type: application/json' \
--data-raw '{
    "email": "onkar.kore@stykite.com",
    "customer_identifier": "c56164ad-3d54-4eaa-ae3d-46fe3969972b",
    "first_name": "Onkar",
    "last_name": "Kore",
    "phone": 8149712450,
    "country_code": "IN",
    "state_code": "KA",
    "city": "Bangalore",
    "zipcode": 416013
}'

Responses

🟢200Example
application/json
Body

Example
{
    "status": true,
    "value": {
        "email": "onkar.kore@stykite.com",
        "firstName": "Onkar",
        "lastName": "Kore",
        "phone": "8149712450",
        "address": {
            "city": "Bangalore",
            "country": "India",
            "line1": null,
            "line2": null,
            "state": "Karnataka",
            "city_code": "Bangalore",
            "country_code": "IN",
            "postal_code": "416013",
            "state_code": "KA"
        },
        "tsid": "CUS-0G9HCNK3E4P1Y",
        "customer_identifier": "c56164ad-3d54-4eaa-ae3d-46fe3969972b",
        "created_at": 1717837601565,
        "updated_at": 1717837601565,
        "company_tsid": "COM-0FR3TQHKW0YBJ",
        "country_tsid": "CON-0AZZVPQHM475V"
    }
}
Modified at 2025-02-15 17:20:12
Previous
Send Usage
Next
Get Customer and Subscription Details
Built with