Skip to content
API documentation
Tags filtration

Filtering by tags

In the previous example, 5 profiles with names (w-0, w-1, w-2, w-3, w-4) were automatically created. All of these profiles are then assigned the tag «DuckDuckGo» in the 0DETECT Dashboard. We recommend actively using tags, especially for automation needs. In this example, we will select all profiles with the tag «DuckDuckGo» only.

Select profiles with tag filter (GET /profile?tag=DuckDuckGo)

Code

import requests
import json
 
def get_profiles_by_tag(local_api_token, local_api_port, tag):
url = f'http://localhost:{local_api_port}/profile?tag={tag}'
headers = {
'x-api-key': local_api_token
}
 
    response = requests.get(url, headers=headers)
 
    if response.status_code == 200:
        return response.json()
    else:
        return {'error': 'Unable to fetch data', 'status_code': response.status_code}
 
local_api_token = 'FA70fE'
local_api_port = 56789
 
tag = "DuckDuckGo"
 
profiles = get_profiles_by_tag(local_api_token, local_api_port, tag)
print(json.dumps(profiles, indent=3))
 

This script will print all profiles with this tag. Pay attention to the «pagination» section, you may need to retrieve data on a page-by-page basis. For more details on the parameters of this request, see Swagger.

Example of an answer

{
   "list": [
      {
         "_id": "6881275a8d96bb51aa4175e3",
         "name": "w-4",
         "tags": [
            {
               "_id": "68812aff8d96bb51aa4260b5",
               "team": "64ba428610851441857c6fc0",
               "user": "661fb21a4af4057ec42317b2",
               "isActive": true,
               "title": "DuckDuckGo",
               "color": "#00C2CE",
               "createdAt": "2025-07-23T18:33:35.913Z",
               "__v": 0
            }
         ],
         "status": 0
      },
      {
         "_id": "68812758e2020e781e201295",
         "name": "w-3",
         "tags": [
            {
               "_id": "68812aff8d96bb51aa4260b5",
               "team": "64ba428610851441857c6fc0",
               "user": "661fb21a4af4057ec42317b2",
               "isActive": true,
               "title": "DuckDuckGo",
               "color": "#00C2CE",
               "createdAt": "2025-07-23T18:33:35.913Z",
               "__v": 0
            }
         ],
         "status": 0
      },
      {
         "_id": "688127578d96bb51aa417592",
         "name": "w-2",
         "tags": [
            {
               "_id": "68812aff8d96bb51aa4260b5",
               "team": "64ba428610851441857c6fc0",
               "user": "661fb21a4af4057ec42317b2",
               "isActive": true,
               "title": "DuckDuckGo",
               "color": "#00C2CE",
               "createdAt": "2025-07-23T18:33:35.913Z",
               "__v": 0
            }
         ],
         "status": 0
      },
      {
         "_id": "68812756e2020e781e201221",
         "name": "w-1",
         "tags": [
            {
               "_id": "68812aff8d96bb51aa4260b5",
               "team": "64ba428610851441857c6fc0",
               "user": "661fb21a4af4057ec42317b2",
               "isActive": true,
               "title": "DuckDuckGo",
               "color": "#00C2CE",
               "createdAt": "2025-07-23T18:33:35.913Z",
               "__v": 0
            }
         ],
         "status": 0
      },
      {
         "_id": "68812755e2020e781e2011e7",
         "name": "w-0",
         "tags": [
            {
               "_id": "68812aff8d96bb51aa4260b5",
               "team": "64ba428610851441857c6fc0",
               "user": "661fb21a4af4057ec42317b2",
               "isActive": true,
               "title": "DuckDuckGo",
               "color": "#00C2CE",
               "createdAt": "2025-07-23T18:33:35.913Z",
               "__v": 0
            }
         ],
         "status": 0
      }
   ],
   "pagination": {
      "totalCount": 5,
      "skip": 0,
      "limit": 10
   }
}