Skip to main content

Update a Collection

Endpointโ€‹

PUT https://api.verifik.co/v2/face-recognition/collections/{id}

Updates a collection you own. The {id} path parameter is the collectionโ€™s unique _id (the same identifier used when retrieving a collection).

When you include people in the body, the server reconciles membership: people not listed may be removed from the collection, and new ids may be added, subject to server rules.

Headersโ€‹

NameValue
Content-Typeapplication/json
AuthorizationBearer <token>

Paramsโ€‹

NameTypeRequiredDescription
idstring (path)YesUnique identifier of the collection to update (_id in responses)
namestringYesDisplay name for the collection
descriptionstringNoOptional description
projectstringNoOptional project id to associate with the collection
peoplearrayNoOptional list of person objects with _id or id; when sent, membership is reconciled

Requestโ€‹

const fetch = require("node-fetch");

const collectionId = "65b9592267cc4f096dbe743d";

async function run() {
const res = await fetch(
`https://api.verifik.co/v2/face-recognition/collections/${collectionId}`,
{
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_TOKEN}`,
},
body: JSON.stringify({
name: "Updated name",
description: "Updated description",
}),
}
);
console.log(await res.json());
}

run();

Responseโ€‹

{
"data": {
"__v": 0,
"_id": "65b9592267cc4f096dbe743d",
"code": "d96db430-27d2-4f43-bcff-c4b239ac6d2e",
"name": "Updated name",
"client": "6158e492dd0767a2b8b3f829",
"deleted": false,
"createdAt": "2024-01-30T20:16:34.841Z",
"updatedAt": "2024-01-30T21:00:00.000Z",
"description": "Updated description"
}
}

Notesโ€‹

  • name: Required on every update request body.
  • people: When provided, the API may add or remove persons relative to the current collection membership.
  • OpenCV: The server also syncs metadata with the OpenCV service when name or description change.