--- title: "Add contacts to campaigns and submit events" slug: "campaign-event-api" updated: 2026-07-31T06:51:16Z published: 2026-07-31T06:51:16Z canonical: "help.elaine.io/campaign-event-api" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.elaine.io/llms.txt > Use this file to discover all available pages before exploring further. # Add contacts to campaigns and submit events Backend and CRM systems can activate Elaine in two principal ways: add or update a contact and place that contact into a defined campaign, or submit a business event that Elaine routes asynchronously to subscribed automations and transactional messages. ## Choose the activation pattern | Pattern | Use it when | Primary function | | --- | --- | --- | | Direct campaign subscription | The calling system knows the target Elaine campaign and needs the contact placed into it. | `api_userCreateOrUpdateStartCampaign` or `api_userStartCampaign` | | Generic event submission | The source system should report what happened while Elaine decides which automations or messages consume the event. | `api_processEvent` | ## Create or update a contact and start a campaign `api_userCreateOrUpdateStartCampaign` accepts the contact data and campaign ID in one call. The optional entry state, restart behavior, force flag, rollback metadata, and data-source ID follow as positional parameters. ```bash export ELAINE_BASE_URL="https://your-elaine-domain.example" export ELAINE_JWT="replace-with-an-elaine-issued-jwt" curl --get "$ELAINE_BASE_URL/http/api/api_userCreateOrUpdateStartCampaign" \  --header "Authorization: Bearer $ELAINE_JWT" \  --data-urlencode 'json=[{"c_email":"recipient@example.com","c_firstname":"Sam","c_customer_id":"CRM-1001"},42,null,false,false,"api",1001,7]' \  --data-urlencode 'response=json' ``` Here, `42` is the campaign ID, `1001` is an external rollback or correlation ID, and `7` is the Elaine data-source ID. Select a data source whose PAC and permission model matches the acquisition context. ## Submit a generic event `api_processEvent(string $eventName, array $recipientData, array $metaData = [])` accepts a configured event name, recipient data, and optional metadata. Elaine can route the event to subscribed marketing automations, an associated transactional message, or both. ```bash curl --get "$ELAINE_BASE_URL/http/api/api_processEvent" \  --header "Authorization: Bearer $ELAINE_JWT" \  --data-urlencode 'json=["orderShipped",{"c_email":"recipient@example.com","e_order_number":"A-12345","e_shipping_provider":"Example Logistics"},{"campaignIds":[42],"msgid":"CRM-EVENT-1001"}]' \  --data-urlencode 'response=json' ``` Event processing is asynchronous. A successful API result confirms that Elaine accepted and routed the event; it does not prove that every downstream automation step or message delivery has completed. ## Event data conventions - Use `c_` fields for persistent recipient profile data. - Use configured `e_` fields for event data consumed by automations. - Use configured `t_` fields for temporary personalization data in transactional messages. - Include a stable external identifier for correlation and duplicate handling. - Configure the event type in Elaine before sending production events. > [!NOTE] > Note > > Function availability and event routing depend on the Elaine release, enabled features, configured event types, campaign subscriptions, and API permissions. ## Related topics - [Marketing automation function reference](/new-public-docs/docs/en/api-reference-marketing-automation) - [Call the HTTP API with cURL](/new-public-docs/docs/en/api-http-requests) - [Privacy Admission Control (PAC) and PAC flags](/new-public-docs/docs/en/privacy-admission-control) - [Events, webhooks, and asynchronous integration](/new-public-docs/docs/en/webhooks-event-integration)