# Delete Cost Category DELETE https://api.trebellar.app/api/v2/costs/categories/{costCategoryId} Delete an existing cost category from the system. Reference: https://docs.trebellar.app/api-reference/api-resources/costs/delete-cost-category ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: API version: 1.0.0 paths: /api/v2/costs/categories/{costCategoryId}: delete: operationId: delete-cost-category summary: Delete Cost Category description: Delete an existing cost category from the system. tags: - subpackage_costs parameters: - name: costCategoryId in: path required: true schema: type: string - name: X-Trebellar-Api-Key in: header required: true schema: type: string responses: '200': description: Cost category deleted successfully content: application/json: schema: $ref: '#/components/schemas/DeleteCostCategoryResponse' '500': description: Unable to delete cost category content: application/json: schema: $ref: '#/components/schemas/ErrorSchema' servers: - url: https://api.trebellar.app components: schemas: CostCategory: type: object properties: externalId: type: string name: type: string parentId: type: string color: type: string id: type: string required: - externalId - name - parentId - id title: CostCategory DeleteCostCategoryResponse: type: object properties: data: $ref: '#/components/schemas/CostCategory' required: - data title: DeleteCostCategoryResponse ErrorSchema: type: object properties: code: type: number format: double message: type: string error: type: string details: type: object additionalProperties: description: Any type required: - code - message description: Common Error Schema title: ErrorSchema securitySchemes: apiKey: type: apiKey in: header name: X-Trebellar-Api-Key bearerAuth: type: http scheme: bearer ``` ## SDK Code Examples ```typescript import { TrebellarApiClient } from "@trebellar/api-sdk"; async function main() { const client = new TrebellarApiClient({ apiKey: "YOUR_API_KEY_HERE", }); await client.costs.deleteCostCategory("costCategoryId"); } main(); ``` ```python from trebellar import TrebellarApi client = TrebellarApi( api_key="YOUR_API_KEY_HERE", ) client.costs.delete_cost_category( cost_category_id="costCategoryId", ) ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.trebellar.app/api/v2/costs/categories/costCategoryId" req, _ := http.NewRequest("DELETE", url, nil) req.Header.Add("X-Trebellar-Api-Key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.trebellar.app/api/v2/costs/categories/costCategoryId") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Delete.new(url) request["X-Trebellar-Api-Key"] = '' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.delete("https://api.trebellar.app/api/v2/costs/categories/costCategoryId") .header("X-Trebellar-Api-Key", "") .asString(); ``` ```php request('DELETE', 'https://api.trebellar.app/api/v2/costs/categories/costCategoryId', [ 'headers' => [ 'X-Trebellar-Api-Key' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.trebellar.app/api/v2/costs/categories/costCategoryId"); var request = new RestRequest(Method.DELETE); request.AddHeader("X-Trebellar-Api-Key", ""); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["X-Trebellar-Api-Key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.trebellar.app/api/v2/costs/categories/costCategoryId")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "DELETE" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```