# Lookup API

> Search, lookups by source id, the recycle bin. Every route, its parameters and fields.

Search, lookups by source id, the recycle bin. 14 routes; send a bearer token with each (see [Authentication](/api/authentication.md)).

| Route | What it does |
| --- | --- |
| `GET /v1/search` | Search contacts, accounts, opportunities, quotes, products, cases and campaigns |
| `GET /v1/contacts/by-source/{system}/{sourceId}` | Find a contact by its id in another system |
| `GET /v1/accounts/by-source/{system}/{sourceId}` | Find a account by its id in another system |
| `GET /v1/opportunities/by-source/{system}/{sourceId}` | Find a opportunity by its id in another system |
| `GET /v1/notes/by-source/{system}/{sourceId}` | Find a note by its id in another system |
| `GET /v1/activities/by-source/{system}/{sourceId}` | Find a activity by its id in another system |
| `GET /v1/cases/by-source/{system}/{sourceId}` | Find a case by its id in another system |
| `GET /v1/campaigns/by-source/{system}/{sourceId}` | Find a campaign by its id in another system |
| `GET /v1/contacts/{id}/timeline` | A contact's timeline |
| `GET /v1/accounts/{id}/timeline` | A account's timeline |
| `GET /v1/opportunities/{id}/timeline` | A opportunity's timeline |
| `GET /v1/activities/{id}/timeline` | A activity's timeline |
| `GET /v1/cases/{id}/timeline` | A case's timeline |
| `GET /v1/campaigns/{id}/timeline` | A campaign's timeline |

## Search contacts, accounts, opportunities, quotes, products, cases and campaigns

`GET https://staging-api.naruskacrm.com/v1/search`

