Skip to main content
POST
/
policy
/
query
Query policies with filtering, sorting and pagination
curl --request POST \
  --url https://api.draftt.io/v1/policy/query \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "filter": {
    "$and": "<array>",
    "$or": "<array>",
    "id": {
      "$eq": 123,
      "$ne": 123,
      "$gt": 123,
      "$gte": 123,
      "$lt": 123,
      "$lte": 123,
      "$in": [
        123
      ],
      "$nin": [
        123
      ],
      "$exists": true
    },
    "name": {
      "$eq": "<string>",
      "$ne": "<string>",
      "$gt": "<string>",
      "$gte": "<string>",
      "$lt": "<string>",
      "$lte": "<string>",
      "$like": "<string>",
      "$in": [
        "<string>"
      ],
      "$nin": [
        "<string>"
      ],
      "$exists": true
    },
    "description": {
      "$eq": "<string>",
      "$ne": "<string>",
      "$gt": "<string>",
      "$gte": "<string>",
      "$lt": "<string>",
      "$lte": "<string>",
      "$like": "<string>",
      "$in": [
        "<string>"
      ],
      "$nin": [
        "<string>"
      ],
      "$exists": true
    },
    "createdAt": {
      "$eq": "<string>",
      "$ne": "<string>",
      "$gt": "<string>",
      "$gte": "<string>",
      "$lt": "<string>",
      "$lte": "<string>",
      "$like": "<string>",
      "$in": [
        "<string>"
      ],
      "$nin": [
        "<string>"
      ],
      "$exists": true
    },
    "updatedAt": {
      "$eq": "<string>",
      "$ne": "<string>",
      "$gt": "<string>",
      "$gte": "<string>",
      "$lt": "<string>",
      "$lte": "<string>",
      "$like": "<string>",
      "$in": [
        "<string>"
      ],
      "$nin": [
        "<string>"
      ],
      "$exists": true
    }
  },
  "select": [],
  "sort": {},
  "pageToken": "<string>",
  "pageSize": 100
}
'
{
  "nextPageToken": "eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsibmFtZSI6eyJkaXJlY3Rpb24iOiJhc2MifX19",
  "items": [
    {
      "id": "1",
      "name": "End Of Life",
      "description": "All components should be in the supported version",
      "createdAt": "2024-05-06T11:25:51.513Z",
      "updatedAt": "2024-09-09T19:35:31.898Z"
    },
    "..."
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
filter
object
select
enum<string>[]

If empty - will return all fields, if passed will only return selected fields

Available options:
id,
name,
description,
createdAt,
updatedAt
sort
object

Optional sorting options, if not passed will sort by creation date in ascending order

pageToken
string

Base64 token for pagination

pageSize
integer
default:100

Number of items to return per page

Required range: 1 <= x <= 1000

Response

Success

items
object[]
required
nextPageToken
string | null

Token for fetching the next page of results