POST /api/saved_objects/{type}

Spaces method and path for this operation:

post /s/{space_id}/api/saved_objects/{type}

Refer to Spaces for more information.

Create a Kibana saved object with a randomly generated identifier.

WARNING: This API is intended to be removed in a future Elastic stack version. Consider using the import API for your use case. NOTE: For forward compatibility, include coreMigrationVersion and typeMigrationVersion when creating saved objects outside of Kibana or when persisting raw saved objects outside of Kibana.

Headers

  • kbn-xsrf string Required

    Cross-site request forgery protection

Path parameters

  • type string Required

    Valid options include visualization, dashboard, search, index-pattern, config.

Query parameters

  • overwrite boolean

    If true, overwrites the document with the same identifier.

application/json

Body Required

  • attributes object Required

    The data that you want to create. WARNING: Attributes may be validated depending on the saved object type. Supplying malformed data can cause errors or break Kibana. When creating or persisting raw saved objects outside of Kibana, preserve coreMigrationVersion and typeMigrationVersion (and related migration metadata) to retain forward compatibility across Kibana versions.

  • coreMigrationVersion string

    The Kibana version that last migrated this document. When creating saved objects outside of Kibana, preserve this field to retain forward compatibility.

  • initialNamespaces array

    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 withnamespaceType: agnostic`), this option cannot be used.

  • references array

    Objects with name, id, and type properties that describe the other saved objects that this object references. Use name in attributes to refer to the other saved object, but never the id, which can update automatically during migrations or import and export.

  • typeMigrationVersion string

    The type version that last migrated this document. When creating saved objects outside of Kibana, preserve this field to retain forward compatibility.

Responses

  • 200 application/json

    Indicates a successful call.

  • 409 application/json

    Indicates a conflict error.

POST /api/saved_objects/{type}
curl \
 --request POST 'https://localhost:5601/api/saved_objects/{type}' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --header "kbn-xsrf: string" \
 --data '{"attributes":{},"coreMigrationVersion":"string","initialNamespaces":[],"references":[],"typeMigrationVersion":"string"}'