Skip to content

Get the sales attribution report

GET
/reports/attribution
Code sample: Shell / cURL
curl --request GET \
--url 'https://example.com/api/v1/reports/attribution?from=example&to=example' \
--header 'Authorization: Bearer <token>'

Where the sales came from: deals and won amounts by lead source and by the company that referred them, with an unattributed bucket for the ones carrying neither. Each referrer row also splits its deals by the rep who sent them (reps), left empty without commissions access. Open deals count wherever they stand today; won and lost ones count inside the period. Requires the deals.view permission and both the Sales and Reports modules. Without deals.view_all the report covers only the deals the caller owns or reaches through a company they can see.

from
required

Start of the period, YYYY-MM-DD, in the workspace timezone.

string
/^\d{4}-\d{2}-\d{2}$/

Start of the period, YYYY-MM-DD, in the workspace timezone.

to
required

End of the period, YYYY-MM-DD, inclusive.

string
/^\d{4}-\d{2}-\d{2}$/

End of the period, YYYY-MM-DD, inclusive.

ownerId

Only deals owned by this member.

string

Only deals owned by this member.

leadSourceId

Only deals attributed to this lead source.

string

Only deals attributed to this lead source.

lostReasonId

Only deals lost for this reason, an id from the lost reasons list. Open and won deals carry no reason, so the report then covers just those lost deals.

string
>= 1 characters

Only deals lost for this reason, an id from the lost reasons list. Open and won deals carry no reason, so the report then covers just those lost deals.

Deals and won value by source and by referrer.

Media typeapplication/json
object
data
required

Open deals count wherever they stand today; won and lost ones count inside the period.

object
byReferrer
required
Array<object>

Deals credited to one referrer.

object
id
required

Null for the unattributed bucket.

string | null
lostDeals
required
integer
>= -9007199254740991 <= 9007199254740991
name
required
string
openDeals
required
integer
>= -9007199254740991 <= 9007199254740991
reps
required

The same deals by the referrer’s rep who sent them, with a null-id No rep row; empty for the unattributed bucket and for a caller without the commissions module and commissions.view or commissions.manage.

Array<object>

Deals credited to one source or referrer.

object
id
required

Null for the unattributed bucket.

string | null
lostDeals
required
integer
>= -9007199254740991 <= 9007199254740991
name
required
string
openDeals
required
integer
>= -9007199254740991 <= 9007199254740991
wonAmounts
required
Array<object>

An amount in a single currency.

object
amount
required

Sum in that currency, rounded to cents.

number
currency
required

The company’s own currency, or the workspace’s when the company has none. Never converted.

string
wonDeals
required
integer
>= -9007199254740991 <= 9007199254740991
wonAmounts
required
Array<object>

An amount in a single currency.

object
amount
required

Sum in that currency, rounded to cents.

number
currency
required

The company’s own currency, or the workspace’s when the company has none. Never converted.

string
wonDeals
required
integer
>= -9007199254740991 <= 9007199254740991
bySource
required
Array<object>

Deals credited to one source or referrer.

object
id
required

Null for the unattributed bucket.

string | null
lostDeals
required
integer
>= -9007199254740991 <= 9007199254740991
name
required
string
openDeals
required
integer
>= -9007199254740991 <= 9007199254740991
wonAmounts
required
Array<object>

An amount in a single currency.

object
amount
required

Sum in that currency, rounded to cents.

number
currency
required

The company’s own currency, or the workspace’s when the company has none. Never converted.

string
wonDeals
required
integer
>= -9007199254740991 <= 9007199254740991

Example generated

{
"data": {
"byReferrer": [
{
"id": "example",
"lostDeals": 1,
"name": "example",
"openDeals": 1,
"reps": [
{
"id": "example",
"lostDeals": 1,
"name": "example",
"openDeals": 1,
"wonAmounts": [
{
"amount": 1,
"currency": "example"
}
],
"wonDeals": 1
}
],
"wonAmounts": [
{
"amount": 1,
"currency": "example"
}
],
"wonDeals": 1
}
],
"bySource": [
{
"id": "example",
"lostDeals": 1,
"name": "example",
"openDeals": 1,
"wonAmounts": [
{
"amount": 1,
"currency": "example"
}
],
"wonDeals": 1
}
]
}
}

Validation error. Parse failures include field paths and expectations.

Media typeapplication/json

Validation error with safe field paths and expected values; submitted values are never returned.

object
error
required
object
code
required

Stable machine-readable error code.

string
issues
Array<object>
object
expected
required
string
message
required
string
path
required
Array<string | number>
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Missing the deals.view permission.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

The Sales or Reports module is turned off for the workspace.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.