# Collection (1:N) Check

The collection check algorithm is designed to check the presence of a person using a database of preloaded photos. A video fragment and/or a photo can be used as a source for comparison.

#### Prerequisites:

1. You're [authorized](https://doc.ozforensics.com/oz-knowledge/guides/developer-guide/api/oz-api/use-cases/authentication).
2. You have already [created a folder and added your media](https://doc.ozforensics.com/oz-knowledge/guides/developer-guide/api/oz-api/use-cases/uploading-media) marked by correct tags into this folder.

#### Processing steps:

1\. Initiate the analysis: `POST/api/folders/{{folder_id}}/analyses/`

If you want to use a webhook for response, add it to the payload at this step, as described [here](https://doc.ozforensics.com/oz-knowledge/guides/developer-guide/api/oz-api/use-cases/using-a-webhook-to-get-results).

{% code title="request body" %}

```javascript
{
  "analyses": [{
    "type": "collection",
    "source_media": ["1111aaaa-11aa-11aa-11aa-111111aaaaaa"], // // optional; omit to include all media from the folder
  }]
}
```

{% endcode %}

You'll need `analysis_id` or `folder_id` from response.

2\. If you use a webhook, just wait for it to return the information needed. Otherwise, initiate polling:

* `GET /api/analyses/{{analysis_id}}` – for the `analysis_id` you have from the previous step.
* `GET /api/folders/{{folder_id}}` – for all analyses performed on media in the folder with the `folder_id` you have from the previous step.&#x20;

Wait for the `resolution_status` and `resolution` fields to change the status to anything other than `PROCESSING` and treat this as a result.

If you want to know which person from your collection matched with the media you have uploaded, find the `collection` analysis in the response, check `results_media`, and retrieve `person_id`. This is the ID of the person who matched with the person in your media. To get the information about this person, use `GET /api/collections/{{collection_id}}/persons/{{person_id}}` with IDs of your collection and person.
