Difference between revisions of "API:Opportunity:Contact:Get"

From docs
Jump to: navigation, search
 
Line 1: Line 1:
== [[API]] » Get Contact Opportunity ==
+
== [[API]] » Get Opportunities ==
  
'''URL:''' <nowiki>https://app.callproof.com/api/opportunity/get/</nowiki>
+
=== Base URL ===
 +
https://app.callproof.com
  
'''Method:''' GET
+
=== Endpoint ===
 +
/api/opportunity/get/
  
'''Required Fields:'''
+
=== Purpose ===
 +
Retrieves opportunities associated with a specific contact in your CallProof company that were updated within a specified date range. Supports pagination for syncing opportunity changes. Opportunities are included when the contact is the primary opportunity contact or an additional related contact.
  
* '''''key''''' - API Key
+
=== HTTP Method ===
* '''''secret''''' - API Key Secret
+
GET
* '''''contact_id''''' - Contact ID
 
* '''''after''''' - Date/Time Opportunity for contact were created after (e.g. '2014-08-10 12:34:56')
 
  
'''Optional Fields:'''
+
=== Headers ===
* '''''before''''' - Date/Time Opportunity for contact were created before (e.g. '2014-08-10 12:34:56')
+
No required headers.
* '''''offset''''' - Only 100 Opportunities are returned per request, this field must be used to pull additional results when more are available
 
  
 +
{| class="wikitable"
 +
! Header !! Required !! Description
 +
|-
 +
| — || — || No headers are required for this endpoint. Authentication is provided via query parameters.
 +
|}
  
'''Data Returned:'''
+
=== Security ===
 +
* '''Yes''' – Requires a valid API key and secret with permission to read opportunities.
  
* '''''results''''' - Opportunities
+
=== Parameters ===
* '''''errors''''' - Array of errors produced by the request
+
 
* '''''code''''' - HTTP request status
+
==== Query Parameters ====
 +
{| class="wikitable"
 +
! Parameter !! Type !! Required !! Description
 +
|-
 +
| key || string || Yes || Public API key assigned to your CallProof account.
 +
|-
 +
| secret || string || Yes || Private API secret paired with the API key.
 +
|-
 +
| contact_id || integer || Yes || Unique identifier of the contact whose opportunities should be retrieved. Must belong to your company.
 +
|-
 +
| after || datetime string || Yes || Return only opportunities updated on or after this date/time. Invalid or missing values cause a validation error.
 +
|-
 +
| before || datetime string || No || Return only opportunities updated on or before this date/time. If omitted, no upper date limit is applied.
 +
|-
 +
| offset || integer || No || Starting position for paginated results. Defaults to <code>0</code> if omitted or invalid.
 +
|}
 +
 
 +
==== Path Parameters ====
 +
None.
 +
 
 +
==== Request Body ====
 +
None.
 +
 
 +
=== cURL Example ===
 +
<pre>
 +
curl -X GET "https://app.callproof.com/api/opportunity/get/?key=YOUR_API_KEY&secret=YOUR_API_SECRET&contact_id=789&after=2024-01-01"
 +
</pre>
 +
 
 +
=== Successful Response (200) ===
 +
Returns a paginated list of opportunities for the specified contact within the requested update date range. Up to 100 opportunities are returned per request. If more matching opportunities exist, <code>more</code> is set to <code>1</code> so the caller can request the next page using <code>offset</code>.
 +
 
 +
{| class="wikitable"
 +
! Field !! Type !! Description
 +
|-
 +
| results || array || List of opportunity objects (maximum 100 per response).
 +
|-
 +
| results[].opp_id || integer || Unique identifier for the opportunity.
 +
|-
 +
| results[].rep || object || Sales representative associated with the opportunity.
 +
|-
 +
| results[].rep.id || integer || Rep profile identifier.
 +
|-
 +
| results[].rep.email || string || Rep email address.
 +
|-
 +
| results[].rep.user_id || integer || Associated user account identifier.
 +
|-
 +
| results[].rep.name || string || Rep display name.
 +
|-
 +
| results[].rep.title || string || Rep job title.
 +
|-
 +
| results[].rep.updated || string || Date and time the rep profile was last updated.
 +
|-
 +
| results[].contact_name || string || Display name of the primary contact.
 +
|-
 +
| results[].contact_id || integer || Identifier of the primary contact.
 +
|-
 +
| results[].opp_type_id || integer || Opportunity type identifier.
 +
|-
 +
| results[].opp_stage_id || integer || Opportunity stage identifier.
 +
|-
 +
| results[].opp_name || string || Opportunity name.
 +
|-
 +
| results[].value || string || Opportunity value.
 +
|-
 +
| results[].probability || string || Win probability percentage.
 +
|-
 +
| results[].derived || string || Derived value calculated from value and probability.
 +
|-
 +
| results[].created || string || Date and time the opportunity was created (<code>YYYY-MM-DD HH:MM:SS</code>).
 +
|-
 +
| results[].updated || string || Date and time the opportunity was last updated (<code>YYYY-MM-DD HH:MM:SS</code>).
 +
|-
 +
| results[].close_date || string || Close date value returned for the opportunity.
 +
|-
 +
| results[].other_contacts || array || Additional contacts associated with the opportunity.
 +
|-
 +
| results[].other_contacts[].id || integer || Additional contact identifier.
 +
|-
 +
| results[].other_contacts[].name || string || Additional contact display name.
 +
|-
 +
| results[].notes || string || Opportunity notes.
 +
|-
 +
| more || integer || <code>1</code> if additional matching opportunities remain; <code>0</code> if this is the last page.
 +
|-
 +
| offset || integer || Offset value used for this request.
 +
|-
 +
| errors || array || Empty list when the request succeeds.
 +
|-
 +
| code || integer || HTTP-style status value; <code>200</code> on success.
 +
|}
 +
 
 +
