Skip to main content
PATCH
/
customers
/
{id}
Update a customer
curl --request PATCH \
  --url https://api.nomos.energy/customers/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "first_name": "John",
  "last_name": "Doe"
}
'
import requests

url = "https://api.nomos.energy/customers/{id}"

payload = {
"first_name": "John",
"last_name": "Doe"
}
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({first_name: 'John', last_name: 'Doe'})
};

fetch('https://api.nomos.energy/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://api.nomos.energy/customers/{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([
'first_name' => 'John',
'last_name' => 'Doe'
]),
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.nomos.energy/customers/{id}"

payload := strings.NewReader("{\n \"first_name\": \"John\",\n \"last_name\": \"Doe\"\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.nomos.energy/customers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"John\",\n \"last_name\": \"Doe\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.nomos.energy/customers/{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 \"first_name\": \"John\",\n \"last_name\": \"Doe\"\n}"

response = http.request(request)
puts response.read_body
{
  "object": "customer",
  "id": "cus_mi4f0oda6x9m7gcsvjk0ole1",
  "first_name": "John",
  "last_name": "Doe",
  "email": "john.doe@example.com",
  "created_at": "2024-03-14T12:00:00Z",
  "type": "person",
  "vat_id": "DE123456789"
}
{
"code": "BAD_REQUEST",
"message": "invalid_type in 'end': Required",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/BAD_REQUEST",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}
{
"code": "UNAUTHORIZED",
"message": "Invalid or malformed token",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/UNAUTHORIZED",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}
{
"code": "PAYMENT_REQUIRED",
"message": "Payment required",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/PAYMENT_REQUIRED",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}
{
"code": "FORBIDDEN",
"message": "You are not allowed to access this resource",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/FORBIDDEN",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}
{
"code": "NOT_FOUND",
"message": "Resource not found",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/NOT_FOUND",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}
{
"code": "METHOD_NOT_ALLOWED",
"message": "Method not allowed",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/METHOD_NOT_ALLOWED",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}
{
"code": "CONFLICT",
"message": "Resource already exists",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/CONFLICT",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}
{
"code": "UNPROCESSABLE_ENTITY",
"message": "invalid_enum_value in 'status': Invalid enum value. Expected 'pending' | 'active' | 'ended'",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/UNPROCESSABLE_ENTITY",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}
{
"code": "TOO_MANY_REQUESTS",
"message": "Wait 30 seconds before retrying.",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/TOO_MANY_REQUESTS",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}
{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal Server Error",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/INTERNAL_SERVER_ERROR",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required
Example:

"cus_mi4f0oda6x9m7gcsvjk0ole1"

Body

application/json

The customer fields to update

first_name
string

Customer's first name

Required string length: 1 - 100
Example:

"John"

last_name
string

Customer's last name

Required string length: 1 - 100
Example:

"Doe"

company_name
string

Company name. Only valid for company customers; must be non-empty when provided.

Required string length: 1 - 100
Example:

"Example GmbH"

Response

The updated customer

object
enum<string>
required

Type of the object, always 'customer'

Available options:
customer
id
string
required

Unique identifier for the customer

Example:

"cus_mi4f0oda6x9m7gcsvjk0ole1"

first_name
string
required

Customer's first name

Required string length: 1 - 100
Example:

"John"

last_name
string
required

Customer's last name

Required string length: 1 - 100
Example:

"Doe"

email
string<email>
required

Email address

Example:

"john.doe@example.com"

created_at
required

Timestamp when the customer was created

Example:

"2024-03-14T12:00:00Z"

type
enum<string>
default:person

Type of the customer, always 'person'

Available options:
person
vat_id
string | null

VAT identification number (USt-IdNr.) of the customer

Example:

"DE123456789"