Track sync results with the Journal API
Optimizely Graph processes the content you sync asynchronously. A successful response from the sync endpoint means that Optimizely Graph accepted the batch, not that the batch is indexed. The Journal API tells you what happened to each batch after Optimizely Graph accepted it.
Use the Journal API to do the following:
- Read the per-item result of a single sync batch.
- Group the batches of one sync run into an indexing job and check the status of the job.
- List recent batches.
Note
The Optimizely Graph integration for CMS (PaaS) uses the Journal API automatically when it syncs content. You only need this page if you sync content with your own client.
Important
Use the Journal API to check and troubleshoot sync results. The format of journal records can change without notice. Do not build tools that depend on the exact structure of journal records.
Before you begin
Review the following constraints:
- Optimizely Graph keeps journal records and indexing job records for seven days. After that, a lookup returns 404.
- The sync endpoint returns journal IDs with a stream/ prefix, such as stream/0b7f4c1e-3a9d-4f2b-8c6e-5d1a2b3c4d5e. Remove the prefix before you pass the ID to a Journal API endpoint.
- Journal records belong to the account that synced the content. The Journal API returns only the journals of your own account.
- Property names use mixed casing. Batch journals use camelCase. Operation results inside items use PascalCase, and so do indexing job responses. A few properties stay lowercase, such as _index, _id, _version, id, and _uid. Query results use PascalCase for Count and Value. Use the property names in each example, or parse responses case-insensitively.
The Journal API uses the same authorization as the sync endpoints. Use epi-hmac authorization in production. The examples on this page use Basic authorization for readability. The following endpoints are available:
- GET /journal/stream/JOURNAL_ID – Gets the result of one sync batch.
- GET /journal/stream/query – Lists the sync batches that match a set of filters.
- POST /journal/indexing – Registers an indexing job.
- GET /journal/indexing/JOB_ID – Lists the batches in an indexing job.
- GET /journal/indexing/JOB_ID/status – Gets the status of an indexing job.
Get the journal ID of a sync batch
When the sync endpoint accepts a batch, the response contains a journal ID. Store the ID to check the result of the batch later.
curl --request POST \
'https://cg.optimizely.com/api/content/v2/data?id=com' \
--header 'Content-Type: application/x-ndjson' \
--header 'Authorization: Basic BASE64_CREDENTIALS' \
--header 'og-job-id: 6f1c2a4e-1b0d-4c55-9d1e-2f7b3c9a8e10' \
--data-binary @batch.ndjsonThe response contains the journal ID:
{
"journalId": "stream/0b7f4c1e-3a9d-4f2b-8c6e-5d1a2b3c4d5e"
}The request and the response use the following values:
- journalId – Identifies the batch. Remove the stream/ prefix before you call the Journal API.
- og-job-id – (Optional) A request header that tags the batch with your own job ID. To list the batches of a sync run, use the job_id filter in List recent batches.
If the response has no journalId, Optimizely Graph did not accept the batch. Send the batch again.
The bulk completed webhook event includes the journal ID in data.journalId, without the stream/ prefix. Use this ID to look up the batch directly. The webhook does not confirm the final result:
- The webhook can arrive before the batch finishes processing, while the batch is still Processing.
- Optimizely Graph sends the webhook only when at least one item changes.
To confirm the final result, check the batch with the stream journal endpoint until it reports Succeeded or Failed.
Check the result of a batch
Use the stream journal endpoint to read the per-item result of one batch.
curl --request GET \
'https://cg.optimizely.com/journal/stream/0b7f4c1e-3a9d-4f2b-8c6e-5d1a2b3c4d5e' \
--header 'Authorization: Basic BASE64_CREDENTIALS'var client = new HttpClient();
var request = new HttpRequestMessage(
HttpMethod.Get,
"https://cg.optimizely.com/journal/stream/0b7f4c1e-3a9d-4f2b-8c6e-5d1a2b3c4d5e"
);
request.Headers.Add("Authorization", "Basic BASE64_CREDENTIALS");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
var journal = await response.Content.ReadAsStringAsync();The following example response shows a batch where one item failed:
{
"id": "0b7f4c1e-3a9d-4f2b-8c6e-5d1a2b3c4d5e",
"status": "Failed",
"errors": true,
"took": 0,
"jobId": "6f1c2a4e-1b0d-4c55-9d1e-2f7b3c9a8e10",
"createdAt": "2026-11-20T09:14:02Z",
"executedAt": "2026-11-20T09:14:05Z",
"items": [
{
"name": "Blue T-shirt",
"index": { "_index": "com_en", "_id": "p-100_en", "Status": 201, "_version": 1, "Result": "created" }
},
{
"name": "Red T-shirt",
"message": "failed to parse field [Quantity]",
"index": {
"_index": "com_en",
"_id": "p-101_en",
"Status": 400,
"Error": { "Type": "mapper_parsing_exception", "Reason": "failed to parse field [Quantity]" }
}
}
]
}The response contains the following properties:
- status – Processing, Succeeded, or Failed. A batch is Failed if any item in the batch failed.
- errors – Deprecated. Use status instead. The value is true when status is Failed.
- items – One entry for each operation in the batch. Each entry can contain the following properties:
- name – The name of the content item, taken from its Name property. Optimizely Graph omits this property when the item has no name.
- index, delete, or delete_by_query – The result of the operation, in the property that matches the operation type. Status is the HTTP status code of the item, and Result says what happened, such as created or updated. A skipped item has no Status, and its Result gives the reason, such as The content is unchanged.. Skipped items count as successful.
- message – The error message for a failed index, delete, or delete_by_query operation. Optimizely Graph omits this property when the operation has no error.
- error – The error message for any other operation. These operations have no result property of their own. Optimizely Graph puts their result, if one exists, in index and their error message in error instead of message. When Optimizely Graph cannot parse a line, the entry for that line has no result and contains only error.
The endpoint returns 404 if the journal does not exist or has expired. It returns 429 if the journal store is busy. Wait and try again.
Note
If a batch is Failed and items is empty, the batch failed as a whole, and no item results were recorded. Send the batch again. If it fails again, contact Optimizely Support.
Track an indexing job
An indexing job groups the batches of one sync run. Check one job status instead of the status of each batch. To track a sync run, complete the following steps:
- Generate a unique job ID, such as a globally unique identifier (GUID).
- Send each batch to the sync endpoint with the job ID in the og-job-id header.
- Store the journalId of each batch that the sync endpoint accepts.
- After you send the last batch, register the indexing job with the job ID and the journal IDs. Register the job only once. A second request with the same id returns 409 Conflict, and the job keeps its original list of batches.
- Poll the job status every 30 to 60 seconds until it is Success. Use a time limit so the loop always ends. The CMS (PaaS) integration polls every 60 seconds. An Error status means that at least one batch failed, but other batches can still be in progress. To collect every failed batch, keep polling until both of the following are true:
- QueuedJournalIds is 0.
- TotalJournalIds equals the number of batches you registered.
- If the status is Error, read each journal in FailingJournals to find the failed items.
- Sync only the failed items again. Optimizely Graph already indexed the items that succeeded. For a failed batch with no items, follow the guidance in Check the result of a batch.
Register the job
Send a POST request to /journal/indexing with your job ID and the journal IDs of the batches:
curl --request POST \
'https://cg.optimizely.com/journal/indexing' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic BASE64_CREDENTIALS' \
--data '{
"id": "6f1c2a4e-1b0d-4c55-9d1e-2f7b3c9a8e10",
"details": [
{ "id": "0b7f4c1e-3a9d-4f2b-8c6e-5d1a2b3c4d5e" },
{ "id": "9a8b7c6d-5e4f-4a3b-2c1d-0e9f8a7b6c5d" }
]
}'var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://cg.optimizely.com/journal/indexing");
request.Headers.Add("Authorization", "Basic BASE64_CREDENTIALS");
request.Content = new StringContent(
@"{
""id"": ""6f1c2a4e-1b0d-4c55-9d1e-2f7b3c9a8e10"",
""details"": [
{ ""id"": ""0b7f4c1e-3a9d-4f2b-8c6e-5d1a2b3c4d5e"" },
{ ""id"": ""9a8b7c6d-5e4f-4a3b-2c1d-0e9f8a7b6c5d"" }
]
}",
Encoding.UTF8,
"application/json"
);
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();The request body has the following properties:
- id – (Required) Your job ID. Use a unique value for each sync run.
- details – (Required) One entry for each batch that the sync endpoint accepted, with the stream/ prefix removed. Leave out batches that failed to send. Keep each job under 600,000 journal IDs.
The request returns 201 Created with the job ID.
Get the job status
Send a GET request to /journal/indexing/JOB_ID/status:
curl --request GET \
'https://cg.optimizely.com/journal/indexing/6f1c2a4e-1b0d-4c55-9d1e-2f7b3c9a8e10/status' \
--header 'Authorization: Basic BASE64_CREDENTIALS'The following example response shows a job with one failed batch:
{
"Status": "Error",
"Id": "6f1c2a4e-1b0d-4c55-9d1e-2f7b3c9a8e10",
"FailingJournals": ["9a8b7c6d-5e4f-4a3b-2c1d-0e9f8a7b6c5d"],
"TotalJournalIds": 2,
"SucceededJournalIds": 1,
"FailedJournalIds": 1,
"QueuedJournalIds": 0
}The response contains the following properties:
- Status – The status of the job. See the following list.
- FailingJournals – The journal IDs of the failed batches.
- SucceededJournalIds, FailedJournalIds, QueuedJournalIds – The number of batches in each state.
- TotalJournalIds – The number of batches that have a journal record. The value is the sum of SucceededJournalIds, FailedJournalIds, and QueuedJournalIds, not the number of batches you registered. If it is lower than the number of batches you registered, some batches have no journal record.
Optimizely Graph calculates the job status from the batches in the job:
- Success – Every registered batch succeeded, or the job contains no batches.
- Error – At least one batch failed, even if other batches are still in progress.
- Processing – Any other case, including a job where no batch has a journal record.
A batch without a journal record counts as not started, not as failed. If no recorded journal reports a failure, a missing journal keeps the job in Processing. The job stays in Processing even when every other batch succeeded. A recorded failure returns Error.
The status of a batch is final when it is Succeeded or Failed. A job status can change until every batch finishes. For example, a job that reports Error can still have batches in progress.
The endpoint returns 404 if the job does not exist or has expired. A job expires seven days after you register it. The endpoint also returns 404 for a short time when the journal store is busy. Retry before you treat the job as missing.
List the batches in a job
Send a GET request to /journal/indexing/JOB_ID:
curl --request GET \
'https://cg.optimizely.com/journal/indexing/6f1c2a4e-1b0d-4c55-9d1e-2f7b3c9a8e10' \
--header 'Authorization: Basic BASE64_CREDENTIALS'The response lists each batch in the job:
{
"id": "6f1c2a4e-1b0d-4c55-9d1e-2f7b3c9a8e10",
"_uid": "6f1c2a4e-1b0d-4c55-9d1e-2f7b3c9a8e10",
"TenantId": "TENANT_ID",
"CreatedAt": "2026-11-20T09:40:11Z",
"UpdatedAt": "2026-11-20T09:40:11Z",
"Details": [
{ "Id": "0b7f4c1e-3a9d-4f2b-8c6e-5d1a2b3c4d5e", "Status": "Done" },
{ "Id": "9a8b7c6d-5e4f-4a3b-2c1d-0e9f8a7b6c5d", "Status": "Processing" }
]
}The response contains the following properties:
- Details – The batches in the job. The Status of a batch is Done when Optimizely Graph has a journal record for it, and Processing otherwise. Done does not mean that the batch succeeded. To find failed batches, use Get the job status.
- TenantId – The account that owns the job.
- CreatedAt – When Optimizely Graph created the job record.
- UpdatedAt – When Optimizely Graph last updated the job record.
List recent batches
The query endpoint returns the stream journals that match your filters. By default, the endpoint sorts results by creation time, from newest to oldest.
curl --request GET \
'https://cg.optimizely.com/journal/stream/query?source_routing=-1&status=Processed&min_created_at=2026-11-20T00:00:00Z&take=50' \
--header 'Authorization: Basic BASE64_CREDENTIALS'The endpoint accepts the following query parameters:
- source_routing – Set to -1 to list the batches of every source. To find the batches of one sync run, use job_id.
- job_id – Lists the batches that were sent with this og-job-id header.
- status – Processed lists finished batches (Succeeded or Failed). Queued lists batches that are still Processing.
- min_created_at, max_created_at – The creation time range in ISO 8601 format. These parameters replace start_time and end_time, which are deprecated. The time range applies only when you also set status.
- updated_at – Lists batches updated at or after this time.
- skip – The number of results to skip. The default is 0.
- take – The number of results to return. The default is 20 and the maximum is 1000.
- latest_first – The sort order by creation time. true sorts from newest to oldest, and false sorts from oldest to newest. The default is true.
The response contains a page of stream journals and the total number of matches:
{
"Count": 312,
"Value": [
{
"id": "0b7f4c1e-3a9d-4f2b-8c6e-5d1a2b3c4d5e",
"status": "Succeeded",
"jobId": "6f1c2a4e-1b0d-4c55-9d1e-2f7b3c9a8e10",
"createdAt": "2026-11-20T09:14:02Z"
}
]
}A negative skip, a take outside the allowed range, or a reversed time range returns 400.
Authorization
The acceptable authorization methods are Basic and epi-hmac, the same as for the sync endpoints.
Basic:
- Username – AppKey
- Password – Secret
Encode APP_KEY:SECRET with Base64, and send the result as Authorization: Basic BASE64_CREDENTIALS.
epi-hmac – Your client signs each request with a hash-based message authentication code (HMAC) that uses SHA-256. The key is the Secret, decoded from Base64. To build the signed message, join the following values in order, without separators:
- The AppKey.
- The HTTP method.
- The request path and query string, without the scheme and host.
- A timestamp in milliseconds.
- A nonce, which is a random value that you use only once.
- The MD5 hash of the request body, encoded in Base64.
Send the signature in the following header: Authorization: epi-hmac APP_KEY:TIMESTAMP:NONCE:SIGNATURE. For a complete example, see Authorization in Sync content types for external data. With epi-hmac, the request does not include the Secret, so a captured request does not expose it.
Troubleshoot
Use the following checks to resolve common issues with the Journal API.
The job status stays Processing
- Symptoms – The job status does not change to Success or Error, and QueuedJournalIds is 0 or does not decrease.
- Resolution – Compare TotalJournalIds with the number of batches you registered. If TotalJournalIds is lower, some batches have no journal record. Find them with GET /journal/indexing/JOB_ID, where their Status is Processing. The lookup misses a journal that expired, or a journal ID that you registered with the stream/ prefix. In rare cases, the lookup also misses a batch because Optimizely Graph did not create its journal record. Register a job with the remaining batches, or check the batches one by one. If Optimizely Graph did not create the journal record, send that batch again. Register its new journal ID in a new job.
The job registration returns 413
- Symptoms – POST /journal/indexing returns 413 Payload Too Large at the end of a large sync.
- Resolution – Keep each job under 600,000 journal IDs. For a larger sync run, split the batches across several indexing jobs. Give each job its own job ID, and poll each job.
The journal lookup returns 404
- Symptoms – GET /journal/stream/JOURNAL_ID returns 404 for a batch that the sync endpoint accepted.
- Resolution – Check that you removed the stream/ prefix from the ID and that the batch is less than seven days old. A journal record can take a short time to become available after the sync endpoint accepts the batch. In rare cases, Optimizely Graph does not create the journal record of an accepted batch. Optimizely Graph usually still processes such a batch, but you cannot confirm the result. To confirm it, send the batch again and check the journal ID of the new response. Optimizely Graph skips unchanged items with the result The content is unchanged.. If you sent newer versions of these items after the original batch, send the current versions instead.
The list of batches ignores the time range
- Symptoms – GET /journal/stream/query returns batches outside the min_created_at and max_created_at range.
- Resolution – Add the status parameter. The time range applies only when status is set.