curl --request PATCH \
--url https://api.lava.so/v1/customers/{customer_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Jane Smith",
"email": "jane@example.com",
"phone": "+14155552671",
"reference_id": "usr_abc123",
"metadata": {
"plan_tier": "enterprise"
}
}
'import requests
url = "https://api.lava.so/v1/customers/{customer_id}"
payload = {
"name": "Jane Smith",
"email": "jane@example.com",
"phone": "+14155552671",
"reference_id": "usr_abc123",
"metadata": { "plan_tier": "enterprise" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Jane Smith',
email: 'jane@example.com',
phone: '+14155552671',
reference_id: 'usr_abc123',
metadata: {plan_tier: 'enterprise'}
})
};
fetch('https://api.lava.so/v1/customers/{customer_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://api.lava.so/v1/customers/{customer_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Jane Smith',
'email' => 'jane@example.com',
'phone' => '+14155552671',
'reference_id' => 'usr_abc123',
'metadata' => [
'plan_tier' => 'enterprise'
]
]),
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://api.lava.so/v1/customers/{customer_id}"
payload := strings.NewReader("{\n \"name\": \"Jane Smith\",\n \"email\": \"jane@example.com\",\n \"phone\": \"+14155552671\",\n \"reference_id\": \"usr_abc123\",\n \"metadata\": {\n \"plan_tier\": \"enterprise\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.lava.so/v1/customers/{customer_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Jane Smith\",\n \"email\": \"jane@example.com\",\n \"phone\": \"+14155552671\",\n \"reference_id\": \"usr_abc123\",\n \"metadata\": {\n \"plan_tier\": \"enterprise\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lava.so/v1/customers/{customer_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Jane Smith\",\n \"email\": \"jane@example.com\",\n \"phone\": \"+14155552671\",\n \"reference_id\": \"usr_abc123\",\n \"metadata\": {\n \"plan_tier\": \"enterprise\"\n }\n}"
response = http.request(request)
puts response.read_body{
"customer_id": "con_test_01EXAMPLE00000000000000001",
"reference_id": "usr_abc123",
"contact": {
"phone": "+14155552671",
"email": "user@example.com",
"first_name": "Jane",
"last_name": "Smith"
},
"subscription": {
"subscription_id": "<string>",
"plan_id": "<string>",
"name": "<string>"
},
"metadata": {
"plan_tier": "enterprise",
"internal_id": "12345"
},
"created_at": "2023-05-15T08:35:42Z"
}{
"error": {
"message": "Authorization header is required. Please include an 'Authorization' header with your request.",
"code": "auth_header_missing",
"status": 401
}
}{
"error": {
"message": "Customer not found.",
"code": "customer_not_found",
"status": 404
}
}{
"error": {
"message": "A customer with this reference_id already exists.",
"code": "reference_id_conflict",
"status": 409
}
}{
"error": {
"message": "An internal server error occurred while processing your request.",
"code": "rest_internal_server_error",
"status": 500
}
}Update customer
Update a customer by ID. Only provided fields are updated (partial update). Accepts either a Lava customer_id (con_xxx) or your reference_id.
curl --request PATCH \
--url https://api.lava.so/v1/customers/{customer_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Jane Smith",
"email": "jane@example.com",
"phone": "+14155552671",
"reference_id": "usr_abc123",
"metadata": {
"plan_tier": "enterprise"
}
}
'import requests
url = "https://api.lava.so/v1/customers/{customer_id}"
payload = {
"name": "Jane Smith",
"email": "jane@example.com",
"phone": "+14155552671",
"reference_id": "usr_abc123",
"metadata": { "plan_tier": "enterprise" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Jane Smith',
email: 'jane@example.com',
phone: '+14155552671',
reference_id: 'usr_abc123',
metadata: {plan_tier: 'enterprise'}
})
};
fetch('https://api.lava.so/v1/customers/{customer_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://api.lava.so/v1/customers/{customer_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Jane Smith',
'email' => 'jane@example.com',
'phone' => '+14155552671',
'reference_id' => 'usr_abc123',
'metadata' => [
'plan_tier' => 'enterprise'
]
]),
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://api.lava.so/v1/customers/{customer_id}"
payload := strings.NewReader("{\n \"name\": \"Jane Smith\",\n \"email\": \"jane@example.com\",\n \"phone\": \"+14155552671\",\n \"reference_id\": \"usr_abc123\",\n \"metadata\": {\n \"plan_tier\": \"enterprise\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.lava.so/v1/customers/{customer_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Jane Smith\",\n \"email\": \"jane@example.com\",\n \"phone\": \"+14155552671\",\n \"reference_id\": \"usr_abc123\",\n \"metadata\": {\n \"plan_tier\": \"enterprise\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lava.so/v1/customers/{customer_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Jane Smith\",\n \"email\": \"jane@example.com\",\n \"phone\": \"+14155552671\",\n \"reference_id\": \"usr_abc123\",\n \"metadata\": {\n \"plan_tier\": \"enterprise\"\n }\n}"
response = http.request(request)
puts response.read_body{
"customer_id": "con_test_01EXAMPLE00000000000000001",
"reference_id": "usr_abc123",
"contact": {
"phone": "+14155552671",
"email": "user@example.com",
"first_name": "Jane",
"last_name": "Smith"
},
"subscription": {
"subscription_id": "<string>",
"plan_id": "<string>",
"name": "<string>"
},
"metadata": {
"plan_tier": "enterprise",
"internal_id": "12345"
},
"created_at": "2023-05-15T08:35:42Z"
}{
"error": {
"message": "Authorization header is required. Please include an 'Authorization' header with your request.",
"code": "auth_header_missing",
"status": 401
}
}{
"error": {
"message": "Customer not found.",
"code": "customer_not_found",
"status": 404
}
}{
"error": {
"message": "A customer with this reference_id already exists.",
"code": "reference_id_conflict",
"status": 409
}
}{
"error": {
"message": "An internal server error occurred while processing your request.",
"code": "rest_internal_server_error",
"status": 500
}
}Authorizations
Bearer token authentication used for standard API calls. Format: 'Bearer YOUR_API_KEY'
Path Parameters
Customer ID (con_xxx) or your reference_id.
Body
Contact name for this customer.
255"Jane Smith"
Contact email for this customer.
"jane@example.com"
Contact phone in E.164 format.
"+14155552671"
Your external identifier for this customer.
255"usr_abc123"
Arbitrary key-value metadata. Set to null to clear.
{ "plan_tier": "enterprise" }
Response
Updated customer
Unique identifier for the customer
"con_test_01EXAMPLE00000000000000001"
Merchant's external identifier for this customer. Used for idempotent creation — POST with the same reference_id returns the existing customer.
"usr_abc123"
Show child attributes
Show child attributes
Active subscription summary, or null if none
Show child attributes
Show child attributes
Arbitrary key-value metadata stored on the customer. Set via PATCH.
{ "plan_tier": "enterprise", "internal_id": "12345" }
ISO 8601 timestamp when the customer was created
"2023-05-15T08:35:42Z"