**Source URL:** https://general.veevavault.dev/vault-sdk/sdk-integrations/spark-messaging/message-format.md

# Message Format



Spark messages are always in a consistent format. The following is an example of a Spark message:

```

POST / HTTPS/1.1
Content-Type: application/json
Host: regionxyz.its.proxy.veevavault.com
Connection: Keep-Alive
User-Agent: Veeva Vault Spark Message Agent
X-VaultAPISignature-CertificateId: 00001
X-VaultAPISignature-ExecutionId: a123bede-32cb-4dbc-a7d9
X-VaultAPISignature-RequestId: ffjkek809809fjklkfjlkjf89
X-VaultAPISignature-RequestDateTime: 2012-04-25T21:49:27.719Z
X-VaultAPISignature-RequestNotBefore: 2012-04-25T21:48:27.719Z
X-VaultAPISignature-RequestNotAfter: 2012-04-25T21:54:27.719Z
X-VaultAPISignature-RequestType: spark_message
X-VaultAPISignature-URL: https//www.etech.com/Fservices/vaultmessage
X-VaultAPISignature-VaultId: 1000023
X-VaultAPI-Signature: DMXvB8r9R83tGoNn0ecwd5UjllzsvSvbItzfaMpN2nk5HVSw7XnOn49IkxDKz8YrlH2qJXj2iZB0Zo2O71c4qQk1fMUDi3LGpij7RCW7AW9vYYsSqIKRnFS94ilu7
X-VaultAPI-SignatureV2: ZEn78/hRc5Xip9/S2zAeJoaeD0ZkC1go3hOABF3dW/+/P+ATEZZiq/8L39ohTj052e+/F35ggteJtiXpddyStRrA9fYkDuAMDcQLhJ6tTIlHmL6jz6/0hjqavm5VbeGLAxcTqnSDDtKmXN4uBPsuV83reVekeDDkeRVZ2MkbPR7rkXNLt4AA1DhLS4vstwpAhHapuIWyt06npuB6HNfZL

{
  "vault_name" : "Megatech RIM Vault",
  "vault_host_name" : "biorad-rim.veevavault.com",
  "queue_name" : "study_sync_with_med_innovation__c",
  "enter_queue_timestamp" : "2012-04-25T21:49:25.719Z",
  "send_message_timestamp" : "2012-04-25T21:49:27.719Z",
  "send_attempt" : 2,
  "message_id" : "bb28d4ca-3a37-4fef-91ae-93c3a4ec1d8d",
  "message" : {
               "attributes": {
                              "object" : "product_brand__c",
                              "has_related" : true,
                              "related_count" : 100,
                              "authorization" :
                                  "A109315AC45D0FA76A5891FE25B2FCBB1AEBDBDDF
                                   25008682BEC50BF43F5DD9A96700A962515703060
                                   53E4571108799F7141A1857A571786AEF5A626655
                                   7B380"
                             },
               "items": [
                          "OP0000000010I13",
                          "OP0000000000I09",
                          "OP0000000022T06"
                        ]
               }
}

```

### Headers {#headers}

Note that message headers may show in a different case depending on the receiving host, so developers should be prepared to handle the headers as case-insensitive.

| Name | Description |
| --- | --- |
| `Host` | Vault’s outbound proxy host name. |
| `User-Agent` | The client software originating the request. For Spark messaging, this will always be `Veeva Vault Spark Message Agent`. |
| `X-VaultAPISignature-CertificateId` | A certificate ID unique to this message. The application receiving this message must use this ID to [retrieve the public key](/vault-api/api-reference/26.1/managing-vault-java-sdk/retrieve-signing-certificate). |
| `X-VaultAPISignature-ExecutionId` | A unique ID to identify the execution thread. |
| `X-VaultAPISignature-RequestId` | A unique request ID, such as Message ID. |
| `X-VaultAPISignature-RequestDateTime` | The time this message was sent. |
| `X-VaultAPISignature-RequestNotBefore` | The time when this message first becomes valid. You should not attempt to verify a message before this time. |
| `X-VaultAPISignature-RequestNotAfter` | The time when this message first becomes invalid. You should not attempt to verify a message after this time. |
| `X-VaultAPISignature-RequestType` | The type of request, either `spark_message` or `http_callout`. |
| `X-VaultAPISignature-URL` | The URL of the request from the `QueueService.putMessage(Message)` call. This is the intended recipient of the message. |
| `X-VaultAPISignature-VaultId` | The Vault ID which sent this message. |
| `X-VaultAPI-Signature` | For Vault version 20R1.0: The message signature, signed with Vault’s private key. You need this value to [verify the message](/vault-sdk/sdk-integrations/spark-messaging/message-signing-verification/). |
| `X-VaultAPI-SignatureV2` | For Vault version 20R1.2+: The message signature, signed with Vault’s private key. You need this value to [verify the message](/vault-sdk/sdk-integrations/spark-messaging/message-signing-verification/). |

### Body {#body}

The message body is a JSON object with the following attributes:

| Name | Description |
| --- | --- |
| `vault_host_name` | A Vault's DNS host name. |
| `queue_name` | The name of the outbound queue the message came from. |
| `enter_queue_timestamp` | The time in UTC this message entered the queue. Specifically, this is the exact time SDK code called `QueueService.putMessage(Message)`. |
| `send_message_timestamp` | The time in UTC this message was sent, or left the queue. |
| `send_attempt` | The number of delivery attempts made for this message. Learn more about [message delivery](/vault-sdk/sdk-integrations/vault-integrations/#Message_Delivery). |
| `message_id` | The message ID. |
| `message` | A JSON object which contains the sub-attributes `attributes`and `items`. [View this object in the javadocs](https://repo.veevavault.com/javadoc/vault-sdk-api/26.1.0/docs/api/com/veeva/vault/sdk/api/queue/Message.html). |
| `attributes` | A sub-attribute of the `message` JSON object which contains the attributes specified by `Message#setAttribute()`. SDK developers can add up to 10 custom attributes in a single message. Each attribute cannot exceed 100 characters. A common attribute is `authorization`, set with a token. You can also tie an `integration_point__sys` to a Spark message to create [user exceptions](/vault-sdk/sdk-integrations/spark-messaging/user-exception-messages/). |
| `items` | A sub-attribute of the `message` JSON object which contains a an array of Strings for each item added with `QueueService`. SDK developers can add up to 500 items in a single message. Each item cannot exceed 100 characters. |

### Message Delivery {#Message_Delivery}

If message delivery fails, Vault will immediately retry the delivery one (1) time. If this immediate retry fails, Vault retries at diminishing intervals using an exponential backoff algorithm for the next six (6) hours.

For example:

1. First delivery of the message fails

2. Immediately retry delivery

3. After 1 second, retry delivery

4. After 4 seconds, retry delivery

5. After 7 seconds, retry delivery

And so on until the total time spent attempting to deliver the message is six (6) hours. Note that the time waited between retries will never exceed 15 minutes.

When the final delivery retry fails, Vault’s behavior is determined by the *Spark Message Delivery Event Handler* specified in the *Spark Queue*. To implement custom behavior for failed Spark messages, see
[Message Delivery Event Handler](/vault-sdk/sdk-integrations/spark-messaging/message-delivery-event-handler/).



---

**Previous:** [Spark Messaging](/vault-sdk/sdk-integrations/spark-messaging)  
**Next:** [Message Signing & Verification](/vault-sdk/sdk-integrations/spark-messaging/message-signing-verification)