All URIs are relative to https://api.pipedrive.com/v1.
Method | HTTP request | Description |
---|---|---|
addLead() | POST /leads | Add a lead |
deleteLead() | DELETE /leads/{id} | Delete a lead |
getLead() | GET /leads/{id} | Get one lead |
getLeadUsers() | GET /leads/{id}/permittedUsers | List permitted users |
getLeads() | GET /leads | Get all leads |
searchLeads() | GET /leads/search | Search leads |
updateLead() | PATCH /leads/{id} | Update a lead |
addLead($add_lead_request): \Pipedrive\Model\OneLeadResponse200
Add a lead
Creates a lead. A lead always has to be linked to a person or an organization or both. All leads created through the Pipedrive API will have a lead source API
assigned. Here's the tutorial for <a href="https://pipedrive.readme.io/docs/adding-a-lead\" target="_blank" rel="noopener noreferrer">adding a lead. If a lead contains custom fields, the fields' values will be included in the response in the same format as with the Deals
endpoints. If a custom field's value hasn't been set for the lead, it won't appear in the response. Please note that leads do not have a separate set of custom fields, instead they inherit the custom fields' structure from deals. See an example given in the <a href="https://pipedrive.readme.io/docs/updating-custom-field-value\" target="_blank" rel="noopener noreferrer">updating custom fields' values tutorial.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key
$config = (new Pipedrive\Configuration())->setApiKey('api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\Api\LeadsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$add_lead_request = new \Pipedrive\Model\AddLeadRequest(); // \Pipedrive\Model\AddLeadRequest
try {
$result = $apiInstance->addLead($add_lead_request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling LeadsApi->addLead: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
add_lead_request | \Pipedrive\Model\AddLeadRequest | [optional] |
\Pipedrive\Model\OneLeadResponse200
- Content-Type:
application/json
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
deleteLead($id): \Pipedrive\Model\LeadIdResponse200
Delete a lead
Deletes a specific lead.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key
$config = (new Pipedrive\Configuration())->setApiKey('api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\Api\LeadsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$id = 'id_example'; // string | The ID of the lead
try {
$result = $apiInstance->deleteLead($id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling LeadsApi->deleteLead: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
id | string | The ID of the lead |
\Pipedrive\Model\LeadIdResponse200
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
getLead($id): \Pipedrive\Model\OneLeadResponse200
Get one lead
Returns details of a specific lead. If a lead contains custom fields, the fields' values will be included in the response in the same format as with the Deals
endpoints. If a custom field's value hasn't been set for the lead, it won't appear in the response. Please note that leads do not have a separate set of custom fields, instead they inherit the custom fields’ structure from deals.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key
$config = (new Pipedrive\Configuration())->setApiKey('api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\Api\LeadsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$id = 'id_example'; // string | The ID of the lead
try {
$result = $apiInstance->getLead($id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling LeadsApi->getLead: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
id | string | The ID of the lead |
\Pipedrive\Model\OneLeadResponse200
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
getLeadUsers($id): \Pipedrive\Model\UserIDs
List permitted users
Lists the users permitted to access a lead.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key
$config = (new Pipedrive\Configuration())->setApiKey('api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\Api\LeadsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$id = 'id_example'; // string | The ID of the lead
try {
$result = $apiInstance->getLeadUsers($id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling LeadsApi->getLeadUsers: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
id | string | The ID of the lead |
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
getLeads($limit, $start, $archived_status, $owner_id, $person_id, $organization_id, $filter_id, $sort): \Pipedrive\Model\GetLeadsResponse200
Get all leads
Returns multiple leads. Leads are sorted by the time they were created, from oldest to newest. Pagination can be controlled using limit
and start
query parameters. If a lead contains custom fields, the fields' values will be included in the response in the same format as with the Deals
endpoints. If a custom field's value hasn't been set for the lead, it won't appear in the response. Please note that leads do not have a separate set of custom fields, instead they inherit the custom fields' structure from deals.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key
$config = (new Pipedrive\Configuration())->setApiKey('api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\Api\LeadsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$limit = 100; // int | For pagination, the limit of entries to be returned. If not provided, 100 items will be returned.
$start = 0; // int | For pagination, the position that represents the first result for the page
$archived_status = 'archived_status_example'; // string | Filtering based on the archived status of a lead. If not provided, `All` is used.
$owner_id = 1; // int | If supplied, only leads matching the given user will be returned. However, `filter_id` takes precedence over `owner_id` when supplied.
$person_id = 1; // int | If supplied, only leads matching the given person will be returned. However, `filter_id` takes precedence over `person_id` when supplied.
$organization_id = 1; // int | If supplied, only leads matching the given organization will be returned. However, `filter_id` takes precedence over `organization_id` when supplied.
$filter_id = 1; // int | The ID of the filter to use
$sort = 'sort_example'; // string | The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys).
try {
$result = $apiInstance->getLeads($limit, $start, $archived_status, $owner_id, $person_id, $organization_id, $filter_id, $sort);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling LeadsApi->getLeads: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
limit | int | For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. | [optional] |
start | int | For pagination, the position that represents the first result for the page | [optional] |
archived_status | string | Filtering based on the archived status of a lead. If not provided, `All` is used. | [optional] |
owner_id | int | If supplied, only leads matching the given user will be returned. However, `filter_id` takes precedence over `owner_id` when supplied. | [optional] |
person_id | int | If supplied, only leads matching the given person will be returned. However, `filter_id` takes precedence over `person_id` when supplied. | [optional] |
organization_id | int | If supplied, only leads matching the given organization will be returned. However, `filter_id` takes precedence over `organization_id` when supplied. | [optional] |
filter_id | int | The ID of the filter to use | [optional] |
sort | string | The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). | [optional] |
\Pipedrive\Model\GetLeadsResponse200
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
searchLeads($term, $fields, $exact_match, $person_id, $organization_id, $include_fields, $start, $limit): \Pipedrive\Model\LeadSearchResponse
Search leads
Searches all leads by title, notes and/or custom fields. This endpoint is a wrapper of <a href="https://developers.pipedrive.com/docs/api/v1/ItemSearch#searchItem\">/v1/itemSearch with a narrower OAuth scope. Found leads can be filtered by the person ID and the organization ID.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key
$config = (new Pipedrive\Configuration())->setApiKey('api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\Api\LeadsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$term = 'term_example'; // string | The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded.
$fields = 'fields_example'; // string | A comma-separated string array. The fields to perform the search from. Defaults to all of them.
$exact_match = True; // bool | When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive.
$person_id = 56; // int | Will filter leads by the provided person ID. The upper limit of found leads associated with the person is 2000.
$organization_id = 56; // int | Will filter leads by the provided organization ID. The upper limit of found leads associated with the organization is 2000.
$include_fields = 'include_fields_example'; // string | Supports including optional fields in the results which are not provided by default
$start = 0; // int | Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter.
$limit = 56; // int | Items shown per page
try {
$result = $apiInstance->searchLeads($term, $fields, $exact_match, $person_id, $organization_id, $include_fields, $start, $limit);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling LeadsApi->searchLeads: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
term | string | The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded. | |
fields | string | A comma-separated string array. The fields to perform the search from. Defaults to all of them. | [optional] |
exact_match | bool | When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. | [optional] |
person_id | int | Will filter leads by the provided person ID. The upper limit of found leads associated with the person is 2000. | [optional] |
organization_id | int | Will filter leads by the provided organization ID. The upper limit of found leads associated with the organization is 2000. | [optional] |
include_fields | string | Supports including optional fields in the results which are not provided by default | [optional] |
start | int | Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. | [optional] [default to 0] |
limit | int | Items shown per page | [optional] |
\Pipedrive\Model\LeadSearchResponse
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
updateLead($id, $update_lead_request): \Pipedrive\Model\OneLeadResponse200
Update a lead
Updates one or more properties of a lead. Only properties included in the request will be updated. Send null
to unset a property (applicable for example for value
, person_id
or organization_id
). If a lead contains custom fields, the fields' values will be included in the response in the same format as with the Deals
endpoints. If a custom field's value hasn't been set for the lead, it won't appear in the response. Please note that leads do not have a separate set of custom fields, instead they inherit the custom fields’ structure from deals. See an example given in the <a href="https://pipedrive.readme.io/docs/updating-custom-field-value\" target="_blank" rel="noopener noreferrer">updating custom fields’ values tutorial.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key
$config = (new Pipedrive\Configuration())->setApiKey('api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\Api\LeadsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$id = 'id_example'; // string | The ID of the lead
$update_lead_request = new \Pipedrive\Model\UpdateLeadRequest(); // \Pipedrive\Model\UpdateLeadRequest
try {
$result = $apiInstance->updateLead($id, $update_lead_request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling LeadsApi->updateLead: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
id | string | The ID of the lead | |
update_lead_request | \Pipedrive\Model\UpdateLeadRequest | [optional] |
\Pipedrive\Model\OneLeadResponse200
- Content-Type:
application/json
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]