Consumption Sync (Offline Method)
Syncs consumption events and device variables for one license, or for every member of a bundle, from a request file. Every event carries its own id and is applied exactly once, so the same file can always be uploaded again safely. The response file tells the device which events were applied, which were rejected and why, and contains a signed license snapshot per product.
Endpoint
Method:
POSTPath:
/api/v4/consumption_sync_offline/Description: Applies a batch of consumption events and device variables from an offline request file (base64 payload) and returns the response as a file.
Authentication
Required headers
Date(string) — RFC7231 GMT date stringAuthorization(string) — signature or bearer token
Recommended headers
Accept: application/jsonContent-Type: text/plain
Request
Body
The request body is a base64-encoded, stringified JSON envelope containing the sync request object and its signature (see Signature). A request can be up to 4 MB; larger requests are refused with HTTP 413.
Examples
Schema
Request Body
The decoded file is an envelope:
{ "request": <sync request object>, "signature": <signature> }.
The sync request object is the same as for the online method, plus the offline fields date, api_key or client_id, and, for device-bound licenses, signature and the TPM or hardware-key signature.
The fields of the request object are described on the online method page (license entries, resources and events). The offline-only fields:
date(string) — ISO 8601 UTC date the request file was createdapi_key(string) orclient_id(string) —client_idfor OAuth-configured accountssignature(string) — the v1 offline signature, required for TPM and hardware-key licenses, see Device-bound licenseslicensespring-tpm-signature/licensespring-hardware-key(string) — TPM and hardware-key licenses only
Signature
The envelope signature is an HMAC-SHA256 over the request object, signed with the company shared key (or client secret for OAuth):
Example (Node.js):
Device-bound licenses
For TPM and hardware-key licenses, the request object also carries a v1 offline signature, built like the signature of an offline activation request:
HMAC-SHA256("licenseSpring\ndate: <date>\n<license_key or username>\n<hardware_id>\n<api_key or client_id>", signingKey), base64-encoded.
For a bundle, use the bundle's license key.
The licensespring-tpm-signature or licensespring-hardware-key field then signs that v1 signature. Add these fields before computing the envelope signature.
Finalized payload
Wrap the request JSON and its signature in the envelope and encode it to base64.
Send the resulting base64 string as the raw request body, or as the file field of a multipart request.
Response Body
On success, the endpoint responds with HTTP 200 and the downloadable file
sync_response.lic (Content-Disposition: attachment).
The file contains the same JSON as the online method response, and the response carries the same LicenseSignature header.
request_id— echoes the request file'srequest_id. Discard a response file whoserequest_iddoesn't match the pending request.processed_ids— every applied event ID, including IDs applied by an earlier sync; remove exactly these from the local journal.countis the total actually applied for them.rejected_ids— events that were not applied, with a code; see Rejection codes for which ones to retry.Anything from the request that appears in neither
processed_idsnorrejected_ids, including an omitted product, is still pending and belongs in the next request file.offline_checkout— present when the device holds an offline checkout from a consumption pool. Synced usage is recorded inconsumed; a sync never applies more thanremaining.
Response signatures
Each product entry in the response file is signed three ways:
license_signature— HMAC-SHA256 signature explained in Response Signature.offline_signature— HMAC-SHA256 signature constructed identically to the v1 requestsignature(see Device-bound licenses), but using the responsedatevalue.license_signature_v2— RSA-SHA256 signature over the product entry's compact JSON, in the key order received, with only thelicense_signature_v2field removed.
License Authorization Method
There are two types of product licenses based on how the client application authorizes itself to interact with a license:
Key-based product licenses: the license entry uses
license_keyUser-based product licenses: the license entry uses
username
Errors
These errors fail the whole request: nothing from the file is applied and no response file is produced. The response has an HTTP status code of 400 or higher and the response body contains an error description in the following format:
When one of the licenses in licenses cannot be found or authenticated, the message ends with (product: <code>) so you know which entry caused it. Every entry is checked before anything is written, so the other entries are not applied either.
List of exceptions
Deactivating after a sync
Deactivate License (Offline Method) does not accept sync events. After a device has synced, the consumptions in its deactivation file must only contain the usage recorded since the last sync, otherwise it is counted twice. Bundle deactivation ignores consumptions, so sync a bundle's usage before deactivating it.
Guide on using Offline Licenses
If any aspect of the offline licensing model remains unclear, see Offline License Activation.
Last updated
Was this helpful?