Customers Update a customer
Update a customer
Updates the fields you send on one customer. The path `customer_id` selects the customer and replaces any `customer_id` in the body. Empty values change nothing, the customer type cannot change, and KYC status is not reset. The response does not include the customer. Get the customer to read the result.
Api-Key
Path parameters
NameDescription
customer_idThe customer to update. It replaces any
customer_id in the body.Body parameters
NameDescription
customer_idIgnored. The path
customer_id replaces any value you send.first_nameLetters, spaces, apostrophes and hyphens only.
middle_nameOptional. At most 40 characters. Letters, with single spaces, hyphens or apostrophes between them. A period or a digit is refused. Write the name without accents, as for
first_name. Gravv saves the value without leading or trailing spaces.last_nameLetters, spaces, apostrophes and hyphens only.
emailNew email. It must be unique in your tenant and use a company domain, for every customer type.
phoneA valid phone number in international format with a leading
+, such as +2348031234567. Fictional ranges such as +1 555-01xx are rejected.date_of_birthgenderPossible values:
male, female, otheraddressNew address. The state and country check runs only when you send both.
Show 6 child attributesobject
address_line1address_line2citypostal_codestatecountrybusiness_namebusiness_descriptionbusiness_typebusiness_industryregistration_numberexternal_idassociated_personsBusiness customers only. Ignored for individuals. Send
id to edit a person. Omit it to add a new person, who then needs first_name, last_name, email, gender, date_of_birth, phone and address.Show 9 child attributesobject[]
idID of an existing associated person. Omit it to add a new person.
first_nameLetters, spaces, apostrophes and hyphens only.
middle_nameOptional. At most 40 characters. Letters, with single spaces, hyphens or apostrophes between them. A period or a digit is refused. Write the name without accents, as for
first_name. Gravv saves the value without leading or trailing spaces.last_nameLetters, spaces, apostrophes and hyphens only.
emaildate_of_birthgenderPossible values:
male, female, otherphoneA valid phone number in international format with a leading
+, such as +2348031234567. Fictional ranges such as +1 555-01xx are rejected.addressShow 6 child attributesobject
address_line1address_line2citypostal_codestateISO 3166-2 code, such as
NG-LA or US-FL. It must belong to country.countryISO 3166-1 alpha-2 code in upper case, such as
NG.Response
Returns 200 OK. Customer updated
NameDescription
dataShow 2 child attributesobject
messagestatuserrorErrors
| Status | Meaning |
|---|---|
| 200 | Customer updated |
| 400 | Invalid field, or the customer is not in your tenant |
Was this page helpful? Yes No
Previous
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl --request PUT \
--url 'https://api.gravv.xyz/v1/customers/e59daa17-20ed-4727-833c-e1c633782cc8' \
--header 'Api-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"first_name": "Jane",
"last_name": "Smith",
"phone": "+2348031234568"
}'
const response = await fetch('https://api.gravv.xyz/v1/customers/e59daa17-20ed-4727-833c-e1c633782cc8', {
method: 'PUT',
headers: {
'Api-Key': '<api-key>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"first_name": "Jane",
"last_name": "Smith",
"phone": "+2348031234568"
}),
});
const data = await response.json();
console.log(response.status, data);
import requests
url = "https://api.gravv.xyz/v1/customers/e59daa17-20ed-4727-833c-e1c633782cc8"
headers = {
"Api-Key": "<api-key>",
}
payload = {
"first_name": "Jane",
"last_name": "Smith",
"phone": "+2348031234568",
}
response = requests.put(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{
"first_name": "Jane",
"last_name": "Smith",
"phone": "+2348031234568"
}`)
req, err := http.NewRequest("PUT", "https://api.gravv.xyz/v1/customers/e59daa17-20ed-4727-833c-e1c633782cc8", bytes.NewReader(payload))
if err != nil {
panic(err)
}
req.Header.Set("Api-Key", "<api-key>")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status)
fmt.Println(string(body))
}
require "json"
require "net/http"
require "uri"
uri = URI("https://api.gravv.xyz/v1/customers/e59daa17-20ed-4727-833c-e1c633782cc8")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
request = Net::HTTP::Put.new(uri)
request["Api-Key"] = "<api-key>"
request["Content-Type"] = "application/json"
request.body = JSON.generate({
"first_name" => "Jane",
"last_name" => "Smith",
"phone" => "+2348031234568",
})
response = http.request(request)
puts response.code
puts response.body
<?php
$payload = [
'first_name' => 'Jane',
'last_name' => 'Smith',
'phone' => '+2348031234568',
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.gravv.xyz/v1/customers/e59daa17-20ed-4727-833c-e1c633782cc8',
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Api-Key: <api-key>',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
echo $status, PHP_EOL, $response, PHP_EOL;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"first_name": "Jane",
"last_name": "Smith",
"phone": "+2348031234568"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.gravv.xyz/v1/customers/e59daa17-20ed-4727-833c-e1c633782cc8"))
.header("Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Put, "https://api.gravv.xyz/v1/customers/e59daa17-20ed-4727-833c-e1c633782cc8");
request.Headers.TryAddWithoutValidation("Api-Key", "<api-key>");
request.Content = new StringContent(
"""
{
"first_name": "Jane",
"last_name": "Smith",
"phone": "+2348031234568"
}
""",
Encoding.UTF8,
"application/json");
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
Responseapplication/json
200400OK
{
"data": {
"message": "customer updated successfully",
"status": true
},
"error": null
}
{
"data": null,
"error": "failed to update customer: user not found"
}