---
type: api
title: Update saved objects in spaces
description: Update one or more saved objects to add or remove them from some spaces.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-spaces-update-objects-spaces
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-spaces-update-objects-spaces
products:
  - Kibana
---

# Update saved objects in spaces

- Server: `https://{kibana_url}`

## Paths

- `POST` `/api/spaces/_update_objects_spaces`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#basicauth)

## Description

Update one or more saved objects to add or remove them from some spaces.

## Request Body

`application/json`

- `objects` ([] object · max: 1000) — required
  - `id` (string) — required
    The identifier of the saved object to update.
  - `type` (string) — required
    The type of the saved object to update.
- `spacesToAdd` ([] string · max: 1000) — required
- `spacesToRemove` ([] string · max: 1000) — required

## Response

OK: A successful request.

## Code Examples

#### Console

```console
POST /api/spaces/_update_objects_spaces
{
  "objects": [
    {
      "type": "index-pattern",
      "id": "90943e30-9a47-11e8-b64d-95841ca0b247"
    }
  ],
  "spacesToAdd": [
    "test"
  ],
  "spacesToRemove": []
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/spaces/_update_objects_spaces" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
  "objects": [
    {
      "type": "index-pattern",
      "id": "90943e30-9a47-11e8-b64d-95841ca0b247"
    }
  ],
  "spacesToAdd": [
    "test"
  ],
  "spacesToRemove": []
}'
```

## Response Examples

#### Update saved object spaces

The response from updating the spaces of saved objects.

```json
{
  "objects": [
    {
      "type": "index-pattern",
      "id": "90943e30-9a47-11e8-b64d-95841ca0b247",
      "spaces": [
        "default",
        "test"
      ]
    }
  ]
}
```

