---
title: Remove element
url: https://www.tines.com/docs/api/resources/remove-element/
updated: 2026-03-13T13:37:51+00:00
description: Remove a top level element from an array or key from an object in a resource. The request returns the removed item. If the resource has a test value this can be modified by using the is_test parameter.
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/llms.txt) › [Tines API](https://www.tines.com/llms.txt) › [Resources](https://www.tines.com/llm/docs/api/resources.md)*

# Remove element

*[View on tines.com](https://www.tines.com/docs/api/resources/remove-element/)*

## Description

Remove a top level element from an array or key from an object in a resource. The request returns the removed item. If the resource has a test value this can be modified by using the is_test parameter.

## Request

HTTP Method: **POST**

| Parameter   | Description                                                                                                                                                                                                                                                                                                                                                                                                               |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| resource_id | The ID of the live resource.                                                                                                                                                                                                                                                                                                                                                                                              |
| key         | The object key to remove if removing from an object.                                                                                                                                                                                                                                                                                                                                                                      |
| index       | The index of the element to remove if removing from an array (with indexes starting at 0). If omitted the last element of the array will be removed                                                                                                                                                                                                                                                                       |
| if_value    | **Optional** When provided, the operation only proceeds if the current value at the specified key (for objects) or index (for arrays) matches this value. If the value does not match, a 422 error is returned with the current value included in the response. Supports any JSON value (string, number, boolean, object, array). A `null` value is treated the same as omitting the parameter (unconditional operation). |
| is_test     | **Optional** Boolean value stating if the test resource should be used                                                                                                                                                                                                                                                                                                                                                    |

### Sample request

Sample request for an array element

```bash
curl -X POST \
  https://<tenant-domain>/api/v1/global_resources/<<resource_id>>/remove \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer <<CREDENTIAL.tines_api_key>>' \
  -d '{
        "index":"0"
    }'
```

Sample request for an object key

```bash
curl -X POST \
  https://<tenant-domain>/api/v1/global_resources/<<resource_id>>/remove \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer <<CREDENTIAL.tines_api_key>>' \
  -d '{
        "key":"foo"
    }'
```

Sample request for conditional removal (only removes if current value matches)

```bash
curl -X POST \
  https://<tenant-domain>/api/v1/global_resources/<<resource_id>>/remove \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer <<CREDENTIAL.tines_api_key>>' \
  -d '{
        "key": "locked_by",
        "if_value": "run-123"
    }'
```

## Response

A successful request will return the removed item from the resource in string format.

### Sample response

```json
"foo bar"
```
