PocketBase icon

PocketBase

Perform CRUD and batch operations on PocketBase records using email/password authentication.

Actions6

Overview

This node enables interaction with PocketBase collections by performing various operations on records, including retrieving multiple records ("Get All"). The "Get All" operation fetches multiple records from a specified collection with support for filtering, sorting, pagination, and expanding related fields.

Common scenarios where this node is beneficial include:

  • Retrieving lists of items from a PocketBase database for further processing or integration.
  • Fetching filtered datasets based on specific criteria (e.g., date ranges, IDs).
  • Paginating through large datasets to process or display data in chunks.
  • Expanding relational fields to get detailed linked information in one request.

Practical example: You want to retrieve all user records created after January 1, 2023, sorted by creation date descending, and expand their related profile information. This node can perform that query efficiently and return the results for use in your workflow.

Properties

Name Meaning
Collection Name or ID The name or ID of the PocketBase collection to interact with.
Filters PocketBase filter expression to narrow down records (e.g., ID = "abc" && created > "2023-01-01").
Sort Sort expression defining order of returned records (e.g., -created,collectionId for descending created date).
Expand Comma-separated list of relation fields to expand (e.g., author,category) to include related record data.
Per Page Number of records to return per page (minimum 1).
Page The page number to retrieve (minimum 1), used for pagination.

Output

The output is an array of JSON objects, each representing a record retrieved from the specified PocketBase collection. Each item contains the full record data as returned by the PocketBase API, including any expanded relational fields if requested.

If the "Expand" property is used, related records' data will be included within the main record's JSON under the respective relation field names.

No binary data output is produced by this operation.

Example output snippet (simplified):

[
  {
    "json": {
      "id": "record_id_123",
      "created": "2023-02-15T12:34:56Z",
      "field1": "value1",
      "author": {
        "id": "author_id_456",
        "name": "Author Name"
      }
    },
    "pairedItem": {
      "item": 0
    }
  }
]

Dependencies

  • Requires a configured API authentication credential for PocketBase (an API key or token).
  • Needs the base URL of the PocketBase instance to make HTTP requests.
  • Uses n8n's built-in HTTP request helper with authentication to communicate with PocketBase REST API.

Troubleshooting

  • Common issues:

    • Incorrect collection name or ID will cause errors or empty results.
    • Invalid filter or sort expressions may result in API errors.
    • Requesting pages beyond available data returns empty arrays.
    • Expanding non-existent relation fields will not include additional data.
  • Error messages:

    • "Unknown operation" or "Unknown resource" indicates misconfiguration of resource or operation parameters.
    • HTTP errors from PocketBase API (e.g., 400 Bad Request) usually relate to invalid filters, sorts, or missing permissions.
    • Network or authentication errors indicate problems with the API credentials or connectivity.
  • Resolutions:

    • Verify collection names/IDs exist in PocketBase.
    • Test filter and sort expressions directly against PocketBase API or admin UI.
    • Ensure API credentials have sufficient permissions.
    • Use the "Continue On Fail" option to handle partial failures gracefully.

Links and References

Discussion