Embedded Metadata is a key-value pair object that can be used to attach arbitrary information to any of the accounts objects in either our Bolt or Embedded APIs. The metadata field is not read or used by Bolt, and thus can be used to attach information that is helpful for you and not necessary for interacting with Bolt. It is an extra field that can be added to individual addresses, payment methods, or the account profile.
WARNING
Metadata should NOT be used to store any sensitive or personally identifiable information (PII) (such as credit card numbers, other payment information, or a consumer’s contact information).
What are the limitations of metadata?
What can metadata be used for?
Using Metadata Key-Value Pairs
Metadata can be added, updated, and deleted whenever making a request to Accounts endpoints.
INFO
The metadata pair is returned in the response object of specific account object it was attached to.
Add New Metadata
If you create an account with no addresses, payment methods, or metadata, you will receive the following response from the Get Account Details endpoint:
{
"profile": {
"first_name": "Alan",
"last_name": "Watts",
"email": "alan@bolt.com",
"phone": "+15551112222",
"name": "Alan Watts"
},
"addresses": [],
"payment_methods": [ ],
"has_bolt_account": true
}
You can use metadata to add your system’s customer ID to the shopper’s Bolt account profile. To do so, make a call to update the profile with your metadata key-value pair. The response will return the pair attached to the profile. Anytime metadata is added to an object with a key that doesn’t currently exist, the new key-value pair will be added to the existing metadata without affecting or overwriting the current keys.
{
"metadata": {"customer_id": "234"}
}
{
"first_name": "Alan",
"last_name": "Watts",
"email": "alan4@bolt.com",
"phone": "+15551112225",
"metadata": {
"customer_id": "234"
},
"name": "Alan Watts"
}
Update Existing Metadata
If you need to replace the value in a pair (for example, if the customer_ID
is set to the incorrect number and must be replaced with the correct one), you can update it by making a call to the Update Account Details endpoint to update profile using the same metadata key with an updated value. The updated value string will take precedence over the value currently stored for that key.
{
"metadata": {"customer_id": "235"}
}
{
"first_name": "Alan",
"last_name": "Watts",
"email": "alan4@bolt.com",
"phone": "+15551112225",
"metadata": {
"customer_id": "235"
},
"name": "Alan Watts"
}
Add More Metadata Pairs
Add additional pairs to the metadata by changing metadata input to the request. Newly inputted keys will generate new metadata pairs.
{
"metadata": {"new_key": "new_value"}
}
{
"first_name": "Alan",
"last_name": "Watts",
"email": "alan4@bolt.com",
"phone": "+15551112225",
"metadata": {
"customer_id": "235",
"new_key": "new_value"
},
"name": "Alan Watts"
}
Delete Metadata
If you want to delete an existing key, you can add the metadata to the object with an empty string, which will remove it from the existing metadata. If you call a DELETE endpoint, it will delete the metadata along with the object you are deleting (for example, if you delete an address or payment method, any metadata attached to that object will also be deleted). The response will exclude any metadata pair with an empty value.
{
"metadata": {"new_key": ""}
}
{
"first_name": "Alan",
"last_name": "Watts",
"email": "alan4@bolt.com",
"phone": "+15551112225",
"metadata": {
"customer_id": "235"
// the key-value pair "new_value" has been removed
},
"name": "Alan Watts"
}