Copy Collection
Clone metadata, documents, and vectors under a new name. Instant regardless of size.
Path parameters
Request
This endpoint expects an object.
Name for the copy. Must be unique within the organization and environment. Same rules as creating a collection: 3-63 characters, alphanumeric start and end, letters, numbers, hyphens and underscores only.
trueCopy the collection’s chunk relations and chunk metadata along with its documents and vectors. Defaults to true so a copy is a faithful original; set false to copy documents and vectors only.
Response
Successful Response
Name of the collection copied from.
Name of the new copy.
ID of the new copy.
Number of documents cloned.
Number of Turbopuffer namespaces copied (text plus any media).
0Number of files cloned.
0Number of chunk relations cloned. Counts ROWS, not distinct edges: duplicate (source, target, type) triples in the source are reproduced faithfully.
0Number of chunk metadata rows cloned.
0Relations copied whose target document could not be remapped into the new collection, so their target_document_id is null. Usually these are edges already broken in the source (the target document was deleted, or the id never matched a document); if the source was being indexed while the copy ran, a freshly created edge can also land here. The copy reproduces the edge rather than writing a pointer that resolves to nothing.
Errors
import requests
BASE_URL = "https://api.filesearch.dev"
API_KEY = "your_api_key"
COLLECTION_NAME = "my_documents"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(
f"{BASE_URL}/v2/collections/{COLLECTION_NAME}/copy",
headers=headers,
json={"target_name": "my_documents_v2"},
timeout=120.0
)
if response.status_code == 200:
data = response.json()
print(f"Created {data['collection_name']} ({data['documents_copied']} documents)")
elif response.status_code == 409:
print("That name is taken. Choose a different target_name.")
else:
print(f"Error {response.status_code}: {response.text}"){
"success": true,
"message": "Copied 'my_documents' to 'my_documents_v2' (142 documents)",
"source_collection": "my_documents",
"collection_name": "my_documents_v2",
"collection_id": "01931f4e-8c2a-7c31-9f5e-2b7a1d3e4f60",
"documents_copied": 142,
"namespaces_copied": 2,
"files_copied": 142,
"relations_copied": 356,
"chunk_metadata_copied": 89,
"relations_unresolved": 0
}