Why upsert fails where insert succeeds
Salesforce's REST API implements upsert as a PATCH request to a special endpoint keyed by an External ID field: /sobjects/{ObjectName}/{ExternalIdField}/{ExternalIdValue}. Insert, by contrast, is a plain POST to /sobjects/{ObjectName} with no External ID involved at all. That means upsert has an entire extra layer of requirements insert never touches — the External ID field must exist, must be flagged as "External ID" (and usually "Unique") in the object's field definition, and must have a non-blank value on every record you send.
A community report of exactly this pattern — insert working, upsert on the same custom object returning "Bad request - please check your parameters" — went unresolved in the original thread, with the workaround being to switch to the HTTP Request node and call the Salesforce REST API directly. That workaround succeeds precisely because it exposes the underlying API error text, which the built-in node's generic wrapper had been swallowing.
If insert works and upsert doesn't, stop looking at the object's regular fields and go straight to the External ID field's configuration — that is the one thing upsert requires that insert does not.
External ID field checklist
- The field exists on the custom object and its API name (ending in __c) is spelled exactly as selected in the n8n node's "External ID Field" parameter.
- In Object Manager → Fields & Relationships → the field → Edit, the checkbox "External ID" is checked. A text or number field that is merely "Unique" but not flagged "External ID" cannot be used for upsert.
- The field is populated (non-null, non-blank) on every record in the n8n item you're sending — a blank External ID value on even one row can fail the whole batch depending on how the node processes items.
- If the field is also marked Unique, no two existing records already share the value you're about to upsert with — a pre-existing duplicate value under that key will cause the API to reject the match as ambiguous.
Verify the real error with the HTTP Request node before troubleshooting further
Because the built-in Salesforce node's error message here is generic, the fastest way to see the actual Salesforce error code (INVALID_FIELD, DUPLICATE_VALUE, REQUIRED_FIELD_MISSING, or similar) is to temporarily replicate the same call with an HTTP Request node and "Continue on Fail" turned on so you can inspect the raw response body.
PATCH https://yourInstance.my.salesforce.com/services/data/v62.0/sobjects/Your_Custom_Object__c/Your_External_Id__c/12345
Authorization: Bearer {{ $credentials.salesforceOAuth2Api.oauthTokenData.access_token }}
Content-Type: application/json
{
"Name": "Example Record",
"Status__c": "Active"
}
# Read the JSON error body, not just the HTTP status —
# Salesforce returns an array like:
# [{ "message": "...", "errorCode": "INVALID_FIELD_FOR_INSERT_UPDATE", "fields": [...] }]
Read the errorCode: each one points somewhere different
Salesforce always returns a JSON array on failure, and each entry carries a message, an errorCode, and often the offending field names. That errorCode is the whole diagnosis, and it is the thing the generic wrapper hides. Six codes cover almost every case here, and each points at a different part of the configuration.
INVALID_FIELD means a field name in the body does not exist on the object for this API version — usually a custom field written without its __c suffix, or a namespace prefix dropped from a managed-package field. NOT_FOUND on the URL rather than the body means the External ID field name in the path is wrong. DUPLICATE_EXTERNAL_ID (or a message about the external ID matching multiple records) means two existing records share the value you sent, which makes the target ambiguous; Salesforce refuses rather than guessing.
REQUIRED_FIELD_MISSING names a field that an insert-time Flow or trigger normally fills in but which your upsert body omits. INVALID_FIELD_FOR_INSERT_UPDATE means the field exists but the integration user cannot write it, which is field-level security rather than a schema problem. And FIELD_CUSTOM_VALIDATION_EXCEPTION is a validation rule on the object rejecting the data itself — the message text is whatever the admin wrote, and it is the one case where the fix is a conversation rather than a configuration change.
# What Salesforce actually returns — this is what the node swallows
HTTP 400
[
{ "message": "No such column 'Statuss__c' on sobject of type Your_Object__c",
"errorCode": "INVALID_FIELD" }
]
[
{ "message": "Required fields are missing: [Account__c]",
"errorCode": "REQUIRED_FIELD_MISSING",
"fields": ["Account__c"] }
]
[
{ "message": "Duplicate external id specified: 12345",
"errorCode": "DUPLICATE_VALUE" }
]
# Success looks like this and differs by outcome:
# 201 Created {"id":"a0X...","success":true,"created":true} <- new record
# 204 No Content <- existing record updated
Field-level security: what the integration user can actually write
A field can be perfectly valid and still be rejected because the user behind the OAuth connection cannot edit it. Salesforce enforces field-level security per profile and permission set, so a field the admin sees on the page layout may be hidden or read-only for the integration user. The API then returns INVALID_FIELD_FOR_INSERT_UPDATE, which the built-in node can surface as the same generic bad request.
Check the profile (or permission sets) assigned to the connected user and confirm Edit access to every field in the n8n payload, not just Read access. This is easy to miss when a dedicated integration user was cloned from a minimal profile.
- The connected user needs Edit (not just Read) on every field you send.
- A hidden or read-only field for that user causes INVALID_FIELD_FOR_INSERT_UPDATE.
- Cloned minimal integration profiles are the usual cause.
Read-only and compound fields you cannot send at all
Some fields never accept a write regardless of security. Formula fields, roll-up summary fields, and auto-number fields are always read-only. Audit fields such as CreatedDate and CreatedById require the "Set Audit Fields upon Record Creation" permission and can only be set on insert, never on upsert of an existing record.
Compound fields are the other common mistake. Address fields (BillingAddress, MailingAddress) and the Name field on person-style objects are compound: you must send their components (BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry; FirstName and LastName) and never the compound field itself. Sending BillingAddress as a JSON object is rejected.
- Formula, roll-up, and auto-number fields are always read-only - drop them from the payload.
- Send BillingStreet/BillingCity/... not BillingAddress; send FirstName/LastName not Name.
- Audit fields need a special permission and only work on insert.
The External ID is in the URL, and that has consequences
Because the value sits in the path, anything unusual in it has to be percent-encoded. An external ID containing a slash silently changes the shape of the URL and produces a 404 that looks like a missing record; one containing a space, a plus sign, a hash, or a question mark is truncated or misread in ways that are hard to see from the n8n side. Encode the value before building the URL, and prefer external IDs that are opaque and alphanumeric so the question never arises.
The same positioning explains a second behaviour that surprises people: a null or empty external ID cannot be expressed at all. There is no URL for "the record whose external ID is blank", so an item with a missing key produces a malformed request rather than a clean validation error. Filter those items out before the node and route them somewhere visible, because a batch that includes one can fail in ways that implicate the other items.
For volume, the single-record endpoint is the wrong tool. The composite sobjects collections endpoint upserts up to 200 records in one call and returns a per-record result array, so one bad row does not obscure the other 199 — and with allOrNone set to false, the good rows still land.
# Single record — value is part of the path and must be encoded
PATCH /services/data/v62.0/sobjects/Your_Object__c/Your_External_Id__c/AC%2F123
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json
{ "Name": "Example", "Status__c": "Active" }
# "AC/123" unencoded becomes .../Your_External_Id__c/AC/123 -> 404
# Many records — per-row results instead of one opaque failure
PATCH /services/data/v62.0/composite/sobjects/Your_Object__c/Your_External_Id__c
{ "allOrNone": false,
"records": [
{ "attributes": {"type":"Your_Object__c"}, "Your_External_Id__c": "AC123", "Name": "One" },
{ "attributes": {"type":"Your_Object__c"}, "Your_External_Id__c": "AC124", "Name": "Two" }
] }
# -> [ {"id":"a0X...","success":true,"errors":[]},
# {"success":false,"errors":[{"statusCode":"REQUIRED_FIELD_MISSING",...}]} ]
Documentation and community threads cited
Salesforce's upsert-by-External-ID REST API behavior is documented Salesforce platform behavior. The specific n8n symptom (insert works, upsert on the same custom object returns a generic bad request) and the HTTP Request node workaround come from a report on the n8n Community forum.
Frequently asked questions
Can any field be used as the External ID field for a Salesforce upsert?
No. The field must be explicitly marked "External ID" in its field definition under Object Manager. A field that is only marked "Unique", or an ordinary text/number field with no special flag, cannot be used as the match key for the API's upsert endpoint.
Why does the Salesforce node give such a vague error compared to a direct API call?
The built-in node wraps the Salesforce REST API response, and in some versions that wrapper does not surface the full error array (message, errorCode, and affected fields) that Salesforce actually returns. Replicating the same call with an HTTP Request node and reading the raw JSON response shows the specific errorCode.
Is switching permanently to the HTTP Request node the right long-term fix?
It's a reasonable permanent choice if you need to see exact Salesforce error codes for handling logic (e.g. branching on DUPLICATE_VALUE vs REQUIRED_FIELD_MISSING), but it means maintaining the endpoint URL and payload shape yourself. If the built-in node's upsert works once the External ID field is configured correctly, there's no need to switch.
How do I see the real Salesforce error instead of the generic one?
Reproduce the same PATCH with an HTTP Request node and Continue On Fail enabled, then read the JSON array in the response body. Every entry carries an errorCode — INVALID_FIELD, REQUIRED_FIELD_MISSING, DUPLICATE_VALUE — and that code is the actual diagnosis.
Why does upsert return 204 with no body when it works?
Salesforce returns 201 with the record id when the upsert created a record, and 204 No Content when it matched and updated an existing one. An empty body on 204 is success, not a failure — do not treat a missing id as an error.