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

# Update jobs spaces

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

## Paths

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

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

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

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

## Request Body

`application/json`


## Response

Indicates a successful call

## Code Examples

#### Console

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

#### curl

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

## Response Examples

#### Success adresponse

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

#### Success dfaresponse

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

