Discussions

Ask a Question
Back to All

Set existing record's `externalId`

Is there a way to set the externalId of an existing record?

All our environment's records have a null externalId; they were created either through the web console UI or from a CSV import, before we had plans to use externalId. We want to set it for the current records then use PATCH to consistently update and create later.

The API docs for Upserts and external IDs seem to imply that externalId is set on record create with PATCH, but ideally there is a way to add (or remove) it from existing records.

I tried using the standard PUT operation to update an existing record's externalId, but the response was HTTP 500 Internal server error.

e.g., this is the request body I tried for a Customer record:

{
    "objectKey": "customer",
    "json": {
        "externalId": "newextid"
    }
}

A nearly-identical PUT request succeeded for updating the name field on the same record, same auth info, same request headers, etc:

{
    "objectKey": "customer",
    "json": {
        "name": "New name"
    }
}

I also tried the PATCH endpoint with an existing record's ID in the request body:

{
    "objectKey": "customer",
    "json": {
        "id": "<existing record ID>",
        "externalId": "newextid"
    }
}

...but (as expected) it ignored the provided id and created a new record.