[[put-snapshot-repo-api]]
=== Create or update snapshot repository API
++++
Create or update snapshot repository
++++
Registers or updates a <>.
[source,console]
----
PUT /_snapshot/my_repository
{
"type": "fs",
"settings": {
"location": "my_backup_location"
}
}
----
IMPORTANT: If you're migrating {ref}/searchable-snapshots.html[searchable snapshots], the repository's name must be identical in the source and destination clusters.
[[put-snapshot-repo-api-request]]
==== {api-request-title}
`PUT /_snapshot/`
`POST /_snapshot/`
[[put-snapshot-repo-api-prereqs]]
==== {api-prereq-title}
* If the {es} {security-features} are enabled, you must have the `manage`
<> to use this API.
// tag::put-repo-api-prereqs[]
* To register a snapshot repository, the cluster's global metadata must be
writeable. Ensure there aren't any <> that
prevent write access.
// end::put-repo-api-prereqs[]
[[put-snapshot-repo-api-path-params]]
==== {api-path-parms-title}
``::
(Required, string)
Name of the snapshot repository to register or update.
[[put-snapshot-repo-api-query-params]]
==== {api-query-parms-title}
IMPORTANT: Several options for this API can be specified using a query parameter
or a request body parameter. If both parameters are specified, only the query
parameter is used.
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
`timeout`::
(Optional, <>) Specifies the period of time to wait for
a response. If no response is received before the timeout expires, the request
fails and returns an error. Defaults to `30s`.
`verify`::
(Optional, Boolean)
If `true`, the request verifies the repository is functional on all master and
data nodes in the cluster. If `false`, this verification is skipped. Defaults to
`true`.
+
You can manually perform this verification using the
<>.
[role="child_attributes"]
[[put-snapshot-repo-api-request-body]]
==== {api-request-body-title}
[[put-snapshot-repo-api-request-type]]
`type`::
(Required, string)
Repository type.
+
.Valid values for `type`
[%collapsible%open]
====
`azure`:: <>
`gcs`:: <>
`s3`:: <>
`fs`:: <>
`source`:: <>
`url`:: <>
Other repository types are available through official plugins:
`hdfs`:: {plugins}/repository-hdfs.html[Hadoop Distributed File System (HDFS) repository]
====
[[put-snapshot-repo-api-settings-param]]
`settings`::
(Required, object)
Settings for the repository. Supported settings vary based on the repository
type:
+
--
* <>
* <>
* <>
* <>
* <>
* <>
Other repository types are available through official plugins:
* {plugins}/repository-hdfs.html[Hadoop Distributed File System (HDFS) repository]
--
`verify`::
(Optional, Boolean)
If `true`, the request verifies the repository is functional on all master and
data nodes in the cluster. If `false`, this verification is skipped. Defaults to
`true`.
+
You can manually perform this verification using the
<>.