> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://api.qdrant.tech/v-1-17-x/api-reference/snapshots/recover-shard-from-uploaded-snapshot/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.qdrant.tech/_mcp/server. # Recover from an uploaded snapshot (shard) POST http://localhost:6333/collections/{collection_name}/shards/{shard_id}/snapshots/upload Content-Type: multipart/form-data Recovers the shard of a local collection from an uploaded snapshot. This will overwrite any collection data, which is stored in this shard. Reference: https://api.qdrant.tech/api-reference/snapshots/recover-shard-from-uploaded-snapshot ## Authentication - `api-key` header (required) — API Key authentication via header ## Servers - `http://localhost:6333` (http, default) - `https://localhost:6333` (https) ## Request ### Path parameters - `collection_name` (string, required) — Name of the collection - `shard_id` (integer, required) — Id of the shard to recover ### Query parameters - `wait` (boolean, optional) — If true, wait for changes to actually happen. If false - let changes happen in background. Default is true. - `priority` (enum, optional) — Defines source of truth for snapshot recovery - Allowed values: `no_sync`, `snapshot`, `replica` - `checksum` (string, optional) — Optional SHA256 checksum to verify snapshot integrity before recovery. ### Body (multipart/form-data) This endpoint expects a multipart form containing an optional file. - `snapshot` (file, optional) ## Response ### 200 successful operation - `time` (double, optional) — Time spent to process this request - `status` (string, optional) - `result` (boolean, optional) ## Examples **Request** ```json { "snapshot": ">" } ``` **Response** ```json { "time": 0.002, "status": "ok", "result": true } ``` **SDK Code** ```python import requests url = "http://localhost:6333/collections/collection_name/shards/1/snapshots/upload" files = { "snapshot": "open('', 'rb')" } headers = {"api-key": ""} response = requests.post(url, files=files, headers=headers) print(response.json()) ``` ```javascript const url = 'http://localhost:6333/collections/collection_name/shards/1/snapshots/upload'; const form = new FormData(); form.append('snapshot', ''); const options = {method: 'POST', headers: {'api-key': ''}}; options.body = form; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "http://localhost:6333/collections/collection_name/shards/1/snapshots/upload" payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"snapshot\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("http://localhost:6333/collections/collection_name/shards/1/snapshots/upload") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Post.new(url) request["api-key"] = '' request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"snapshot\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("http://localhost:6333/collections/collection_name/shards/1/snapshots/upload") .header("api-key", "") .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"snapshot\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n") .asString(); ``` ```php request('POST', 'http://localhost:6333/collections/collection_name/shards/1/snapshots/upload', [ 'multipart' => [ [ 'name' => 'snapshot', 'filename' => '', 'contents' => null ] ] 'headers' => [ 'api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("http://localhost:6333/collections/collection_name/shards/1/snapshots/upload"); var request = new RestRequest(Method.POST); request.AddHeader("api-key", ""); request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"snapshot\"; filename=\"\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["api-key": ""] let parameters = [ [ "name": "snapshot", "fileName": "" ] ] let boundary = "---011000010111000001101001" var body = "" var error: NSError? = nil for param in parameters { let paramName = param["name"]! body += "--\(boundary)\r\n" body += "Content-Disposition:form-data; name=\"\(paramName)\"" if let filename = param["fileName"] { let contentType = param["content-type"]! let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8) if (error != nil) { print(error as Any) } body += "; filename=\"\(filename)\"\r\n" body += "Content-Type: \(contentType)\r\n\r\n" body += fileContent } else if let paramValue = param["value"] { body += "\r\n\r\n\(paramValue)" } } let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:6333/collections/collection_name/shards/1/snapshots/upload")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```