Delete categories
Deletes one or more custom categories for the authenticated company. Each item in changes identifies a category to delete. If the category has linked establishments, you must supply moveTo to reassign them to another category before deletion — omitting it when establishments exist returns 422.
curl -X DELETE "https://api-sandbox.contasimples.com/categories/v1/categories" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"changes": [
{
"categoryToDelete": 100323,
"moveTo": {
"categoryId": 200,
"establishments": [
10045,
10046
]
}
},
{
"categoryToDelete": 100324
}
]
}'
import requests
import json
url = "https://api-sandbox.contasimples.com/categories/v1/categories"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"changes": [
{
"categoryToDelete": 100323,
"moveTo": {
"categoryId": 200,
"establishments": [
10045,
10046
]
}
},
{
"categoryToDelete": 100324
}
]
}
response = requests.delete(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api-sandbox.contasimples.com/categories/v1/categories", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"changes": [
{
"categoryToDelete": 100323,
"moveTo": {
"categoryId": 200,
"establishments": [
10045,
10046
]
}
},
{
"categoryToDelete": 100324
}
]
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"changes": [
{
"categoryToDelete": 100323,
"moveTo": {
"categoryId": 200,
"establishments": [
10045,
10046
]
}
},
{
"categoryToDelete": 100324
}
]
}`)
req, err := http.NewRequest("DELETE", "https://api-sandbox.contasimples.com/categories/v1/categories", bytes.NewBuffer(data))
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/categories/v1/categories')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"changes": [
{
"categoryToDelete": 100323,
"moveTo": {
"categoryId": 200,
"establishments": [
10045,
10046
]
}
},
{
"categoryToDelete": 100324
}
]
}'
response = http.request(request)
puts response.body
{}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
{
"error": "Not Found",
"message": "The requested resource was not found",
"code": 404
}
{
"error": "Conflict",
"message": "The request conflicts with the current state of the resource",
"code": 409,
"details": "Resource already exists"
}
{
"error": "Unprocessable Entity",
"message": "The request was well-formed but contains semantic errors",
"code": 422,
"details": [
{
"field": "password",
"message": "Password must be at least 8 characters long"
}
]
}
{
"error": "Internal Server Error",
"message": "An unexpected error occurred on the server",
"code": 500,
"requestId": "req_1234567890"
}
DELETE
/categories/v1/categories
DELETE
Base URLstring
Target server for requests. Edit to use your own host.
Bearer Token
Bearer Tokenstring
RequiredBearer token from OAuth 2.0 client credentials. Format: Bearer TOKEN
Bearer token from OAuth 2.0 client credentials. Format:
Bearer TOKENContent-Typestring
RequiredThe media type of the request body
Options: application/json
changesarray
RequiredList of categories to delete. Must contain at least one item.
Request Preview
Response
Response will appear here after sending the request
Authentication
header
Authorizationstring
RequiredBearer token. Bearer token from OAuth 2.0 client credentials. Format: Bearer TOKEN
Body
application/json
changesarray
RequiredList of categories to delete. Must contain at least one item.
Responses
Was this page helpful?