Skip to main content
POST
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
assets
/
search
Advanced Filtering
curl --request POST \
  --url https://api.example.com/v1/organizations/{organizationId}/projects/{projectId}/assets/search \
  --header 'Content-Type: application/json' \
  --data '
{
  "filter": {},
  "sort": [
    {}
  ],
  "page": 123,
  "limit": 123
}
'
For complex queries, use the POST method with a JSON request body that provides greater expressiveness than query parameters.

Path Parameters

organizationId
string
required
Organization ID
projectId
string
required
Project ID

Request Body

filter
object
Filter conditions using operators
sort
array
Array of sort objects with field and order
page
number
default:"1"
Page number
limit
number
default:"20"
Items per page

Example Request

{
  "filter": {
    "type": {
      "in": ["image/jpeg", "image/png"]
    },
    "tags": {
      "any": ["hero", "product"]
    },
    "status": {
      "eq": "active"
    },
    "size": {
      "lt": 5000000
    },
    "createdAt": {
      "gte": "2024-01-01T00:00:00Z",
      "lte": "2024-12-31T23:59:59Z"
    }
  },
  "sort": [
    { "field": "createdAt", "order": "desc" },
    { "field": "name", "order": "asc" }
  ],
  "page": 1,
  "limit": 20
}

Response

Returns paginated asset results matching the filter criteria.
{
  "data": [
    {
      "id": "asset123",
      "name": "hero-image.jpg",
      "type": "image/jpeg",
      "size": 245760,
      "status": "active",
      "tags": ["hero", "homepage"],
      "createdAt": "2024-03-20T10:00:00Z",
      "updatedAt": "2024-03-20T10:00:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 42,
    "pages": 3
  }
}

Combined Approach

You can combine query parameters with a request body. Body filters take precedence when there are conflicts.
POST /v1/organizations/:organizationId/projects/:projectId/assets/search?status=active&sort=createdAt:desc
{
  "filter": {
    "type": {
      "in": ["image/jpeg", "image/png"]
    },
    "tags": {
      "any": ["hero", "product"]
    }
  }
}

Code Examples

curl -X POST "https://api.metabind.ai/v1/organizations/org123/projects/proj456/assets/search" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {
      "type": { "like": "image/%" },
      "status": { "eq": "active" }
    },
    "sort": [{ "field": "createdAt", "order": "desc" }],
    "limit": 50
  }'