Update Cost Center
Updates the name of an existing cost center. Use this endpoint to fix typos or reflect an internal reorganization — for example, renaming "Marketing" to "Digital Marketing".
Rules:
- The
namefield is required and cannot be empty. - Cannot update to a name already used by another cost center in the company.
- Returns 404 if the cost center is not found.
curl -X PATCH "https://api-sandbox.contasimples.com/cost-centers/v1/cost-centers/fdafbfa7-5eeb-4d96-84aa-82b7c2e1b0ff" \
-H "Content-Type: application/json" \
-H "Signature-Input: example_string" \
-H "Signature: example_string" \
-H "Content-Digest: example_string" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"name": "Updated Marketing"
}'
import requests
import json
url = "https://api-sandbox.contasimples.com/cost-centers/v1/cost-centers/fdafbfa7-5eeb-4d96-84aa-82b7c2e1b0ff"
headers = {
"Content-Type": "application/json",
"Signature-Input": "example_string",
"Signature": "example_string",
"Content-Digest": "example_string",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"name": "Updated Marketing"
}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api-sandbox.contasimples.com/cost-centers/v1/cost-centers/fdafbfa7-5eeb-4d96-84aa-82b7c2e1b0ff", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
"Signature-Input": "example_string",
"Signature": "example_string",
"Content-Digest": "example_string",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"name": "Updated Marketing"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"name": "Updated Marketing"
}`)
req, err := http.NewRequest("PATCH", "https://api-sandbox.contasimples.com/cost-centers/v1/cost-centers/fdafbfa7-5eeb-4d96-84aa-82b7c2e1b0ff", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Signature-Input", "example_string")
req.Header.Set("Signature", "example_string")
req.Header.Set("Content-Digest", "example_string")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api-sandbox.contasimples.com/cost-centers/v1/cost-centers/fdafbfa7-5eeb-4d96-84aa-82b7c2e1b0ff')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(uri)
request['Content-Type'] = 'application/json'
request['Signature-Input'] = 'example_string'
request['Signature'] = 'example_string'
request['Content-Digest'] = 'example_string'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"name": "Updated Marketing"
}'
response = http.request(request)
puts response.body
{
"id": "fdafbfa7-5eeb-4d96-84aa-82b7c2e1b0ff",
"companyId": "7c61b3f6-7353-46aa-80ef-3e27d95150ab",
"name": "Updated Marketing"
}
{
"error": "Bad Request",
"message": "One or more request parameters are invalid.",
"code": 400,
"requestId": "123e4567-e89b-12d3-a456-426614174000",
"details": [
"The example field must have a value between 5 and 100.",
"Dates must be in YYYY-MM-DD format."
]
}
{
"error": "Unauthorized",
"message": "Authentication failed. Check the API token and the request signature",
"requestId": "123e4567-e89b-12d3-a456-426614174000",
"code": 401
}
{
"error": "Not Found",
"message": "The requested resource was not found.",
"requestId": "123e4567-e89b-12d3-a456-426614174000",
"code": 404
}
{
"error": "Conflict",
"message": "A supplier with the same name already exists for this company.",
"requestId": "123e4567-e89b-12d3-a456-426614174000",
"code": 409
}
{
"error": "Internal Server Error",
"message": "An unexpected error occurred while processing the request.",
"requestId": "123e4567-e89b-12d3-a456-426614174000",
"code": 500
}
/cost-centers/v1/cost-centers/{id}Target server for requests. Edit to use your own host.
Bearer token from OAuth 2.0 client credentials. Format: Bearer TOKEN
Bearer TOKENUnique identifier (UUID) of the cost center.
The media type of the request body
What was signed and the signature parameters, in the RFC 9421 format. A credential with a public key must send it on every call, reads included, or the request is refused with 401. The signature covers the @method, @path, and @query components, and also content-digest when there is a body. created and alg are required, and created is valid for 300 seconds. The full format, with examples, is in Request Signing.
The signature of the base defined by RFC 9421, in base64, between : and under the same label used in Signature-Input, for example sig=:SGVsbG8gd29ybGQ=:. It always goes together with Signature-Input.
Hash of the request body in the RFC 9530 format, with sha-256 or sha-512, for example sha-256=:X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=:. It is required when the request has a body and the credential has a public key, and in that case Signature-Input must include the content-digest component.
New cost center name. Must be unique per company.
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token. Bearer token from OAuth 2.0 client credentials. Format: Bearer TOKEN
Path Parameters
Unique identifier (UUID) of the cost center.
fdafbfa7-5eeb-4d96-84aa-82b7c2e1b0ffHeaders
What was signed and the signature parameters, in the RFC 9421 format. A credential with a public key must send it on every call, reads included, or the request is refused with 401. The signature covers the @method, @path, and @query components, and also content-digest when there is a body. created and alg are required, and created is valid for 300 seconds. The full format, with examples, is in Request Signing.
The signature of the base defined by RFC 9421, in base64, between : and under the same label used in Signature-Input, for example sig=:SGVsbG8gd29ybGQ=:. It always goes together with Signature-Input.
Hash of the request body in the RFC 9530 format, with sha-256 or sha-512, for example sha-256=:X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=:. It is required when the request has a body and the credential has a public key, and in that case Signature-Input must include the content-digest component.
Body
Responses
Unique identifier of the cost center.
Identifier of the company that owns the cost center.
Name of the cost center.