Lead Sources
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
Name | Read Only | Type | Description |
---|---|---|---|
id | true | number | Unique identifier of the lead source. |
creator_id | true | number | Unique identifier of the user that created the source. |
name | false | string | Name of the source. |
resource_type | false | string | Type name of the resource the source is attached to. Possible values: lead |
created_at | true | string | Date and time of creation in UTC (ISO 8601 format). |
updated_at | true | string | Date 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
Name | Required | Type | In | Description |
---|---|---|---|---|
page | false | number | Query | Page number to start from. Page numbering starts at 1, and omitting the page parameter will return the first page. |
per_page | false | number | Query | Number of records to return per page. The default limit is _25_ and the maximum number that can be returned is _100_. |
sort_by | false | string | Query | A 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 |
ids | false | string | Query | Comma-separated list of lead source IDs to be returned in a request. |
name | false | string | Query | Name 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-8
Content-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
Name | Required | Type | In | Description |
---|---|---|---|---|
name | true | string | Body | Must be unique. |
resource_type | false | string | Body | e.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-8
Contant-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
Name | Required | Type | In | Description |
---|---|---|---|---|
id | true | number | Query | Unique 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-8
Contant-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
Name | Required | Type | In | Description |
---|---|---|---|---|
id | true | number | Query | Source ID. |
name | false | string | Body | Must be unique. |
resource_type | false | string | Body | e.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-8
Contant-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
Name | Required | Type | In | Description |
---|---|---|---|---|
id | true | number | Query | Unique 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