Skip to main content

Authentication

All API endpoints require authentication using Laravel Sanctum. Include your API token in the Authorization header:
Authorization: Bearer YOUR_API_TOKEN
To get your API token, go to your Directify dashboard and click on Settings → API. Then click on the “Key” icon to generate a new token and copy it.

Base URL

https://directify.app/api

Rate Limiting

API requests are limited to 60 requests per minute per authenticated user.

Error Responses

Validation Errors

When request validation fails, the API returns a 422 status code with validation error details:
{
  "message": "The given data was invalid.",
  "errors": {
    "url": [
      "The url field is required."
    ],
    "category_id": [
      "The selected category id is invalid."
    ]
  }
}

Authentication Errors

When authentication fails, the API returns a 401 status code:
{
  "message": "Unauthenticated."
}

Authorization Errors

When the user doesn’t have access to a directory, the API returns a 403 status code:
{
  "message": "You do not own this directory"
}

Not Found Errors

When a resource is not found, the API returns a 404 status code:
{
  "message": "No query results for model [App\\Models\\Project] 123"
}

Best Practices

  1. Always check if a listing exists before creating a new one using the /exists endpoint
  2. Use pagination when retrieving large lists of listings
  3. Include custom field values in your listing creation/update requests
  4. Validate category and tag IDs before sending them in requests
  5. Handle rate limiting by implementing exponential backoff for failed requests
  6. Cache directory metadata like categories, tags, and custom fields to reduce API calls