---
type: api
title: Update jobs spaces
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/kibana/v9/operation/operation-mlupdatejobsspaces
resource: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/kibana/v9/operation/operation-mlupdatejobsspaces
products:
  - Kibana
---

# Update jobs spaces

Authentication: required

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

## Paths

- `POST` `/api/ml/saved_objects/update_jobs_spaces`
- `POST` `/s/{space_id}/api/ml/saved_objects/update_jobs_spaces`

#### Path parameters

- `space_id` (string) — optional
  An identifier for the space. If `space_id` is not provided in the URL, the default space is used. Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

## Description

Update a list of jobs to add and/or remove them from given spaces.

## Request body

`application/json`


## Response

Indicates a successful call

`application/json`

## Code examples

#### Console

```console
POST kbn:/api/ml/saved_objects/update_jobs_spaces
{
  "jobIds": [
    "test-job"
  ],
  "jobType": "anomaly-detector",
  "spacesToAdd": [
    "default"
  ],
  "spacesToRemove": [
    "*"
  ]
}
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/ml/saved_objects/update_jobs_spaces" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "jobIds": [
      "test-job"
    ],
    "jobType": "anomaly-detector",
    "spacesToAdd": [
      "default"
    ],
    "spacesToRemove": [
      "*"
    ]
  }'
```

## Response examples

#### Success adresponse

`application/json`

```json
{
  "test-job": {
    "success": true,
    "type": "anomaly-detector"
  }
}
```

#### Success dfaresponse

`application/json`

```json
{
  "test-job": {
    "success": true,
    "type": "data-frame-analytics"
  }
}
```

