Customers
Update a Customer
Update a customer’s details, or archive them.
PUT
/
v1
/
customers
/
{id}
Update or archive a customer
curl --request PUT \
--url https://billing.example.com/v1/customers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"email": "jsmith@example.com",
"phone": "<string>",
"tax_id": "<string>",
"gstin": "<string>",
"place_of_supply": "<string>",
"tax_exempt": true,
"tax_exemption_number": "<string>",
"tax_exemption_code": "<string>",
"tax_exemption_expires_at": "2023-12-25",
"line1": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country": "<string>",
"active": true
}
'import requests
url = "https://billing.example.com/v1/customers/{id}"
payload = {
"name": "<string>",
"email": "jsmith@example.com",
"phone": "<string>",
"tax_id": "<string>",
"gstin": "<string>",
"place_of_supply": "<string>",
"tax_exempt": True,
"tax_exemption_number": "<string>",
"tax_exemption_code": "<string>",
"tax_exemption_expires_at": "2023-12-25",
"line1": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country": "<string>",
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
email: 'jsmith@example.com',
phone: '<string>',
tax_id: '<string>',
gstin: '<string>',
place_of_supply: '<string>',
tax_exempt: true,
tax_exemption_number: '<string>',
tax_exemption_code: '<string>',
tax_exemption_expires_at: '2023-12-25',
line1: '<string>',
city: '<string>',
state: '<string>',
zip: '<string>',
country: '<string>',
active: true
})
};
fetch('https://billing.example.com/v1/customers/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/v1/customers/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'email' => 'jsmith@example.com',
'phone' => '<string>',
'tax_id' => '<string>',
'gstin' => '<string>',
'place_of_supply' => '<string>',
'tax_exempt' => true,
'tax_exemption_number' => '<string>',
'tax_exemption_code' => '<string>',
'tax_exemption_expires_at' => '2023-12-25',
'line1' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zip' => '<string>',
'country' => '<string>',
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/v1/customers/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\",\n \"tax_id\": \"<string>\",\n \"gstin\": \"<string>\",\n \"place_of_supply\": \"<string>\",\n \"tax_exempt\": true,\n \"tax_exemption_number\": \"<string>\",\n \"tax_exemption_code\": \"<string>\",\n \"tax_exemption_expires_at\": \"2023-12-25\",\n \"line1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"country\": \"<string>\",\n \"active\": true\n}")
req, _ := http.NewRequest("PUT", 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))
}HttpResponse<String> response = Unirest.put("https://billing.example.com/v1/customers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\",\n \"tax_id\": \"<string>\",\n \"gstin\": \"<string>\",\n \"place_of_supply\": \"<string>\",\n \"tax_exempt\": true,\n \"tax_exemption_number\": \"<string>\",\n \"tax_exemption_code\": \"<string>\",\n \"tax_exemption_expires_at\": \"2023-12-25\",\n \"line1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"country\": \"<string>\",\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/customers/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\",\n \"tax_id\": \"<string>\",\n \"gstin\": \"<string>\",\n \"place_of_supply\": \"<string>\",\n \"tax_exempt\": true,\n \"tax_exemption_number\": \"<string>\",\n \"tax_exemption_code\": \"<string>\",\n \"tax_exemption_expires_at\": \"2023-12-25\",\n \"line1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"country\": \"<string>\",\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "jsmith@example.com",
"name": "<string>",
"phone": "<string>",
"tax_id": "<string>",
"billing_address": {
"line1": "<string>",
"line2": "<string>",
"postal_code": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country": "<string>"
},
"ledger_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"gstin": "<string>",
"tax_type": "<string>",
"place_of_supply": "<string>",
"tax_exempt": true,
"tax_exemption_number": "<string>",
"tax_exemption_code": "<string>",
"tax_exemption_expires_at": "2023-12-25",
"referral_code": "<string>",
"risk_score": 50,
"risk_factors": {},
"card_brand": "<string>",
"card_last4": "<string>",
"card_exp_month": 123,
"card_exp_year": 123,
"card_token_id": "<string>",
"card_fingerprint": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}Example request
curl -X PUT https://api.recurso.dev/v1/customers/9f2c1e84-6a3d-4b7e-9c21-8f4a5d6e7b01 \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "finance@acme.com",
"billing_address": {
"line1": "123 MG Road",
"city": "Bangalore",
"state": "Karnataka",
"postal_code": "560001",
"country": "IN"
}
}'
billing_address is accepted as a nested
alias for the flat address fields — a flat field wins when both are
supplied, and postal_code/zip are synonyms.
Errors
| Status | Code | When | Fix |
|---|---|---|---|
| 400 | validation_failed | id is not a valid UUID, or the request body is malformed JSON. | Pass the customer’s UUID and a valid JSON body. |
| 400 | validation_failed | tax_exemption_expires_at is not a valid date. | Use an ISO 8601 date (e.g. 2027-01-31). |
| 400 | validation_failed | A field failed service-side validation — notably deactivating (active: false) a customer who still has active subscriptions. | Cancel or migrate the customer’s subscriptions before archiving them. |
| 401 | unauthorized | API key missing or invalid (invalid_api_key), or a live/test mode mismatch (key_mode_mismatch). | Send Authorization: Bearer <api_key> with a key for the right mode. |
| 404 | not_found | No customer with that ID exists in your tenant. | Check the ID, and that the key belongs to the tenant that owns the customer. |
Authorizations
Tenant API key obtained from POST /auth/register or POST /v1/developer/keys.
Path Parameters
Body
application/json
Available options:
business, consumer US sales-tax exemption status (D2).
Exemption/resale certificate number.
Provider entity-use / usage code (also the reason).
Exemption certificate expiry (YYYY-MM-DD); empty/omitted = no expiry. Past this date the buyer is charged tax again (Inc 2).
Required string length:
2Response
Updated customer.
Show child attributes
Show child attributes
⌘I
Update or archive a customer
curl --request PUT \
--url https://billing.example.com/v1/customers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"email": "jsmith@example.com",
"phone": "<string>",
"tax_id": "<string>",
"gstin": "<string>",
"place_of_supply": "<string>",
"tax_exempt": true,
"tax_exemption_number": "<string>",
"tax_exemption_code": "<string>",
"tax_exemption_expires_at": "2023-12-25",
"line1": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country": "<string>",
"active": true
}
'import requests
url = "https://billing.example.com/v1/customers/{id}"
payload = {
"name": "<string>",
"email": "jsmith@example.com",
"phone": "<string>",
"tax_id": "<string>",
"gstin": "<string>",
"place_of_supply": "<string>",
"tax_exempt": True,
"tax_exemption_number": "<string>",
"tax_exemption_code": "<string>",
"tax_exemption_expires_at": "2023-12-25",
"line1": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country": "<string>",
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
email: 'jsmith@example.com',
phone: '<string>',
tax_id: '<string>',
gstin: '<string>',
place_of_supply: '<string>',
tax_exempt: true,
tax_exemption_number: '<string>',
tax_exemption_code: '<string>',
tax_exemption_expires_at: '2023-12-25',
line1: '<string>',
city: '<string>',
state: '<string>',
zip: '<string>',
country: '<string>',
active: true
})
};
fetch('https://billing.example.com/v1/customers/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/v1/customers/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'email' => 'jsmith@example.com',
'phone' => '<string>',
'tax_id' => '<string>',
'gstin' => '<string>',
'place_of_supply' => '<string>',
'tax_exempt' => true,
'tax_exemption_number' => '<string>',
'tax_exemption_code' => '<string>',
'tax_exemption_expires_at' => '2023-12-25',
'line1' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zip' => '<string>',
'country' => '<string>',
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/v1/customers/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\",\n \"tax_id\": \"<string>\",\n \"gstin\": \"<string>\",\n \"place_of_supply\": \"<string>\",\n \"tax_exempt\": true,\n \"tax_exemption_number\": \"<string>\",\n \"tax_exemption_code\": \"<string>\",\n \"tax_exemption_expires_at\": \"2023-12-25\",\n \"line1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"country\": \"<string>\",\n \"active\": true\n}")
req, _ := http.NewRequest("PUT", 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))
}HttpResponse<String> response = Unirest.put("https://billing.example.com/v1/customers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\",\n \"tax_id\": \"<string>\",\n \"gstin\": \"<string>\",\n \"place_of_supply\": \"<string>\",\n \"tax_exempt\": true,\n \"tax_exemption_number\": \"<string>\",\n \"tax_exemption_code\": \"<string>\",\n \"tax_exemption_expires_at\": \"2023-12-25\",\n \"line1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"country\": \"<string>\",\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/customers/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\",\n \"tax_id\": \"<string>\",\n \"gstin\": \"<string>\",\n \"place_of_supply\": \"<string>\",\n \"tax_exempt\": true,\n \"tax_exemption_number\": \"<string>\",\n \"tax_exemption_code\": \"<string>\",\n \"tax_exemption_expires_at\": \"2023-12-25\",\n \"line1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"country\": \"<string>\",\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "jsmith@example.com",
"name": "<string>",
"phone": "<string>",
"tax_id": "<string>",
"billing_address": {
"line1": "<string>",
"line2": "<string>",
"postal_code": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country": "<string>"
},
"ledger_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"gstin": "<string>",
"tax_type": "<string>",
"place_of_supply": "<string>",
"tax_exempt": true,
"tax_exemption_number": "<string>",
"tax_exemption_code": "<string>",
"tax_exemption_expires_at": "2023-12-25",
"referral_code": "<string>",
"risk_score": 50,
"risk_factors": {},
"card_brand": "<string>",
"card_last4": "<string>",
"card_exp_month": 123,
"card_exp_year": 123,
"card_token_id": "<string>",
"card_fingerprint": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}