Example response:
 +
<pre>
 +
{
 +
  "results": [
 +
    {
 +
      "opp_id": 9001,
 +
      "rep": {
 +
        "id": 123,
 +
        "email": "rep@example.com",
 +
        "user_id": 456,
 +
        "name": "Jane Smith",
 +
        "title": "Account Executive",
 +
        "updated": "2024-06-01 10:00:00"
 +
      },
 +
      "contact_name": "John Doe",
 +
      "contact_id": 789,
 +
      "opp_type_id": 1,
 +
      "opp_stage_id": 2,
 +
      "opp_name": "Annual Renewal",
 +
      "value": "25000.00",
 +
      "probability": "50",
 +
      "derived": "12500.0",
 +
      "created": "2024-01-10 09:00:00",
 +
      "updated": "2024-06-15 14:30:00",
 +
      "close_date": "2024-01-10 09:00:00",
 +
      "other_contacts": [
 +
        {
 +
          "id": 790,
 +
          "name": "Sarah Jones"
 +
        }
 +
      ],
 +
      "notes": "Discussing renewal terms"
 +
    }
 +
  ],
 +
  "more": 0,
 +
  "offset": 0,
 +
  "errors": [],
 +
  "code": 200
 +
}
 +
</pre>
 +
 
 +
=== Notes ===
 +
* <code>contact_id</code> and <code>after</code> are required.
 +
* Results are filtered by the opportunity’s last-updated timestamp.
 +
* Opportunities are returned when the contact is the primary contact or an additional related contact on the opportunity.
 +
* Results are ordered by opportunity ID ascending.
 +
* Up to 100 records are returned per page. Use <code>offset</code> with <code>more</code> to page through larger result sets.
 +
* Only opportunities belonging to your company are returned.
 +
* Use <code>/api/opportunity/stages/get/</code> and <code>/api/opportunity/type/get/</code> to resolve stage and type names from their IDs.
 +
 
 +
=== Error Responses ===
 +
{| class="wikitable"
 +
! Status Code !! Meaning
 +
|-
 +
| 400 || Bad Request – The required <code>after</code> parameter is missing/invalid, or the contact ID is missing/invalid.
 +
|-
 +
| 401 || Unauthorized – The API key and/or secret is missing, invalid, inactive, associated with a disabled account, or lacks permission to read opportunities.
 +
|-
 +
| 405 || Method Not Allowed – A method other than GET was used.
 +
|-
 +
| 500 || Internal Server Error – An unexpected server problem occurred. Not specified in Swagger.
 +
|}
 +
 
 +
'''400 response body examples:'''
 +
<pre>
 +
{
 +
  "results": [],
 +
  "errors": ["Invalid 'after' field"],
 +
  "code": 400
 +
}
 +
</pre>
 +
 
 +
<pre>
 +
{
 +
  "results": [],
 +
  "errors": ["Invalid 'contact id' field"],
 +
  "code": 400
 +
}
 +
</pre>
 +
 
 +
'''401 response body example:'''
 +
<pre>
 +
{
 +
  "results": [],
 +
  "errors": ["Invalid API Key"],
 +
  "code": 401
 +
}
 +
</pre>
 +
 
 +
'''405 response body example:'''
 +
<pre>
 +
{
 +
  "results": [],
 +
  "errors": ["Method not allowed"],
 +
  "code": 405
 +
}
 +
</pre>

Latest revision as of 14:44, 17 July 2026

API » Get Opportunities

Base URL

https://app.callproof.com

Endpoint

/api/opportunity/get/

Purpose

Retrieves opportunities associated with a specific contact in your CallProof company that were updated within a specified date range. Supports pagination for syncing opportunity changes. Opportunities are included when the contact is the primary opportunity contact or an additional related contact.

HTTP Method

GET

Headers

No required headers.

Header Required Description
No headers are required for this endpoint. Authentication is provided via query parameters.

