Xata icon

Xata

Consume Xata API

Overview

The Xata node for n8n allows you to interact with the Xata database service. Specifically, when using the Default resource and the Read operation, this node retrieves a single record from a specified table in your Xata workspace by its ID. This is useful for workflows where you need to fetch detailed information about a specific entry, such as looking up user profiles, order details, or any entity stored in your Xata tables.

Practical examples:

  • Fetching customer details by their unique ID for further processing.
  • Retrieving a product's data to enrich an email notification.
  • Looking up a transaction record before updating or deleting it.

Properties

Name Type Meaning
Workspace Slug string The unique slug identifier of your Xata workspace.
Database Location options The region where your Xata database is hosted (e.g., us-east-1, us-west-2, eu-west-1).
Database Name string The name of the database you want to access.
Branch Name string The branch within the database to target.
Table Name string The table from which to read the record.
ID string The unique identifier of the record to retrieve.
Pull All Columns boolean If true, returns all columns of the record; if false, only specified columns are returned.
Columns string[] (Shown if "Pull All Columns" is false) List of column names to include in the output.

Output

  • The node outputs the retrieved record as a JSON object.
  • If "Pull All Columns" is enabled, all fields/columns of the record are included.
  • If "Columns" are specified, only those fields are present in the output.
  • In case of error (and if "Continue On Fail" is enabled), the output will contain an error field with the error message.

Example output:

{
  "id": "rec_12345",
  "name": "John Doe",
  "email": "john@example.com"
}

or, if only selected columns:

{
  "id": "rec_12345",
  "email": "john@example.com"
}

Dependencies

  • External Service: Requires access to the Xata API.
  • API Key: You must provide valid Xata API credentials via the xataApi credential in n8n.
  • n8n Configuration: No special environment variables required beyond standard credential setup.

Troubleshooting

Common Issues:

  • Missing Credentials: If no API key is provided, the node will throw an error:
    "No credentials provided for Xata Api".
    Resolution: Ensure that the xataApi credential is set up in n8n and attached to the node.

  • Invalid Record ID: If the specified ID does not exist, the node may return an error message indicating the record was not found.
    Resolution: Double-check the ID value and ensure the record exists in the specified table.

  • Incorrect Table/Database/Branch: Typos or incorrect values in these properties can result in failed requests or empty results.
    Resolution: Verify all property values against your Xata workspace.

  • Column Selection Errors: If you specify columns that do not exist, the output may be missing expected data or could trigger errors depending on Xata's API response.

Links and References


This summary provides a clear understanding of how to use the Xata node in n8n for reading records, what inputs are required, what output to expect, and how to resolve common issues.

Discussion