Managing Data Connections

Managing data in your Data Connections ensures your campaigns stay accurate and up-to-date. Whether you’re updating customer profiles, deleting outdated records, or setting expiration rules, this guide helps you maintain your Data Connections efficiently. Learn how to handle data expiration, update or delete items by primary key, and upload new data.

Prerequisites

Before you begin, ensure you have:

Data Expiration

Data in an Upload-backed Data Connection can be set to expire after a set duration.
When uploading data, specify a TTL (in seconds) in the request. Once this duration has elapsed after uploading the data, the rows immediately stop being available for your campaigns. For example, a TTL of 86400 means data expires after 1 day.

If the TTL is omitted in the request (or set to null), the data will not expire.

💡

Tip: Use a TTL of 3600 (1 hour) for frequently updated 3rd party data, or 86400 (1 day) for uploaded data that changes daily.

Update Items by Primary Key

Update or overwrite existing data using the Update Data endpoint. Specify the primary_key, updated data, and an optional ttl.

Example: Update Data

curl --request PUT \
  --url https://api4.optimove.net/data-connections/v2/connections/{YOUR_DC_UUID}/update_data \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: YOUR_API_KEY' \
  --data '[
    {
        "primary_key": 54490,
        "data": {"key": "value"},
        "ttl_seconds": null
    }
]'

Response

A successful update returns a 200 OK response: Updated 5 rows.

ℹ️

Note: Setting ttl_seconds to null means the updated data does not expire. Specify a TTL (in seconds) if you want the data to expire (e.g., 86400 for 1 day).

For more details, refer to the API Reference.

Delete Items by Primary Key

Delete specific data by providing a list of primary_keys using the Delete Data endpoint.

Example: Delete Data

curl --request POST \
  --url https://api4.optimove.net/data-connections/v2/connections/41ddf098-90b4-4a5d-a3d1-0fd8da3bfb89/delete_data \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: YOUR_API_KEY' \
  --data '{
    "primary_keys": ["4942985", "2", "1e6bbf91"]
}'

Response

A successful deletion returns 204 No Content.

Upload Data

To upload new data to your Data Connection, follow the steps outlined in Using your Data Connections.

Note: Update and Upload share the same complete‑replacement behaviour (fields you don’t send are removed). Please review the Safe Usage Guidelines before running updates.

Use Case

Suppose you’re managing customer data for a loyalty program in Optimove. You upload customer purchase amounts to a Data Connection but later need to update a customer’s purchase_amount after a return (using update_data). Additionally, you delete inactive accounts (using delete_data) to keep your data current. Finally, you set a TTL of 86400 seconds (1 day) for the updated data to ensure it expires if not refreshed.

Troubleshooting

Common issues and solutions:

  • Authentication Error (401): Verify your x-api-key is correct. Go to Settings > Access Management > API Keys in your Optimove instance to create a new API key.
  • Invalid Primary Key (400): Ensure the primary_key exists in the Data Connection. Check your primary_keys list for typos or invalid entries.
  • Rate Limit Exceeded (429): Slow down your requests or contact support to increase your rate limit.

Did this page help you?