---
type: api
title: Update jobs spaces
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v9/operation/operation-mlupdatejobsspaces
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v9/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`

## 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.

## Authentication

- Api key: `Authorization: <value>`
  These APIs use key-based authentication. You must create an API key and use the encoded value in the request header. For example: `Authorization: ApiKey base64AccessApiKey`
- Basic: `Authorization: Basic <credentials>`

## 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

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

#### Success dfaresponse

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

