curl --request POST \
--url https://api.bachs.io/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jane@example.com",
"metadata": {
"plan": "pro"
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({email: 'jane@example.com', metadata: {plan: 'pro'}})
};
fetch('https://api.bachs.io/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.bachs.io/v1/customers"
payload = {
"email": "jane@example.com",
"metadata": { "plan": "pro" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bachs.io/v1/customers"
payload := strings.NewReader("{\n \"email\": \"jane@example.com\",\n \"metadata\": {\n \"plan\": \"pro\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"customer_id": "cust_1a2b3c4d5e6f7g8h",
"email": "ada@example.com",
"name": "Ada Lovelace",
"phone_number": "+2348012345678",
"metadata": {
"tier": "vip"
},
"billing_address": {
"line1": "40 Yaba Road",
"line2": null,
"city": "Lagos",
"state": "Lagos",
"postal_code": "101245",
"country": "NG"
},
"created_at": "2026-07-13T14:00:00.000Z",
"updated_at": "2026-07-13T14:00:00.000Z"
}{
"detail": "Invalid request parameters",
"error_code": "VALIDATION_ERROR",
"errors": [
{
"field": "amount",
"message": "Amount must be a positive decimal string",
"type": "value_error"
}
]
}{
"detail": "Invalid API key",
"error_code": "UNAUTHORIZED"
}{
"detail": "API key does not have permission for this operation",
"error_code": "FORBIDDEN"
}{
"detail": "Resource not found",
"error_code": "NOT_FOUND"
}{
"detail": "Rate limit exceeded. Please retry after a few seconds.",
"error_code": "TOO_MANY_REQUESTS"
}{
"detail": "An unexpected error occurred. Please try again later.",
"error_code": "INTERNAL_SERVER_ERROR"
}Create a customer
Creates a customer. A customer groups a buyer’s payments, subscriptions, and saved payment methods under one record. Only email is required. Requires the customers:write scope.
curl --request POST \
--url https://api.bachs.io/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jane@example.com",
"metadata": {
"plan": "pro"
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({email: 'jane@example.com', metadata: {plan: 'pro'}})
};
fetch('https://api.bachs.io/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.bachs.io/v1/customers"
payload = {
"email": "jane@example.com",
"metadata": { "plan": "pro" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bachs.io/v1/customers"
payload := strings.NewReader("{\n \"email\": \"jane@example.com\",\n \"metadata\": {\n \"plan\": \"pro\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"customer_id": "cust_1a2b3c4d5e6f7g8h",
"email": "ada@example.com",
"name": "Ada Lovelace",
"phone_number": "+2348012345678",
"metadata": {
"tier": "vip"
},
"billing_address": {
"line1": "40 Yaba Road",
"line2": null,
"city": "Lagos",
"state": "Lagos",
"postal_code": "101245",
"country": "NG"
},
"created_at": "2026-07-13T14:00:00.000Z",
"updated_at": "2026-07-13T14:00:00.000Z"
}{
"detail": "Invalid request parameters",
"error_code": "VALIDATION_ERROR",
"errors": [
{
"field": "amount",
"message": "Amount must be a positive decimal string",
"type": "value_error"
}
]
}{
"detail": "Invalid API key",
"error_code": "UNAUTHORIZED"
}{
"detail": "API key does not have permission for this operation",
"error_code": "FORBIDDEN"
}{
"detail": "Resource not found",
"error_code": "NOT_FOUND"
}{
"detail": "Rate limit exceeded. Please retry after a few seconds.",
"error_code": "TOO_MANY_REQUESTS"
}{
"detail": "An unexpected error occurred. Please try again later.",
"error_code": "INTERNAL_SERVER_ERROR"
}Authorizations
Bearer token authentication. Pass your API key as Authorization: Bearer sk_.... See Authentication for keys, scopes, and sandbox vs production.
Body
The customer's email address. Used to identify the customer and send receipts.
"jane@example.com"
The customer's full name. Derived from first_name and last_name when those are provided instead.
511"Jane Doe"
The customer's phone number in E.164 format, e.g. +2348012345678.
"+2348012345678"
Your own key-value data attached to the customer, returned unchanged.
{ "plan": "pro" }
The customer's billing address. Optional on create. line1 and country are required whenever an address is supplied; country must be a real ISO-3166-1 alpha-2 code. An all-empty object is rejected; omit the field or send null instead.
Show child attributes
Show child attributes
Response
Customer created
Unique identifier for the customer, prefixed with cust_.
"cust_1a2b3c4d5e6f"
The customer's email address.
"jane@example.com"
Your own key-value data attached to the customer.
{ "plan": "pro" }
ISO 8601 timestamp when the customer was created.
"2026-01-24T12:00:00.000Z"
ISO 8601 timestamp when the customer was last updated.
"2026-01-24T12:00:00.000Z"
The customer's full name. null when not set.
"Jane Doe"
The customer's phone number in E.164 format, e.g. +2348012345678.
"+2348012345678"
The customer's billing address, or null if none is set.
Show child attributes
Show child attributes

