Stykite
  1. Customer
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
      • Customer
        • Create Customer with Auto Subscribe
          POST
        • Get Customer and Subscription Details
          GET
      • 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. 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
companyId
string 
required
Example:
{{COMPANY_ID}}
countryId
string 
required
Example:
{{COUNTRY_ID}}
Header Params
Authorization
string 
required
Example:
Bearer {{AUTH_TOKEN}}
content-type
string 
required
Example:
application/json
Body Params application/json
email
string 
required
customer_identifier
string 
required
first_name
string 
required
last_name
string 
required
phone
integer 
required
country_code
string 
required
state_code
string 
required
city
string 
required
zipcode
integer 
required
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 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 eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJvbmthci5rb3JlQHN0eWtpdGUuY29tIiwiaWF0IjoxNzE1NzM2MzY1LCJleHAiOjQ4Mzk3ODc1NjV9.4-0nnrj9SQKmgIFvSnuASttviX1KlOj6YbgSb52ONNTU-emzJlGpQ1mk7ol1qUY1PFMOQmV_alrpKytPwcnGsg' \
--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
status
boolean 
required
value
object 
required
email
string 
required
firstName
string 
required
lastName
string 
required
phone
string 
required
address
object 
required
tsid
string 
required
customer_identifier
string 
required
created_at
integer 
required
updated_at
integer 
required
company_tsid
string 
required
country_tsid
string 
required
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