Security

  • Yes – Requires a valid API key and secret with permission to read opportunities.

Parameters

Query Parameters

Parameter Type Required Description
key string Yes Public API key assigned to your CallProof account.
secret string Yes Private API secret paired with the API key.
contact_id integer Yes Unique identifier of the contact whose opportunities should be retrieved. Must belong to your company.
after datetime string Yes Return only opportunities updated on or after this date/time. Invalid or missing values cause a validation error.
before datetime string No Return only opportunities updated on or before this date/time. If omitted, no upper date limit is applied.
offset integer No Starting position for paginated results. Defaults to 0 if omitted or invalid.

Path Parameters

None.

Request Body

None.

cURL Example

curl -X GET "https://app.callproof.com/api/opportunity/get/?key=YOUR_API_KEY&secret=YOUR_API_SECRET&contact_id=789&after=2024-01-01"

Successful Response (200)

Returns a paginated list of opportunities for the specified contact within the requested update date range. Up to 100 opportunities are returned per request. If more matching opportunities exist, more is set to 1 so the caller can request the next page using offset.

Field Type Description
results array List of opportunity objects (maximum 100 per response).
results[].opp_id integer Unique identifier for the opportunity.
results[].rep object Sales representative associated with the opportunity.
results[].rep.id integer Rep profile identifier.
results[].rep.email string Rep email address.
results[].rep.user_id integer Associated user account identifier.
results[].rep.name string Rep display name.
results[].rep.title string Rep job title.
results[].rep.updated string Date and time the rep profile was last updated.
results[].contact_name string Display name of the primary contact.
results[].contact_id integer Identifier of the primary contact.
results[].opp_type_id integer Opportunity type identifier.
results[].opp_stage_id integer Opportunity stage identifier.
results[].opp_name string Opportunity name.
results[].value string Opportunity value.
results[].probability string Win probability percentage.
results[].derived string Derived value calculated from value and probability.
results[].created string Date and time the opportunity was created (YYYY-MM-DD HH:MM:SS).
results[].updated string Date and time the opportunity was last updated (YYYY-MM-DD HH:MM:SS).
results[].close_date string Close date value returned for the opportunity.
results[].other_contacts array Additional contacts associated with the opportunity.
results[].other_contacts[].id integer Additional contact identifier.
results[].other_contacts[].name string Additional contact display name.
results[].notes string Opportunity notes.
more integer 1 if additional matching opportunities remain; 0 if this is the last page.
offset integer Offset value used for this request.
errors array Empty list when the request succeeds.
code integer HTTP-style status value; 200 on success.

Example response:

{
  "results": [
    {
      "opp_id": 9001,
      "rep": {
        "id": 123,
        "email": "rep@example.com",
        "user_id": 456,
        "name": "Jane Smith",
        "title": "Account Executive",
        "updated": "2024-06-01 10:00:00"
      },
      "contact_name": "John Doe",
      "contact_id": 789,
      "opp_type_id": 1,
      "opp_stage_id": 2,
      "opp_name": "Annual Renewal",
      "value": "25000.00",
      "probability": "50",
      "derived": "12500.0",
      "created": "2024-01-10 09:00:00",
      "updated": "2024-06-15 14:30:00",
      "close_date": "2024-01-10 09:00:00",
      "other_contacts": [
        {
          "id": 790,
          "name": "Sarah Jones"
        }
      ],
      "notes": "Discussing renewal terms"
    }
  ],
  "more": 0,
  "offset": 0,
  "errors": [],
  "code": 200
}

Notes

  • contact_id and after are required.
  • Results are filtered by the opportunity’s last-updated timestamp.
  • Opportunities are returned when the contact is the primary contact or an additional related contact on the opportunity.
  • Results are ordered by opportunity ID ascending.
  • Up to 100 records are returned per page. Use offset with more to page through larger result sets.
  • Only opportunities belonging to your company are returned.
  • Use /api/opportunity/stages/get/ and /api/opportunity/type/get/ to resolve stage and type names from their IDs.

Error Responses

Status Code Meaning
400 Bad Request – The required after parameter is missing/invalid, or the contact ID is missing/invalid.
401 Unauthorized – The API key and/or secret is missing, invalid, inactive, associated with a disabled account, or lacks permission to read opportunities.
405 Method Not Allowed – A method other than GET was used.
500 Internal Server Error – An unexpected server problem occurred. Not specified in Swagger.

400 response body examples:

{
  "results": [],
  "errors": ["Invalid 'after' field"],
  "code": 400
}
{
  "results": [],
  "errors": ["Invalid 'contact id' field"],
  "code": 400
}

401 response body example:

{
  "results": [],
  "errors": ["Invalid API Key"],
  "code": 401
}

405 response body example:

{
  "results": [],
  "errors": ["Method not allowed"],
  "code": 405
}