Skip to content

Track users (synchronous)

post

/users/track/sync

Use this endpoint to record custom events and purchases and update user profile attributes synchronously. This endpoint functions similarly to the /users/track endpoint, which updates user profiles asynchronously.

Synchronous and asynchronous API calls

In an asynchronous call, the API will return the status code 201, indicating that your request was successfully received, understood, and accepted. However, this does not mean that your request has been fully completed.

In a synchronous call, the API will return a status code 201, indicating that your request was successfully received, understood, accepted, and completed. The call response will show select user profile fields as a result of the operation.

This endpoint has a lower rate limit than the /users/track endpoint (see rate limit below). Each /users/track/sync request can contain only one event object, one attribute object, or one purchase object. This endpoint should be reserved for user profile updates where a synchronous call is needed. For a healthy implementation, we recommend using /users/track/sync and /users/track together.

For example, if you’re sending consecutive requests for the same user over a short period of time, race conditions are possible with the asynchronous /users/track endpoint, but with the /users/track/sync endpoint you can send those requests in sequence, each after receiving a 2XX response.

Prerequisites

To use this endpoint, you’ll need an API key with the users.track.sync permission.

Customers using the API for server-to-server calls may need to allowlist rest.iad-01.braze.com if they’re behind a firewall.

Rate limit

We apply a base speed limit of 500 requests per minute to this endpoint for all customers. Each /users/track/sync request can contain up to one event object, one attribute object, or one purchase object. Each object (event, attribute, and purchase arrays) can update one user each.

Request body

Request parameters

Parameter Required Data Type Description
attributes Optional One attributes object See user attributes object
events Optional One event object See events object
purchases Optional One purchase object See purchases object

Responses

When using this endpoint’s request parameters, you should receive one of the following responses: a successful message or a message with fatal errors.

Successful message

Successful messages will return the following response, which includes information about the user profile data that was updated.

Message with fatal errors

If your message has a fatal error, you’ll receive the following response:

Example requests and responses

Update a custom attribute by external ID

Request

Response

Update a custom event by email

Request

Response

Update a purchase event by user alias

Request

Response

Frequently asked questions

Should I use the asynchronous or synchronous endpoint?

For most profile updates, the /users/track endpoint will work best because of its higher rate limit and flexibility to let you batch requests. However, the /users/track/sync endpoint is useful if you’re experiencing race conditions due to rapid, consecutive requests for the same user.

Does the response time differ from the /users/track endpoint?

With a synchronous call, the API waits until the request is completed to return a response. As a result, synchronous requests will take longer on average than asynchronous requests to /users/track. For the majority of requests, you can expect a response within seconds.

Can I send multiple requests at the same time?

Yes, as long as the requests are for different users, or each request updates different attributes, events, purchases for one user.

If you’re sending multiple requests for a user, for the same attribute, event, or purchase, Braze recommends waiting for a successful response between each request to prevent race conditions from occurring.

Why doesn’t the response value match the one in my original request?

Although your request is completed, it’s possible your custom attribute value didn’t update. This can happen when your custom attribute update exceeds the maximum number of characters, exceeds array limits, or if the user does not exist in Braze and you have _update_existing_only = true.

In these cases, treat the response as an indication that your request, while completed, your desired update has not been made. Troubleshoot with the reasons why this may happen from above.

HOW HELPFUL WAS THIS PAGE?
New Stuff!