Upload Revenue Batch

This endpoint accepts a CSV file containing multiple revenue records and processes them asynchronously. The request returns immediately with a jobId that can be used to track progress and retrieve results.

The CSV is validated server-side before the job is created. If validation fails, a 400 response is returned with detailed row-level errors — no job is created and nothing is stored.

Headers:

AuthorizationstringRequired

The authorization token for accessing the API. The header value should be set to "Bearer {your-access-token}", where {your-access-token} is the access token assigned to the user.

Content-TypestringRequired

Must be multipart/form-data. The CSV file should be submitted as a form file part.

CSV Structure:

The CSV file must include a header row. The following columns are supported:

RevenueClosedDatestringRequired

The date the revenue was closed. Must be in one of the following ISO 8601 formats (UTC):

  • yyyy-MM-dd
  • yyyy-MM-ddTHH:mm:ss
  • yyyy-MM-ddTHH:mm:ss.ffffff

Must not be a future date.

CurrencyCodestringRequired

ISO 4217 currency code for the revenue value. E.g. GBP, USD, EUR.

ValuedecimalRequired

The monetary value of the revenue record. Must be a valid number.

Visitor Identifiers (at least one required)

At least one of the following must be provided per row.

RaIdstring

The Ruler Analytics visitor ID.

EmailAddressstring

The visitor's email address.

PhoneNumberstring

The visitor's phone number.

PayloadValuestring

A custom payload identifier value.

LeadDatestring

The date the lead was originally captured. Must be in the same ISO 8601 format as RevenueClosedDate and must not be a future date.

LabelstringRequired

A revenue label. At least one Label column must be provided in the header. This column may appear multiple times in the header to attach several labels to a single row (e.g. two Label columns for Deal and Inbound).

ReferencestringRequired

A unique reference identifier for the revenue record.

AdditionalDataPropertiesstring

Custom key-value properties. Each entry uses the format Name=X,Value=Y. Separate multiple entries with a semicolon:

Name=Source,Value=Google;Name=Campaign,Value=Spring

Validation Rules:

  • All required columns must be present in the CSV header.
  • Unknown column names are rejected.
  • Duplicate column names are rejected (except Label).
  • Value must be a valid number and must not be empty.
  • Date fields must match an accepted ISO 8601 format and must not be future dates.
  • Each row must contain at least one visitor identifier.
  • At least one Label column must be present.
  • Rows with the same visitor identifier and RevenueClosedDate combination are flagged as duplicates.
  • AdditionalDataProperties must follow the Name=X,Value=Y format if provided.
Request
POST
{siteId}/revenue/upload/batch
curl -X POST \ 'https://rest.rulerapi.com/v1/{siteId}/revenue/upload/batch' \ -H 'Authorization: Bearer {your-access-token}' \ -H 'Content-Type: multipart/form-data' \ -F 'file=@/path/to/revenue.csv'
Response
202 Accepted
{
    "jobId": "{{jobId}}"
}
Processing

The job is processed asynchronously. Use the returned jobId to poll GET /{siteId}/batch/{jobId}/status until the status is complete, partialcomplete, or failed.