---
type: api
title: Create a saved object
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v8/operation/operation-createsavedobjectid
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v8/operation/operation-createsavedobjectid
products:
  - Kibana
---

# Create a saved object

deprecated

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

## Paths

- `POST` `/api/saved_objects/{type}/{id}`
- `POST` `/s/{space_id}/api/saved_objects/{type}/{id}`

#### Path parameters

- `id` (string) — required
  An identifier for the saved object.
- `type` (string) — required
  Valid options include `visualization`, `dashboard`, `search`, `index-pattern`, `config`.

## Description

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

Create a Kibana saved object and specify its identifier instead of using a randomly generated ID.

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

## Query string parameters

- `overwrite` (boolean) — optional
  If true, overwrites the document with the same identifier.

## Header parameters

- `kbn-xsrf` (string) — required
  Cross-site request forgery protection

## Request body

`application/json`

- `attributes` (object) — required
  The data that you want to create. WARNING: When you create saved objects, attributes are not validated, which allows you to pass arbitrary and ill-formed data into the API that can break Kibana. Make sure any data that you send to the API is properly formed.
- `initialNamespaces` (unknown[]) — optional
  Identifiers for the spaces in which this object is created. If this is provided, the object is created only in the explicitly defined spaces. If this is not provided, the object is created in the current space (default behavior). For shareable object types (registered with `namespaceType: 'multiple'`), this option can be used to specify one or more spaces, including the "All spaces" identifier ('*'). For isolated object types (registered with `namespaceType: 'single'` or `namespaceType: 'multiple-isolated'`), this option can only be used to specify a single space, and the "All spaces" identifier ('*') is not allowed. For global object types (`registered with `namespaceType: agnostic`), this option cannot be used.
- `references` (unknown[]) — optional
  Identifiers for the spaces in which this object is created. If this is provided, the object is created only in the explicitly defined spaces. If this is not provided, the object is created in the current space (default behavior). For shareable object types (registered with `namespaceType: 'multiple'`), this option can be used to specify one or more spaces, including the "All spaces" identifier ('*'). For isolated object types (registered with `namespaceType: 'single'` or `namespaceType: 'multiple-isolated'`), this option can only be used to specify a single space, and the "All spaces" identifier ('*') is not allowed. For global object types (`registered with `namespaceType: agnostic`), this option cannot be used.

## Responses

#### `200`

Indicates a successful call.

`application/json`

Type: `object`

#### `409`

Indicates a conflict error.

`application/json`

Type: `object`

## Code examples

#### Console

```console
POST kbn:/api/saved_objects/TYPE/ID
{
  "attributes": {}
}
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/saved_objects/${TYPE}/${ID}" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "attributes": {}
  }'
```

