### Get All Pipelines with Sorting and Pagination in PHP Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/PipelinesApi.md This example shows how to fetch a list of all pipelines, with options for sorting, limiting results, and cursor-based pagination. Authentication setup is required. ```php setApiKey('x-api-token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = (new Pipedrive\versions\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); // Configure OAuth2 access token for authorization: oauth2 $config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Pipedrive\versions\v2\Api\PipelinesApi( // 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 ); $sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `update_time`, `add_time`. $sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. $limit = 100; // int | For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. $cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page try { $result = $apiInstance->getPipelines($sort_by, $sort_direction, $limit, $cursor); print_r($result); } catch (Exception $e) { echo 'Exception when calling PipelinesApi->getPipelines: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Manual Installation of Pipedrive PHP Client Source: https://github.com/pipedrive/client-php/blob/master/README.md Manually install the Pipedrive PHP client by downloading the files and including the autoloader. Requires PHP 7.4+. ```php setApiKey('x-api-token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = (new Pipedrive\versions\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); // Configure OAuth2 access token for authorization: oauth2 $config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Pipedrive\versions\v2\Api\ProductsApi( // 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_product_request_body = new \Pipedrive\versions\v2\Model\AddProductRequestBody(); // \Pipedrive\versions\v2\Model\AddProductRequestBody try { $result = $apiInstance->addProduct($add_product_request_body); print_r($result); } catch (Exception $e) { echo 'Exception when calling ProductsApi->addProduct: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### GET /installments Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/DealsApi.md Retrieves a list of installments attached to specific deals. ```APIDOC ## GET /installments ### Description Retrieves the attached installments for a list of provided deal IDs. ### Method GET ### Endpoint /installments ### Parameters #### Query Parameters - **deal_ids** (int[]) - Required - An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. - **cursor** (string) - Optional - For pagination, the marker (an opaque string value) representing the first item on the next page - **limit** (int) - Optional - For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. - **sort_by** (string) - Optional - The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. Default: 'id'. - **sort_direction** (string) - Optional - The sorting direction. Supported values: `asc`, `desc`. Default: 'asc'. ### Response #### Success Response (200) - **InstallmentsResponse** (object) - The response object containing the list of installments. ``` -------------------------------- ### Convert Lead to Deal using BetaApi Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/BetaApi.md Demonstrates how to initialize the BetaApi client with API key or OAuth2 authorization and convert a lead to a deal. ```php setApiKey('x-api-token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = (new Pipedrive\versions\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); // Configure OAuth2 access token for authorization: oauth2 $config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Pipedrive\versions\v2\Api\BetaApi( // 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 to convert $inline_object = new \Pipedrive\versions\v2\Model\InlineObject(); // \Pipedrive\versions\v2\Model\InlineObject try { $result = $apiInstance->convertLeadToDeal($id, $inline_object); print_r($result); } catch (Exception $e) { echo 'Exception when calling BetaApi->convertLeadToDeal: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### GET /deals/installments Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/README.md Retrieves a list of installments associated with a specific set of deals. ```APIDOC ## GET /deals/installments ### Description List installments added to a list of deals. ### Method GET ### Endpoint /deals/installments ``` -------------------------------- ### GET /deals/installments Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/DealsApi.md Lists installments attached to a list of deals. Only available in Growth and above plans. ```APIDOC ## GET /deals/installments ### Description Lists installments attached to a list of deals. Only available in Growth and above plans. ### Method GET ### Endpoint /v2/deals/installments ### Parameters #### Query Parameters - **deal_ids** (int[]) - Required - An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. - **cursor** (string) - Optional - For pagination, the marker (an opaque string value) representing the first item on the next page - **limit** (int) - Optional - For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. - **sort_by** (string) - Optional - The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. - **sort_direction** (string) - Optional - The sorting direction. Supported values: `asc`, `desc`. ### Request Example ```php setApiKey('x-api-token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = (new Pipedrive\versions\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); // Configure OAuth2 access token for authorization: oauth2 $config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( // 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 ); $deal_ids = array(56); // int[] | An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. $cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page $limit = 100; // int | For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. $sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. $sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. try { $result = $apiInstance->getInstallments($deal_ids, $cursor, $limit, $sort_by, $sort_direction); print_r($result); } catch (Exception $e) { echo 'Exception when calling DealsApi->getInstallments: ', $e->getMessage(), PHP_EOL; } ``` ### Response #### Success Response (200) - **InstallmentsResponse** - Details of the response object can be found in the Pipedrive API documentation. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Initialize API client with OAuth 2.0 Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/README.md Sets up the configuration object with OAuth credentials. ```php $oAuthClientId = 'oAuthClientId'; // OAuth 2 Client ID $oAuthClientSecret = 'oAuthClientSecret'; // OAuth 2 Client Secret $oAuthRedirectUri = 'https://example.com/oauth/callback'; // OAuth 2 Redirection endpoint or Callback Uri $config = (new Pipedrive\versions\v2\Configuration()); $config->setClientId($oAuthClientId); $config->setClientSecret($oAuthClientSecret); $config->setOauthRedirectUri($oAuthRedirectUri); $dealsApiInstance = new DealsApi(null, $config); ``` -------------------------------- ### GET /installments Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/BetaApi.md Lists installments attached to a list of deals. Only available in Growth and above plans. ```APIDOC ## GET /installments ### Description List installments added to a list of deals. Only available in Growth and above plans. ### Method GET ### Endpoint /installments ### Parameters #### Query Parameters - **deal_ids** (string) - Required - Comma separated deal IDs. - **cursor** (string) - Optional - For pagination, the previous last item from the list. - **limit** (int) - Optional - Limit the number of results per page. - **sort_by** (string) - Optional - Affects the sorting of the installments. Possible values: `date`. - **sort_direction** (string) - Optional - Sorting direction. Possible values: `asc`, `desc`. ### Response #### Success Response (200) - ** #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Retrieve Product Fields with ProductFieldsApi Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/ProductFieldsApi.md Demonstrates how to initialize the ProductFieldsApi client and fetch product fields with optional pagination and filtering parameters. ```php setApiKey('x-api-token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = (new Pipedrive\versions\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); // Configure OAuth2 access token for authorization: oauth2 $config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Pipedrive\versions\v2\Api\ProductFieldsApi( // 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 ); $include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional data namespaces to include in response $limit = 100; // int | For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. $cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page try { $result = $apiInstance->getProductFields($include_fields, $limit, $cursor); print_r($result); } catch (Exception $e) { echo 'Exception when calling ProductFieldsApi->getProductFields: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Initialize API client with API token Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/README.md Configures the client using a static API key for authentication. ```php setApiKey('x-api-token', 'YOUR_API_KEY'); $apiInstance = new Pipedrive\versions\v2\Api\ActivitiesApi( // 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 ); try { $result = $apiInstance->getActivities(); echo '
';
print_r($result);
echo '';
} catch (Exception $e) {
echo 'Exception when calling ActivitiesApi->getActivities: ', $e->getMessage(), PHP_EOL;
}
?>
```
--------------------------------
### Get Deal Installments with Pipedrive PHP Client
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/DealsApi.md
Fetches installments for specified deals using the Pipedrive PHP client. Supports pagination and sorting. Ensure API key or access token is configured.
```php
setApiKey('x-api-token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\versions\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\versions\v2\Api\DealsApi(
// 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
);
$deal_ids = array(56); // int[] | An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided.
$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page
$limit = 100; // int | For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed.
$sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`.
$sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`.
try {
$result = $apiInstance->getInstallments($deal_ids, $cursor, $limit, $sort_by, $sort_direction);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DealsApi->getInstallments: ', $e->getMessage(), PHP_EOL;
}
```
--------------------------------
### Update a product image via BetaApi
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/BetaApi.md
Shows the method signature and a full example for updating a product image using a file path.
```php
updateProductImage($id, $data): \Pipedrive\versions\v2\Model\UpdateProductImageResponse
```
```php
setApiKey('x-api-token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\versions\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\versions\v2\Api\BetaApi(
// 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 = 56; // int | The ID of the product
$data = "/path/to/file.txt"; // \SplFileObject | One image supplied in the multipart/form-data encoding
try {
$result = $apiInstance->updateProductImage($id, $data);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling BetaApi->updateProductImage: ', $e->getMessage(), PHP_EOL;
}
```
--------------------------------
### GET /installments
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/BetaApi.md
Retrieves a list of installments associated with specified deal IDs. Supports pagination and sorting.
```APIDOC
## GET /installments
### Description
Retrieves a list of installments associated with specified deal IDs. Supports pagination and sorting.
### Method
GET
### Endpoint
/v2/installments
### Parameters
#### Query Parameters
- **deal_ids** (int[]) - Required - An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided.
- **cursor** (string) - Optional - For pagination, the marker (an opaque string value) representing the first item on the next page.
- **limit** (int) - Optional - For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed.
- **sort_by** (string) - Optional - The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. Defaults to `id`.
- **sort_direction** (string) - Optional - The sorting direction. Supported values: `asc`, `desc`. Defaults to `asc`.
### Response
#### Success Response (200)
- **data** (InstallmentsResponse) - Description of the response data structure.
#### Response Example
```json
{
"data": {
"installments": [
{
"id": 1,
"deal_id": 56,
"billing_date": "2023-01-01",
"amount": 100.00,
"currency": "USD",
"paid_date": null,
"status": "pending"
}
],
"additional_data": {
"pagination": {
"next_cursor": "next_cursor_value"
}
}
}
}
```
```
--------------------------------
### GET /activities/{id}
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/ActivitiesApi.md
Get details of a specific activity.
```APIDOC
## GET /activities/{id}
### Description
Get details of an activity
Returns the details of a specific activity.
### Method
GET
### Endpoint
/activities/{id}
### Parameters
#### Path Parameters
- **id** (int) - Required - The ID of the activity
#### Query Parameters
- **include_fields** (string) - Optional - Optional comma separated string array of additional fields to include
### Request Example
```php
setApiKey('x-api-token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\versions\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\versions\v2\Api\ActivitiesApi(
// 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 = 56; // int | The ID of the activity
$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional fields to include
try {
$result = $apiInstance->getActivity($id, $include_fields);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ActivitiesApi->getActivity: ', $e->getMessage(), PHP_EOL;
}
?>
```
### Return type
[**Pipedrive\versions\v2\Model\PostPatchGetActivity**](../Model/PostPatchGetActivity.md)
### Authorization
[api_key](../README.md#api_key), [oauth2](../README.md#oauth2)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: `application/json`
```
--------------------------------
### Add a New Product with ProductsApi
Source: https://context7.com/pipedrive/client-php/llms.txt
Creates a new product in the catalog with specified pricing and visibility settings.
```php
setApiKey('x-api-token', 'YOUR_API_KEY');
$apiInstance = new ProductsApi(new GuzzleHttp\Client(), $config);
$productRequestBody = new AddProductRequestBody();
$productRequestBody->setName('Enterprise Software License');
$productRequestBody->setCode('ENT-001');
$productRequestBody->setUnit('license');
$productRequestBody->setPrices([
['price' => 1000, 'currency' => 'USD', 'cost' => 200, 'overhead_cost' => 50]
]);
$productRequestBody->setTax(0);
$productRequestBody->setActiveFlag(true);
$productRequestBody->setVisibleTo('3');
try {
$result = $apiInstance->addProduct($productRequestBody);
echo 'Product created with ID: ' . $result->getData()->getId();
print_r($result);
} catch (Exception $e) {
echo 'Exception: ', $e->getMessage(), PHP_EOL;
}
```
--------------------------------
### Create a product field with PHP
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/ProductFieldsApi.md
Demonstrates how to initialize the ProductFieldsApi client with API key or OAuth2 authentication and call the addProductField method.
```php
setApiKey('x-api-token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\\\versions\\\v2\\\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\\\versions\\\v2\\\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\\\versions\\\v2\\\Api\\\ProductFieldsApi(
// 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
);
$create_product_field_request = new \\Pipedrive\\\versions\\\v2\\\Model\\\CreateProductFieldRequest(); // \\Pipedrive\\\versions\\\v2\\\Model\\\CreateProductFieldRequest
try {
$result = $apiInstance->addProductField($create_product_field_request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ProductFieldsApi->addProductField: ', $e->getMessage(), PHP_EOL;
}
```
--------------------------------
### GET /activities - Get All Activities
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/ActivitiesApi.md
Retrieves data about all activities in Pipedrive.
```APIDOC
## GET /activities
### Description
Get all activities.
### Method
GET
### Endpoint
/activities
### Parameters
#### Query Parameters
- **filter_id** (int) - Optional - The ID of the filter to use.
- **ids** (string) - Optional - Comma-separated activity IDs to get.
- **owner_id** (int) - Optional - The ID of the user who owns the activities.
- **deal_id** (int) - Optional - The ID of the deal associated with the activities.
- **lead_id** (int) - Optional - The ID of the lead associated with the activities.
- **person_id** (int) - Optional - The ID of the person associated with the activities.
- **org_id** (int) - Optional - The ID of the organization associated with the activities.
- **done** (bool) - Optional - Whether the activities are done or not.
- **updated_since** (string) - Optional - The date to filter activities updated since.
- **updated_until** (string) - Optional - The date to filter activities updated until.
- **sort_by** (string) - Optional - The field to sort by. Possible values: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `type`, `subject`, `due_date`, `add_time`, `update_time`.
- **sort_direction** (string) - Optional - The direction of sorting. Possible values: `asc`, `desc`.
- **include_fields** (string) - Optional - Comma-separated list of fields to include in the response.
- **limit** (int) - Optional - The maximum number of activities to return.
- **cursor** (string) - Optional - The cursor to use for pagination.
### Response
#### Success Response (200)
- **data** (array) - An array of activity objects.
- **additional_data** (object) - Contains additional data, including pagination information.
#### Response Example
```json
{
"data": [
{
"id": 1,
"company_id": 1,
"user_id": 1,
"deal_id": null,
"person_id": 1,
"org_id": 1,
"type": "call",
"subject": "Call client",
"notes": "Discuss project status.",
"due_date": "2023-10-27",
"due_time": "10:00:00",
"duration": null,
"active_flag": true,
"undated_flag": false,
"created_time": "2023-10-26 10:00:00",
"last_updated_time": "2023-10-26 10:00:00",
"snoozed_flag": false,
"snoozed_until": null
}
],
"additional_data": {
"pagination": {
"next_cursor": "some_cursor_string",
"has_more_items": true
}
}
}
```
```
--------------------------------
### Create a New Deal with PHP
Source: https://context7.com/pipedrive/client-php/llms.txt
Initializes the DealsApi client and uses DealRequestBody to define deal attributes before submission.
```php
setApiKey('x-api-token', 'YOUR_API_KEY');
$apiInstance = new DealsApi(new GuzzleHttp\Client(), $config);
$dealRequestBody = new DealRequestBody();
$dealRequestBody->setTitle('New Enterprise Deal');
$dealRequestBody->setValue(50000);
$dealRequestBody->setCurrency('USD');
$dealRequestBody->setPersonId(123);
$dealRequestBody->setOrgId(456);
$dealRequestBody->setPipelineId(1);
$dealRequestBody->setStageId(2);
$dealRequestBody->setStatus('open');
try {
$result = $apiInstance->addDeal($dealRequestBody);
echo 'Deal created with ID: ' . $result->getData()->getId();
print_r($result);
} catch (Exception $e) {
echo 'Exception when creating deal: ', $e->getMessage(), PHP_EOL;
}
```
--------------------------------
### Update Deal Installment
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/DealsApi.md
Use this to edit an installment associated with a deal. This feature is available on Growth plans and above. Requires deal and installment IDs. API key or OAuth2 authentication is necessary.
```php
setApiKey('x-api-token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\\\versions\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\\\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\\\versions\v2\Api\DealsApi(
// 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 = 56; // int | The ID of the deal
$installment_id = 56; // int | The ID of the installment
$body = new \stdClass; // object
try {
$result = $apiInstance->updateInstallment($id, $installment_id, $body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DealsApi->updateInstallment: ', $e->getMessage(), PHP_EOL;
}
```
--------------------------------
### Upload a product image using BetaApi
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/BetaApi.md
Demonstrates how to configure the Pipedrive client with API key or OAuth2 credentials and call the uploadProductImage method.
```php
setApiKey('x-api-token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive versions 2 Configuration())->setApiKeyPrefix('x-api-token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\versions 2\Api\BetaApi(
// 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 = 56; // int | The ID of the product
$data = "/path/to/file.txt"; // \SplFileObject | One image supplied in the multipart/form-data encoding
try {
$result = $apiInstance->uploadProductImage($id, $data);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling BetaApi->uploadProductImage: ', $e->getMessage(), PHP_EOL;
}
```
--------------------------------
### GET /pipelines - Get all pipelines
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/PipelinesApi.md
Retrieves a list of all pipelines in your Pipedrive account.
```APIDOC
## GET /pipelines
### Description
Get all pipelines
Returns a list of all pipelines.
### Method
GET
### Endpoint
/pipelines
### Response
#### Success Response (200)
- **data** (array) - An array of pipeline objects.
- Each object contains:
- **id** (integer) - The ID of the pipeline.
- **name** (string) - The name of the pipeline.
- **active_flag** (boolean) - Whether the pipeline is active.
- **order_nr** (integer) - The order number of the pipeline.
- **deals_default_label** (string) - The default label for deals in this pipeline.
#### Response Example
```json
{
"success": true,
"data": [
{
"id": 1,
"name": "Sales Pipeline",
"active_flag": true,
"order_nr": 0,
"deals_default_label": "Deal"
},
{
"id": 2,
"name": "Support Pipeline",
"active_flag": true,
"order_nr": 1,
"deals_default_label": "Ticket"
}
]
}
```
```
--------------------------------
### GET /activities/{id} - Get Activity
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/ActivitiesApi.md
Retrieves details of a specific activity by its ID.
```APIDOC
## GET /activities/{id}
### Description
Get details of an activity.
### Method
GET
### Endpoint
/activities/{id}
### Parameters
#### Path Parameters
- **id** (int) - Required - The ID of the activity to retrieve.
#### Query Parameters
- **include_fields** (string) - Optional - Comma-separated list of fields to include in the response.
### Response
#### Success Response (200)
- **data** (object) - Contains the details of the activity.
#### Response Example
```json
{
"data": {
"id": 1,
"company_id": 1,
"user_id": 1,
"deal_id": null,
"person_id": 1,
"org_id": 1,
"type": "call",
"subject": "Call client",
"notes": "Discuss project status.",
"due_date": "2023-10-27",
"due_time": "10:00:00",
"duration": null,
"active_flag": true,
"undated_flag": false,
"created_time": "2023-10-26 10:00:00",
"last_updated_time": "2023-10-26 10:00:00",
"snoozed_flag": false,
"snoozed_until": null
}
}
```
```
--------------------------------
### Retrieve product image with PHP
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/BetaApi.md
Uses the BetaApi to fetch a product image by ID. The returned URL is valid for 7 days.
```php
setApiKey('x-api-token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\versions\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\versions\v2\Api\BetaApi(
// 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 = 56; // int | The ID of the product
try {
$result = $apiInstance->getProductImage($id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling BetaApi->getProductImage: ', $e->getMessage(), PHP_EOL;
}
```
--------------------------------
### Add an installment to a deal using PHP
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/DealsApi.md
Configures the API client with authentication and executes the postInstallment method. Requires a deal ID and an optional body object.
```php
setApiKey('x-api-token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive
otifications
versions
v2
Configuration())->setApiKeyPrefix('x-api-token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive
otifications
versions
v2
Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive
otifications
versions
v2
Api
DealsApi(
// 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 = 56; // int | The ID of the deal
$body = new \stdClass; // object
try {
$result = $apiInstance->postInstallment($id, $body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DealsApi->postInstallment: ', $e->getMessage(), PHP_EOL;
}
```
--------------------------------
### GET /dealFields
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/DealFieldsApi.md
Get all deal fields. Retrieve a list of all custom deal fields.
```APIDOC
## GET /dealFields
### Description
Get all deal fields. Retrieve a list of all custom deal fields.
### Method
GET
### Endpoint
/dealFields
### Parameters
#### Query Parameters
- **filter_id** (integer) - Optional - Filter deal fields by a specific filter ID.
- **type** (string) - Optional - Filter deal fields by their type (e.g., 'text', 'number', 'enum').
### Response
#### Success Response (200)
- **DealFields** (array of \Pipedrive\versions\v2\Model\DealField) - A list of all deal fields.
#### Response Example
```json
{
"example": "response body"
}
```
```
--------------------------------
### GET /organizationFields
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/OrganizationFieldsApi.md
Get all organization fields. This endpoint retrieves a list of all organization custom fields.
```APIDOC
## GET /organizationFields
### Description
Get all organization fields.
### Method
GET
### Endpoint
/organizationFields
### Response
#### Success Response (200)
- **data** (array) - An array of organization field objects.
- **additional_data** (object) - Contains additional data, such as pagination information.
#### Response Example
```json
{
"example": "response body"
}
```
```
--------------------------------
### Retrieve a product by ID
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/ProductsApi.md
Demonstrates how to configure the API client and fetch a specific product using its ID.
```php
setApiKey('x-api-token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\versions\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Pipedrive\versions\v2\Api\ProductsApi(
// 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 = 56; // int | The ID of the product
try {
$result = $apiInstance->getProduct($id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ProductsApi->getProduct: ', $e->getMessage(), PHP_EOL;
}
```
--------------------------------
### POST /postInstallment
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/BetaApi.md
Adds an installment to a deal. An installment can only be added if the deal includes at least one one-time product. If the deal contains at least one recurring product, adding installments is not allowed. Only available in Growth and above plans.
```APIDOC
## POST /postInstallment
### Description
Adds an installment to a deal. An installment can only be added if the deal includes at least one one-time product. If the deal contains at least one recurring product, adding installments is not allowed. Only available in Growth and above plans.
### Method
POST
### Endpoint
/deals/{id}/installments
### Parameters
#### Path Parameters
- **id** (int) - Required - The ID of the deal
#### Request Body
- **body** (object) - Optional - Installment details
### Request Example
```json
{
"body": {
"value": 100.50,
"currency": "USD",
"due_date": "2023-12-31"
}
}
```
### Response
#### Success Response (200)
- **data** (object) - Details of the added installment
#### Response Example
```json
{
"success": true,
"data": {
"id": 1,
"deal_id": 123,
"value": 100.50,
"currency": "USD",
"due_date": "2023-12-31",
"period_type": "day",
"period_count": 30
}
}
```
```
--------------------------------
### GET /deals/products
Source: https://github.com/pipedrive/client-php/blob/master/docs/versions/v2/Api/DealsApi.md
Get deal products of several deals. Returns data about products attached to deals.
```APIDOC
## GET /deals/products
### Description
Get deal products of several deals. Returns data about products attached to deals.
### Method
GET
### Endpoint
/deals/products
### Parameters
#### Query Parameters
- **deal_ids** (string) - Required - Comma separated string array of deal IDs.
- **cursor** (string) - Optional - For pagination, the marker (an opaque string value) representing the first item on the next page.
- **limit** (int) - Optional - For pagination, the limit of entries to be returned. Please note that a maximum value of 500 is allowed.
- **sort_by** (string) - Optional - The field to sort by. Supported fields: `id`, `update_time`, `add_time`.
- **sort_direction** (string) - Optional - The sorting direction. Supported values: `asc`, `desc`.
### Response
#### Success Response (200)
- **data** (array) - Array of deal products.
#### Response Example
{
"data": [
{
"id": 1,
"deal_id": 1,
"product_id": 1,
"sum_amount": 1000,
"amount": 1000,
"quantity": 1,
"add_time": "2023-01-01T10:00:00Z",
"update_time": "2023-01-01T10:00:00Z"
}
]
}
### Authorization
[api_key](../README.md#api_key), [oauth2](../README.md#oauth2)
```