Directus Clay Data Operations

Advanced techniques for working with Directus data in Clay, including filters, pagination, common use cases, and best practices.
Generated Image

This guide covers advanced techniques for working with Directus data in Clay, including filtering, field selection, pagination, and optimization strategies.

← Back to Directus + Clay Overview

Working with Directus Data

Understanding Filters

When retrieving data from Directus, you can use powerful filter operators to find exactly what you need.

Filter syntax in Clay query parameters:

  • Key: filter[field_name][operator]
  • Value: The comparison value

Common operators:

OperatorDescriptionExample
_eqEqualsfilter[status][_eq]published
_neqNot equalsfilter[status][_neq]draft
_containsContains (case sensitive)filter[title][_contains]Guide
_icontainsContains (case insensitive)filter[title][_icontains]guide
_inIn arrayfilter[status][_in]draft,published
_gtGreater thanfilter[views][_gt]1000
_ltLess thanfilter[price][_lt]100
_nullIs nullfilter[deleted_at][_null]true
_nnullIs not nullfilter[published_at][_nnull]true

Selecting Specific Fields

To improve performance and reduce data transfer, specify only the fields you need:

In query parameters:

  • Key: fields
  • Value: Comma-separated field names (e.g., id,title,status,author)

Including related fields:

  • Use dot notation: author.first_name,author.last_name
  • This pulls in data from related collections

Sorting and Pagination

sort
string
Field name (prefix with - for descending). Example: -date_created (newest first)
limit
number
Maximum items to return (e.g., 50)
offset
number
Number of items to skip (e.g., 0, 50, 100)

Common Use Cases

Use CaseScenarioSteps
🛒 E-commerce Product EnrichmentEnrich product data with inventory and pricing information1. Use Get Item from Collection to check if a product exists in Directus
2. Use Update Item in Collection to update stock levels from external sources
3. Use Get Related Item Details to pull supplier information
📝 Content Publication WorkflowAutomatically publish content when it's approved in Clay1. Use Directus webhooks to send draft content to Clay for review
2. Enrich content with SEO metadata and keyword research in Clay
3. Use Update Item in Collection to publish content back to Directus
👥 Lead Enrichment SystemSync CRM data between Clay and Directus1. Use Directus webhooks to send new leads to Clay
2. Enrich leads with company data and contact information
3. Use Update Item in Collection to sync enriched data back
4. Use Get Related Item Details to pull company profiles
📋 Form Submission ProcessingProcess form submissions and create records1. Use Directus webhooks to send form submissions to Clay
2. Use Get Item from Collection to check for existing records
3. Use Create Item in Collection to add new contacts
4. Use Update Item in Collection to update existing records

Troubleshooting

When working with Directus API through Clay, you may encounter various error codes. For a comprehensive list of Directus error codes and their meanings, refer to the official Directus Error Codes documentation.

Common Issues

Authentication Problems:

  • Verify your API token is valid and active
  • Check that you're using the correct format: Bearer YOUR_TOKEN
  • Ensure the token hasn't expired

Collection and Field Issues:

  • Verify collection names match exactly (case-sensitive)
  • Check that field names match your Directus schema
  • Ensure proper permissions are set for collections

Filter and Query Issues:

  • Use the correct format: filter[field][operator]
  • Test filters in Directus admin panel first
  • Check for special characters that need escaping

Getting Help

If you encounter issues:

  1. For Directus-specific questions: Ask for help in the Directus Community
  2. For Clay-specific questions: Contact Clay support or check Clay's documentation
  3. For API connection issues: Verify your Directus configuration and permissions

Next Steps

Additional Resources