Get Cost Center by ID
Returns the data of a specific cost center belonging to the authenticated company, identified by its UUID. Use this endpoint to confirm a cost center still exists before displaying it in a UI, or to validate a costCenterId received from another source.
Rules:
- The
idis theidfield returned by GET /cost-centers/v1/cost-centers. - Returns 404 if the cost center is not found or does not belong to the authenticated company — company isolation is enforced automatically.
curl -X GET "https://api-sandbox.contasimples.com/cost-centers/v1/cost-centers/fdafbfa7-5eeb-4d96-84aa-82b7c2e1b0ff" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN"
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",
"Authorization": "Bearer YOUR_API_TOKEN"
}
response = requests.get(url, headers=headers)
print(response.json())
const response = await fetch("https://api-sandbox.contasimples.com/cost-centers/v1/cost-centers/fdafbfa7-5eeb-4d96-84aa-82b7c2e1b0ff", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://api-sandbox.contasimples.com/cost-centers/v1/cost-centers/fdafbfa7-5eeb-4d96-84aa-82b7c2e1b0ff", nil)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
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::Get.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
response = http.request(request)
puts response.body
{
"id": "fdafbfa7-5eeb-4d96-84aa-82b7c2e1b0ff",
"companyId": "7c61b3f6-7353-46aa-80ef-3e27d95150ab",
"name": "Marketing"
}
{
"error": "Unauthorized",
"message": "Invalid or expired access token.",
"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": "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 {token}Unique identifier (UUID) of the cost center — use the id field returned by GET /cost-centers/v1/cost-centers.
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 — use the id field returned by GET /cost-centers/v1/cost-centers.
fdafbfa7-5eeb-4d96-84aa-82b7c2e1b0ffResponses
Unique identifier of the cost center.
Identifier of the company that owns the cost center.
Name of the cost center.
Short error type (e.g. Bad Request, Not Found).
Brief error message for API clients.
HTTP status code for the error (matches the response status).
Optional. For 400 errors, may be a single string or an array of strings with each validation failure.
Short error type (e.g. Bad Request, Not Found).
Brief error message for API clients.
HTTP status code for the error (matches the response status).
Optional. For 400 errors, may be a single string or an array of strings with each validation failure.
Short error type (e.g. Bad Request, Not Found).
Brief error message for API clients.
HTTP status code for the error (matches the response status).
Optional. For 400 errors, may be a single string or an array of strings with each validation failure.