Trigram match on names (also partial words), exact or prefix match on email, digits match on phone, and contacts by their company's name; when asked for in `types`, quotes by name or number (Q-1042), products by name or code, cases by title or number (C-1042) and campaigns by name or utm_campaign. Ranked; each result has a distinguishing detail.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `q` | query | string | yes | 1–200 characters |
| `types` | query | string |  | Comma-separated: contact, account, opportunity (the default three), quote (name or number such as Q-1042), product (name or code), case (title or number such as C-1042), campaign (name or utm_campaign). |
| `limit` | query | integer |  | 1–50, default `10` |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [SearchResult](/api/reference/objects.md#searchresult) | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Find a contact by its id in another system

`GET https://staging-api.naruskacrm.com/v1/contacts/by-source/{system}/{sourceId}`

Follows merges to the surviving record (02 note).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `system` | path | string | yes | 1–100 characters |
| `sourceId` | path | string | yes | 1–500 characters |

### Response 200

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Find a account by its id in another system

`GET https://staging-api.naruskacrm.com/v1/accounts/by-source/{system}/{sourceId}`

Follows merges to the surviving record (02 note).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `system` | path | string | yes | 1–100 characters |
| `sourceId` | path | string | yes | 1–500 characters |

### Response 200

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Find a opportunity by its id in another system

`GET https://staging-api.naruskacrm.com/v1/opportunities/by-source/{system}/{sourceId}`

Follows merges to the surviving record (02 note).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `system` | path | string | yes | 1–100 characters |
| `sourceId` | path | string | yes | 1–500 characters |

### Response 200

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Find a note by its id in another system

`GET https://staging-api.naruskacrm.com/v1/notes/by-source/{system}/{sourceId}`

Follows merges to the surviving record (02 note).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `system` | path | string | yes | 1–100 characters |
| `sourceId` | path | string | yes | 1–500 characters |

### Response 200

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Find a activity by its id in another system

`GET https://staging-api.naruskacrm.com/v1/activities/by-source/{system}/{sourceId}`

Follows merges to the surviving record (02 note).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `system` | path | string | yes | 1–100 characters |
| `sourceId` | path | string | yes | 1–500 characters |

### Response 200

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Find a case by its id in another system

`GET https://staging-api.naruskacrm.com/v1/cases/by-source/{system}/{sourceId}`

Follows merges to the surviving record (02 note).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `system` | path | string | yes | 1–100 characters |
| `sourceId` | path | string | yes | 1–500 characters |

### Response 200

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Find a campaign by its id in another system

`GET https://staging-api.naruskacrm.com/v1/campaigns/by-source/{system}/{sourceId}`

Follows merges to the surviving record (02 note).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `system` | path | string | yes | 1–100 characters |
| `sourceId` | path | string | yes | 1–500 characters |

### Response 200

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## A contact's timeline

`GET https://staging-api.naruskacrm.com/v1/contacts/{id}/timeline`

Status changes, audit entries (with via, reason and operation_id), notes and activities (and on cases their documents; on contacts, accounts and deals their cases), newest first. `types` limits it to some entry types (note, activity, audit, status_change).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `limit` | query | integer |  | 1–200, default `50` |
| `cursor` | query | string |  | at most 200 characters |
| `types` | query | string |  |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [TimelineEntry](/api/reference/objects.md#timelineentry) | yes |  |
| `next_cursor` | string or null | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## A account's timeline

`GET https://staging-api.naruskacrm.com/v1/accounts/{id}/timeline`

Status changes, audit entries (with via, reason and operation_id), notes and activities (and on cases their documents; on contacts, accounts and deals their cases), newest first. `types` limits it to some entry types (note, activity, audit, status_change).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `limit` | query | integer |  | 1–200, default `50` |
| `cursor` | query | string |  | at most 200 characters |
| `types` | query | string |  |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [TimelineEntry](/api/reference/objects.md#timelineentry) | yes |  |
| `next_cursor` | string or null | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## A opportunity's timeline

`GET https://staging-api.naruskacrm.com/v1/opportunities/{id}/timeline`

Status changes, audit entries (with via, reason and operation_id), notes and activities (and on cases their documents; on contacts, accounts and deals their cases), newest first. `types` limits it to some entry types (note, activity, audit, status_change).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `limit` | query | integer |  | 1–200, default `50` |
| `cursor` | query | string |  | at most 200 characters |
| `types` | query | string |  |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [TimelineEntry](/api/reference/objects.md#timelineentry) | yes |  |
| `next_cursor` | string or null | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## A activity's timeline

`GET https://staging-api.naruskacrm.com/v1/activities/{id}/timeline`

Status changes, audit entries (with via, reason and operation_id), notes and activities (and on cases their documents; on contacts, accounts and deals their cases), newest first. `types` limits it to some entry types (note, activity, audit, status_change).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `limit` | query | integer |  | 1–200, default `50` |
| `cursor` | query | string |  | at most 200 characters |
| `types` | query | string |  |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [TimelineEntry](/api/reference/objects.md#timelineentry) | yes |  |
| `next_cursor` | string or null | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## A case's timeline

`GET https://staging-api.naruskacrm.com/v1/cases/{id}/timeline`

Status changes, audit entries (with via, reason and operation_id), notes and activities (and on cases their documents; on contacts, accounts and deals their cases), newest first. `types` limits it to some entry types (note, activity, audit, status_change).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `limit` | query | integer |  | 1–200, default `50` |
| `cursor` | query | string |  | at most 200 characters |
| `types` | query | string |  |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [TimelineEntry](/api/reference/objects.md#timelineentry) | yes |  |
| `next_cursor` | string or null | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## A campaign's timeline

`GET https://staging-api.naruskacrm.com/v1/campaigns/{id}/timeline`

Status changes, audit entries (with via, reason and operation_id), notes and activities (and on cases their documents; on contacts, accounts and deals their cases), newest first. `types` limits it to some entry types (note, activity, audit, status_change).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `limit` | query | integer |  | 1–200, default `50` |
| `cursor` | query | string |  | at most 200 characters |
| `types` | query | string |  |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [TimelineEntry](/api/reference/objects.md#timelineentry) | yes |  |
| `next_cursor` | string or null | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

