PocketBase Admin icon

PocketBase Admin

Consume PocketBase API

Overview

This node integrates with the PocketBase API to perform administrative operations on data collections. It allows users to create, read, update, and delete records within specified collections in a PocketBase backend.

Common scenarios include:

  • Automating data management workflows by creating or updating records programmatically.
  • Retrieving filtered or paginated lists of records for further processing or reporting.
  • Deleting obsolete or unwanted records based on dynamic criteria.
  • Fetching single records by ID or the first matching record according to filters.

Practical examples:

  • Creating a new user profile record when a form is submitted.
  • Updating inventory items in bulk based on external triggers.
  • Fetching all orders placed within a date range for analytics.
  • Deleting a record after it has been processed downstream.

Properties

Name Meaning
Collection ID or name of the records' collection to operate on.
Actions The operation to perform: Create, Delete, Get First List Item, Get Full List, Get List, Get One, Update.
Record ID The unique identifier of the record (required for Get One, Update, Delete actions).
Pagination Parameters for paginated listing (Page number, Elements per page, Skip total count) (used with Get List).
Parameters Query parameters for filtering, sorting, expanding relations, and selecting fields (used with list actions).
Body Parameters Key-value pairs representing fields and their values to set when creating or updating a record.

Output

The node outputs an array of JSON objects representing the results of the performed action:

  • For Create and Update, the output contains the newly created or updated record's full data.
  • For Get One, the output contains the single record identified by the given ID.
  • For Get List, the output includes paginated records along with metadata such as total items, current page, items per page, and total pages under a _meta field.
  • For Get Full List, the output returns all matching records without pagination.
  • For Get First List Item, the output returns the first record matching the filter criteria.
  • For Delete, the output contains a success boolean indicating whether the deletion was successful.

No binary data output is produced by this node.

Example output structure for a paginated list item:

{
  "json": {
    "field1": "value1",
    "field2": "value2",
    "_meta": {
      "total": 100,
      "page": 1,
      "perPage": 30,
      "totalPages": 4
    }
  }
}

Dependencies

  • Requires a valid PocketBase admin API credential including:
    • Base URL of the PocketBase instance.
    • Admin email and password for authentication.
  • The node uses the official PocketBase JavaScript client library.
  • Proper n8n credential configuration is necessary to authenticate and authorize API calls.

Troubleshooting

  • Authentication failed!
    This error occurs if the provided admin credentials are invalid or the PocketBase server is unreachable. Verify the URL, email, and password in the credentials configuration.

  • Something went wrong: followed by a JSON response
    Indicates an error returned from the PocketBase API, such as invalid parameters, missing record IDs, or permission issues. Check the detailed error message for specifics.

  • Empty or missing Record ID
    When performing Get One, Update, or Delete actions, ensure the Record ID property is correctly set; otherwise, the node will fail.

  • Pagination parameters ignored or incorrect results
    Confirm that pagination options like page number and elements per page are positive integers.

  • Filter syntax errors
    Filters must be valid according to PocketBase query syntax; invalid filters may cause API errors.

Links and References

Discussion