# Delete Location Definitions DELETE https://api.trebellar.app/api/v2/locations Content-Type: application/json Soft-deletes (archives) locations by default. Pass force=true in the body to permanently remove them. Reference: https://docs.trebellar.app/api-reference/api-resources/assets/delete-locations ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: API version: 1.0.0 paths: /api/v2/locations: delete: operationId: delete-locations summary: Delete Location Definitions description: >- Soft-deletes (archives) locations by default. Pass force=true in the body to permanently remove them. tags: - subpackage_assets parameters: - name: X-Trebellar-Api-Key in: header required: true schema: type: string responses: '200': description: Locations deleted/archived successfully content: application/json: schema: $ref: '#/components/schemas/DeleteLocationsResponse' '400': description: Bad Request — one or more location IDs not found content: application/json: schema: $ref: '#/components/schemas/ErrorSchema' '500': description: Internal Server Error content: application/json: schema: $ref: '#/components/schemas/ErrorSchema' requestBody: content: application/json: schema: $ref: '#/components/schemas/DeleteLocationsRequest' servers: - url: https://api.trebellar.app components: schemas: DeleteLocationsRequest: type: object properties: locationIds: type: array items: type: string force: type: boolean required: - locationIds description: >- Request to delete/archive one or more location definitions. Set force=true to permanently remove instead of archiving. title: DeleteLocationsRequest DeleteLocationsResponseDataItems: type: object properties: id: type: string archived: type: boolean required: - id - archived title: DeleteLocationsResponseDataItems DeleteLocationsResponse: type: object properties: data: type: array items: $ref: '#/components/schemas/DeleteLocationsResponseDataItems' required: - data description: Response after deleting/archiving location definitions title: DeleteLocationsResponse 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.assets.deleteLocations({ locationIds: [ "string", ], }); } main(); ``` ```python from trebellar import TrebellarApi client = TrebellarApi( api_key="YOUR_API_KEY_HERE", ) client.assets.delete_locations( location_ids=[ "string" ], ) ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.trebellar.app/api/v2/locations" payload := strings.NewReader("{\n \"locationIds\": [\n \"string\"\n ]\n}") req, _ := http.NewRequest("DELETE", url, payload) req.Header.Add("X-Trebellar-Api-Key", "") req.Header.Add("Content-Type", "application/json") 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/locations") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Delete.new(url) request["X-Trebellar-Api-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"locationIds\": [\n \"string\"\n ]\n}" 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/locations") .header("X-Trebellar-Api-Key", "") .header("Content-Type", "application/json") .body("{\n \"locationIds\": [\n \"string\"\n ]\n}") .asString(); ``` ```php request('DELETE', 'https://api.trebellar.app/api/v2/locations', [ 'body' => '{ "locationIds": [ "string" ] }', 'headers' => [ 'Content-Type' => 'application/json', 'X-Trebellar-Api-Key' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.trebellar.app/api/v2/locations"); var request = new RestRequest(Method.DELETE); request.AddHeader("X-Trebellar-Api-Key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"locationIds\": [\n \"string\"\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "X-Trebellar-Api-Key": "", "Content-Type": "application/json" ] let parameters = ["locationIds": ["string"]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.trebellar.app/api/v2/locations")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "DELETE" request.allHTTPHeaderFields = headers request.httpBody = postData as Data 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() ```