The Lead Sources API provides a simple interface to manage lead sources. The API allows you to create, delete and update your sources. You can retrieve a single source as well as list of all sources.

JSON format

NameRead OnlyTypeDescription
idtruenumberUnique identifier of the lead source.
creator_idtruenumberUnique identifier of the user that created the source.
namefalsestringName of the source.
resource_typefalsestringType name of the resource the source is attached to. Possible values: lead
created_attruestringDate and time of creation in UTC (ISO 8601 format).
updated_attruestringDate and time of the last update in UTC (ISO 8601 format).

Retrieve all sources

GET /v2/lead_sources

Returns all lead sources available to the user according to the parameters provided.

Parameters

NameRequiredTypeInDescription
pagefalsenumberQueryPage number to start from. Page numbering starts at 1, and omitting the page parameter will return the first page.
per_pagefalsenumberQueryNumber of records to return per page. The default limit is _25_ and the maximum number that can be returned is _100_.
sort_byfalsestringQueryA field to sort by. The default ordering is ascending. If you want to change the sort order to descending, append :desc to the field e.g. sort_by=name:desc. Possible values: id, name, updated_at, created_at
idsfalsestringQueryComma-separated list of lead source IDs to be returned in a request.
namefalsestringQueryName of the source to search for. This parameter is used in a strict sense.

Allowed for

  • Agents

Using cURL

curl -v -X GET https://api.getbase.com/v2/lead_sources \-H "Accept: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "items": [    {      "data": {        "id": 1,        "creator_id": 1,        "name": "Our website",        "resource_type": "lead",        "created_at": "2014-08-27T16:32:56Z",        "updated_at": "2014-08-27T16:32:56Z"      },      "meta": {        "type": "source"      }    },    {      "data": {        "id": 2,        "creator_id": 1,        "name": "Word of mouth",        "resource_type": "lead",        "created_at": "2014-08-27T16:32:57Z",        "updated_at": "2014-08-27T16:32:57Z"      },      "meta": {        "type": "source"      }    },    {      "data": {        "id": 3,        "creator_id": 1,        "name": "Referral",        "resource_type": "lead",        "created_at": "2014-08-27T16:32:58Z",        "updated_at": "2014-08-27T16:32:58Z"      },      "meta": {        "type": "source"      }    },    {      "data": {        "id": 4,        "creator_id": 1,        "name": "Newspaper ad",        "resource_type": "lead",        "created_at": "2014-08-27T16:32:59Z",        "updated_at": "2014-08-27T16:32:59Z"      },      "meta": {        "type": "source"      }    }  ],  "meta": {    "type": "collection",    "count": 4,    "links": {      "self": "http://api.getbase.com/v2/lead_sources.json"    }  }}

Create a source

POST /v2/lead_sources

Creates a new source. Source's name must be unique.

Parameters

NameRequiredTypeInDescription
nametruestringBodyMust be unique.
resource_typefalsestringBodye.g. lead

Allowed for

  • Agents

Using cURL

curl -v -X POST https://api.getbase.com/v2/lead_sources \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN" \-d '{  "data": {    "name": "Tom"  },  "meta": {    "type": "source"  }}'

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Contant-Language: en
{  "data": {    "id": 5,    "creator_id": 1,    "name": "Tom",    "resource_type": "lead",    "created_at": "2014-08-27T16:33:00Z",    "updated_at": "2014-08-27T16:33:00Z"  },  "meta": {    "type": "source"  }}

Retrieve a single source

GET /v2/lead_sources/:id

Returns a single source available to the user by the provided id. If a source with the supplied unique identifier does not exist it returns an error.

Parameters

NameRequiredTypeInDescription
idtruenumberQueryUnique identifier of the source.

Allowed for

  • Agents

Using cURL

curl -v -X GET https://api.getbase.com/v2/lead_sources/5 \-H "Accept: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Contant-Language: en
{  "data": {    "id": 5,    "creator_id": 1,    "name": "Tom",    "resource_type": "lead",    "created_at": "2014-08-27T16:33:00Z",    "updated_at": "2014-08-27T16:33:00Z"  },  "meta": {    "type": "source"  }}

Update a source

PUT /v2/lead_sources/:id

Updates source information. If the specified source does not exist, the request will return an error. If you want to update a source, you must make sure source's name is unique.

Parameters

NameRequiredTypeInDescription
idtruenumberQuerySource ID.
namefalsestringBodyMust be unique.
resource_typefalsestringBodye.g. lead

Allowed for

  • Agents

Using cURL

curl -v -X PUT https://api.getbase.com/v2/lead_sources/5 \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN" \-d '{  "data": {    "name": "Tom referral"  }}'

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Contant-Language: en
{  "data": {    "id": 5,    "creator_id": 1,    "name": "Tom referral",    "resource_type": "lead",    "created_at": "2014-08-27T16:33:00Z",    "updated_at": "2014-08-27T16:33:01Z"  },  "meta": {    "type": "source"  }}

Delete a source

DELETE /v2/lead_sources/:id

Delete an existing source. If the specified source does not exist, the request will return an error. This operation cannot be undone.

Parameters

NameRequiredTypeInDescription
idtruenumberQueryUnique identifier of the source.

Allowed for

  • Agents

Using cURL

curl -v -X DELETE https://api.getbase.com/v2/lead_sources/1 \-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 204 No Content