Chilkat Online Tools

C# / Braze Endpoints / External ID Rename

Back to Collection Items

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Chilkat.Http http = new Chilkat.Http();
bool success;

// Use this online tool to generate code from sample JSON: Generate Code to Create JSON

// The following JSON is sent in the request body.

// {
//   "external_id_renames": [
//     {
//       "current_external_id": "existing_external_id",
//       "new_external_id": "new_external_id"
//     }
//   ]
// }

Chilkat.JsonObject json = new Chilkat.JsonObject();
json.UpdateString("external_id_renames[0].current_external_id","existing_external_id");
json.UpdateString("external_id_renames[0].new_external_id","new_external_id");

http.SetRequestHeader("Content-Type","application/json");
// Adds the "Authorization: Bearer {{api_key}}" header.
http.AuthToken = "{{api_key}}";

Chilkat.HttpResponse resp = http.PostJson3("https://rest.iad-01.braze.com/users/external_ids/remove","application/json",json);
if (http.LastMethodSuccess == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

Debug.WriteLine(Convert.ToString(resp.StatusCode));
Debug.WriteLine(resp.BodyStr);

Curl Command

curl -X POST
	-H "Content-Type: application/json"
	-H "Authorization: Bearer {{api_key}}"
	-d '{
  "external_id_renames" : 
  [
    {
      "current_external_id": "existing_external_id",
      "new_external_id" : "new_external_id"
    }
  ]
}'
https://rest.iad-01.braze.com/users/external_ids/remove

Postman Collection Item JSON

{
  "name": "External ID Rename",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "type": "text",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "type": "text",
        "value": "Bearer {{api_key}}"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"external_id_renames\" : \n  [\n    {\n      \"current_external_id\": \"existing_external_id\",\n      \"new_external_id\" : \"new_external_id\"\n    }\n  ]\n}"
    },
    "url": {
      "raw": "https://{{instance_url}}/users/external_ids/remove",
      "protocol": "https",
      "host": [
        "{{instance_url}}"
      ],
      "path": [
        "users",
        "external_ids",
        "remove"
      ]
    },
    "description": "For security purposes, this feature is disabled by default. To enable this feature, please reach out to your Success Manager.\n\nUse this endpoint to “rename” your users’ external IDs. This endpoint sets a new (primary) `external_id` for the user and deprecates their existing `external_id`. This means that the user can be identified by either `external_id` until the deprecated one is removed. The deprecated ID can be removed using the [remove endpoint](https://www.braze.com/docs/api/endpoints/user_data/external_id_migration/post_external_ids_remove). Having multiple external IDs allows for a migration period whereby older versions of your apps still in the wild that use the previous external ID naming schema don’t break. We highly recommend removing deprecated external IDs once your old naming schema is no longer in use.\n\n>You can send up to 50 external IDs per request.<br><br>You will need to create a new [API key](https://www.braze.com/docs/api/api_key/) with permissions for this endpoint.\n\n### Request Parameters\n| Parameter | Required | Data Type | Description |\n| --------- | ---------| --------- | ----------- |\n| `external_id_renames` | Required | Array of external ID rename objects | View request example and the following limitations for structure of external ID rename object |\n\n- The `current_external_id` must be the user’s primary ID, and cannot be a deprecated ID\n- The `new_external_id` must not already be in use as either a primary ID or a deprecated ID\n- The `current_external_id` and `new_external_id` cannot be the same\n\n## Response Body\nThe response will confirm all successful renames, as well as unsuccessful renames with any associated errors. Error messages in the `rename_errors` field will reference the index of the object in the array of the original request.\n\n```\n{\n\n  \"message\" : (string) status message,\n  \"external_ids\" : (array of successful Rename Operations),\n  \"rename_errors\": (array of any <minor error message>)\n\n}\n```\n\nThe `message` field will return `success` for any valid request. More specific errors are captured in the `rename_errors` array. The `message` field returns an error in the case of:\n- Invalid API key\n- Empty `external_id_renames` array\n- `external_id_renames` array with more than 50 objects\n- Rate limit hit (>1,000 requests/minute)\n\n## Frequently Asked Questions\n\n__Does this impact MAU?__\n- No, since the number of users will stay the same, they’ll just have a new `external_id`.\n\n__Does user behavior change historically?__\n- No, since the user is still the same user, and all their historical behavior is still connected to them.\n\n__Can it be run on dev/staging app groups?__\n- Yes. In fact, we highly recommend running a test migration on a staging or development app group, and ensuring everything has gone smoothly before executing on production data.\n\n__Does this consume data points?__\n- This feature does not cost data points.\n\n__What is the recommended deprecation period?__\n- We have no hard limit on how long you can keep deprecated external IDs around, but we highly recommend removing them once there is no longer a need to reference users by the deprecated ID."
  },
  "response": [
  ]
}