NocoDb (Upsert) icon

NocoDb (Upsert)

Read, update, write and delete data from NocoDb

Overview

This node allows you to create or update rows in a NocoDb table, supporting an "upsert" operation that either inserts a new row or updates an existing one if it already exists. It is useful when you want to synchronize data with NocoDb without manually checking if a record exists first.

Common scenarios include:

  • Importing or syncing data from other sources where some records may already exist.
  • Automating data entry workflows where updates and inserts happen dynamically.
  • Managing database records programmatically with minimal API calls.

For example, you can use this node to upsert customer information into a NocoDb table: if the customer ID exists, their details are updated; if not, a new record is created.

Properties

Name Meaning
Authentication Choose the authentication method: "API Token" or "User Token".
API Version Select the version of the NocoDb API to use: "Before v0.90.0", "v0.90.0 Onwards", or "v0.200.0 Onwards".
Workspace Name or ID (Only for API v0.200.0 onwards) Select or specify the workspace by name or ID.
Base Name or ID (Only for API v0.200.0 onwards) Select or specify the base/project by name or ID. Required.
Project ID (For API versions before v0.200.0) Specify the project ID as a string or select from list depending on version. Required.
Table Name or ID Select or specify the table to operate on by name or ID. Required.
Primary Key Type Select the primary key type used in the table: "Default" (id), "Imported From Airtable" (ncRecordId), or "Custom" (specify custom primary key field). Used for update/upsert/delete operations.
Row ID Value The value of the primary key field identifying the row to update or upsert. Required for update and upsert operations (API v0.200.0 onwards).
Data to Send Choose how to provide data for the row: "Auto-Map Input Data to Columns" (input JSON keys match column names) or "Define Below for Each Column" (manually specify fields).
Inputs to Ignore (When auto-mapping input data) Comma-separated list of input properties to exclude from sending to NocoDb.
Fields to Send (When defining fields manually) Add multiple fields specifying the field name, whether it contains binary data, and the value or binary property to upload.

Output

The node outputs an array of JSON objects representing the rows that were created or updated. Each object includes the fields sent to NocoDb along with any additional metadata returned by the API.

  • For create operations, the output contains the newly created rows with their assigned IDs.
  • For update operations, the output confirms success or provides error details if a row could not be updated.
  • For upsert operations, each output item includes an _action field indicating whether the row was "inserted" or "updated".

If binary files are uploaded as part of the row data, the node handles uploading them to NocoDb's storage endpoint and stores references to these files in the respective fields.

Dependencies

  • Requires access to a NocoDb instance with appropriate API credentials.
  • Supports two authentication methods: API token or user token.
  • Uses NocoDb REST API endpoints, which vary depending on the selected API version.
  • If uploading binary files, the node uses multipart form-data requests to NocoDb's storage upload endpoint.
  • Requires n8n credentials configured with valid tokens for authentication.

Troubleshooting

  • Error: Row with the specified ID could not be found or updated
    This occurs if the primary key value does not exist during update or upsert operations. Ensure the correct ID is provided and matches the primary key type selected.

  • Error: No base/project selected
    For API versions requiring workspace and base selection, ensure these parameters are set correctly.

  • Binary file upload failures
    Check that the binary property specified exists and contains valid binary data. Also verify that the API version supports file uploads and that the credentials have permission.

  • API request errors
    Network issues, invalid credentials, or incorrect API version settings can cause failures. Verify all configuration parameters and credentials.

  • Continue on Fail behavior
    When enabled, the node will continue processing remaining items even if some fail, returning error messages in the output for failed items.

Links and References

Discussion