Difference between revisions of "API:Call:Create"
(Created page with "== API » Create Call == '''URL:''' <nowiki>https://app.callproof.com/api/call/create/</nowiki> '''Method:''' POST '''Required Fields:''' * '''''api_key[key]''''' ...") |
Ashley DeBon (talk | contribs) |
||
| Line 1: | Line 1: | ||
== [[API]] » Create Call == | == [[API]] » Create Call == | ||
| − | + | === Base URL === | |
| + | https://app.callproof.com | ||
| − | + | === Endpoint === | |
| + | /api/call/create/ | ||
| − | + | === Purpose === | |
| + | Creates a new call record for the authenticated API user in your CallProof company. If a matching call already exists for the same user, phone number, call type, and start time, the existing record’s duration may be updated instead of creating a duplicate. | ||
| − | + | === HTTP Method === | |
| − | + | POST | |
| − | |||
| − | |||
| − | |||
| − | + | === Headers === | |
| − | + | {| class="wikitable" | |
| − | + | ! Header !! Required !! Description | |
| + | |- | ||
| + | | Content-Type || Yes || Must be <code>application/json</code>. | ||
| + | |} | ||
| + | === Security === | ||
| + | * '''Yes''' – Requires a valid API key and secret with permission to create calls. Credentials are sent in the request body. | ||
| − | + | === Parameters === | |
| − | + | ==== Path Parameters ==== | |
| − | + | None. | |
| − | + | ||
| + | ==== Query Parameters ==== | ||
| + | None. | ||
| + | |||
| + | ==== Request Body ==== | ||
| + | {| class="wikitable" | ||
| + | ! Parameter !! Type !! Required !! Description | ||
| + | |- | ||
| + | | api_key || object || Yes || Authentication credentials object. | ||
| + | |- | ||
| + | | api_key.key || string || Yes || Public API key assigned to your CallProof account. | ||
| + | |- | ||
| + | | api_key.secret || string || Yes || Private API secret paired with the API key. | ||
| + | |- | ||
| + | | call_data || object || Yes || Call creation payload. | ||
| + | |- | ||
| + | | call_data.number || string || Yes || Phone number for the call. Digits only after normalization. Must not be empty or all zeros. | ||
| + | |- | ||
| + | | call_data.start_datetime || datetime string || Yes || Date and time the call started. | ||
| + | |- | ||
| + | | call_data.call_type || string || Yes || Call type name (for example, <code>outgoing</code> or <code>incoming</code>). Must match a recognized call type. | ||
| + | |- | ||
| + | | call_data.duration || integer || No || Call duration in seconds. Defaults to <code>0</code> if omitted or invalid. | ||
| + | |- | ||
| + | | call_data.local_id || integer || No || Optional local/device identifier for the call. Defaults to <code>0</code> if omitted or invalid. | ||
| + | |} | ||
| + | |||
| + | === cURL Example === | ||
| + | <pre> | ||
| + | curl -X POST "https://app.callproof.com/api/call/create/" \ | ||
| + | -H "Content-Type: application/json" \ | ||
| + | -d '{ | ||
| + | "api_key": { | ||
| + | "key": "YOUR_API_KEY", | ||
| + | "secret": "YOUR_API_SECRET" | ||
| + | }, | ||
| + | "call_data": { | ||
| + | "number": "5551234567", | ||
| + | "start_datetime": "2024-06-15 14:30:00", | ||
| + | "call_type": "outgoing", | ||
| + | "duration": 185, | ||
| + | "local_id": 1 | ||
| + | } | ||
| + | }' | ||
| + | </pre> | ||
| + | |||
| + | === Successful Response (200) === | ||
| + | Indicates the call was created or an existing matching call was updated. The response returns the call details plus a <code>new_call</code> indicator. | ||
| + | |||
| + | {| class="wikitable" | ||
| + | ! Field !! Type !! Description | ||
| + | |- | ||
| + | | results || object || Saved call details. | ||
| + | |- | ||
| + | | results.id || integer || Unique identifier for the call. | ||
| + | |- | ||
| + | | results.created || string || Date and time the call started (<code>YYYY-MM-DD HH:MM:SS</code>). | ||
| + | |- | ||
| + | | results.contact_id || integer || Associated contact identifier, when available. | ||
| + | |- | ||
| + | | results.contact || string || Contact display name, when available. | ||
| + | |- | ||
| + | | results.contact_phone_id || integer || Associated contact phone identifier, when available. | ||
| + | |- | ||
| + | | results.contact_phone || string || Contact phone number used for the call, when available. | ||
| + | |- | ||
| + | | results.user_phone_id || integer || Identifier of the user phone used for the call, when available. | ||
| + | |- | ||
| + | | results.user_phone || string || User phone number used for the call, when available. | ||
| + | |- | ||
| + | | results.phone_number || string || Phone number recorded for the call. | ||
| + | |- | ||
| + | | results.rep || object || Sales representative associated with the call. | ||
| + | |- | ||
| + | | results.call_type || string || Call type name. | ||
| + | |- | ||
| + | | results.duration || integer || Call duration in seconds. | ||
| + | |- | ||
| + | | results.new_call || integer || <code>1</code> if a new call was created; <code>0</code> if an existing matching call was updated. | ||
| + | |- | ||
| + | | errors || object || Empty object when the request succeeds. | ||
| + | |- | ||
| + | | code || integer || HTTP-style status value; <code>200</code> on success. | ||
| + | |} | ||
| + | |||
| + | Example response: | ||
| + | <pre> | ||
| + | { | ||
| + | "results": { | ||
| + | "id": 5001, | ||
| + | "created": "2024-06-15 14:30:00", | ||
| + | "contact_id": 789, | ||
| + | "contact": "John Doe", | ||
| + | "contact_phone_id": 1001, | ||
| + | "contact_phone": "5551234567", | ||
| + | "user_phone_id": 22, | ||
| + | "user_phone": "5559876543", | ||
| + | "phone_number": "5551234567", | ||
| + | "rep": { | ||
| + | "id": 123, | ||
| + | "email": "rep@example.com", | ||
| + | "user_id": 456, | ||
| + | "name": "Jane Smith", | ||
| + | "title": "Account Executive", | ||
| + | "updated": "2024-06-01 10:00:00" | ||
| + | }, | ||
| + | "call_type": "outgoing", | ||
| + | "duration": 185, | ||
| + | "new_call": 1 | ||
| + | }, | ||
| + | "errors": {}, | ||
| + | "code": 200 | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | === Notes === | ||
| + | * <code>number</code>, <code>start_datetime</code>, and <code>call_type</code> are required. | ||
| + | * Phone numbers are normalized to digits. An 11-digit number starting with <code>1</code> is treated as a U.S./Canada number and reduced to 10 digits. | ||
| + | * A value of <code>0000000000</code> is treated as invalid. | ||
| + | * For outgoing calls with a 7-digit number, the authenticated user’s area code may be prepended automatically. | ||
| + | * If a call already exists for the same user, phone number, call type, and start time, a new record is not created. If the duration differs, the existing call’s duration is updated and <code>new_call</code> is set to <code>0</code>. | ||
| + | * Field-level validation failures typically return HTTP <code>200</code> with details in the <code>errors</code> object and an empty <code>results</code> value. | ||
| + | * Invalid JSON in the request body returns HTTP <code>400</code>. | ||
| + | |||
| + | === Error Responses === | ||
| + | {| class="wikitable" | ||
| + | ! Status Code !! Meaning | ||
| + | |- | ||
| + | | 200 || Validation issue – The phone number, start time, or call type is missing or invalid. | ||
| + | |- | ||
| + | | 400 || Bad Request – The JSON payload is invalid or required call data is missing. | ||
| + | |- | ||
| + | | 401 || Unauthorized – The API key and/or secret is missing, invalid, inactive, associated with a disabled account, or lacks permission to create calls. | ||
| + | |- | ||
| + | | 405 || Method Not Allowed – A method other than POST was used. | ||
| + | |- | ||
| + | | 500 || Internal Server Error – An unexpected server problem occurred. Not specified in Swagger. | ||
| + | |} | ||
| + | |||
| + | '''400 response body example:''' | ||
| + | <pre> | ||
| + | { | ||
| + | "results": [], | ||
| + | "errors": ["Invalid json data"], | ||
| + | "code": 400 | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | '''200 validation response example:''' | ||
| + | <pre> | ||
| + | { | ||
| + | "results": [], | ||
| + | "errors": { | ||
| + | "number": "Valid number required", | ||
| + | "start_time": "Valid Start time required", | ||
| + | "call_type": "Valid call type required" | ||
| + | }, | ||
| + | "code": 200 | ||
| + | } | ||
| + | </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 13:00, 17 July 2026
Contents
API » Create Call
Base URL
Endpoint
/api/call/create/
Purpose
Creates a new call record for the authenticated API user in your CallProof company. If a matching call already exists for the same user, phone number, call type, and start time, the existing record’s duration may be updated instead of creating a duplicate.
HTTP Method
POST
Headers
| Header | Required | Description |
|---|---|---|
| Content-Type | Yes | Must be application/json.
|
Security
- Yes – Requires a valid API key and secret with permission to create calls. Credentials are sent in the request body.
Parameters
Path Parameters
None.
Query Parameters
None.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| api_key | object | Yes | Authentication credentials object. |
| api_key.key | string | Yes | Public API key assigned to your CallProof account. |
| api_key.secret | string | Yes | Private API secret paired with the API key. |
| call_data | object | Yes | Call creation payload. |
| call_data.number | string | Yes | Phone number for the call. Digits only after normalization. Must not be empty or all zeros. |
| call_data.start_datetime | datetime string | Yes | Date and time the call started. |
| call_data.call_type | string | Yes | Call type name (for example, outgoing or incoming). Must match a recognized call type.
|
| call_data.duration | integer | No | Call duration in seconds. Defaults to 0 if omitted or invalid.
|
| call_data.local_id | integer | No | Optional local/device identifier for the call. Defaults to 0 if omitted or invalid.
|
cURL Example
curl -X POST "https://app.callproof.com/api/call/create/" \
-H "Content-Type: application/json" \
-d '{
"api_key": {
"key": "YOUR_API_KEY",
"secret": "YOUR_API_SECRET"
},
"call_data": {
"number": "5551234567",
"start_datetime": "2024-06-15 14:30:00",
"call_type": "outgoing",
"duration": 185,
"local_id": 1
}
}'
Successful Response (200)
Indicates the call was created or an existing matching call was updated. The response returns the call details plus a new_call indicator.
| Field | Type | Description |
|---|---|---|
| results | object | Saved call details. |
| results.id | integer | Unique identifier for the call. |
| results.created | string | Date and time the call started (YYYY-MM-DD HH:MM:SS).
|
| results.contact_id | integer | Associated contact identifier, when available. |
| results.contact | string | Contact display name, when available. |
| results.contact_phone_id | integer | Associated contact phone identifier, when available. |
| results.contact_phone | string | Contact phone number used for the call, when available. |
| results.user_phone_id | integer | Identifier of the user phone used for the call, when available. |
| results.user_phone | string | User phone number used for the call, when available. |
| results.phone_number | string | Phone number recorded for the call. |
| results.rep | object | Sales representative associated with the call. |
| results.call_type | string | Call type name. |
| results.duration | integer | Call duration in seconds. |
| results.new_call | integer | 1 if a new call was created; 0 if an existing matching call was updated.
|
| errors | object | Empty object when the request succeeds. |
| code | integer | HTTP-style status value; 200 on success.
|
Example response:
{
"results": {
"id": 5001,
"created": "2024-06-15 14:30:00",
"contact_id": 789,
"contact": "John Doe",
"contact_phone_id": 1001,
"contact_phone": "5551234567",
"user_phone_id": 22,
"user_phone": "5559876543",
"phone_number": "5551234567",
"rep": {
"id": 123,
"email": "rep@example.com",
"user_id": 456,
"name": "Jane Smith",
"title": "Account Executive",
"updated": "2024-06-01 10:00:00"
},
"call_type": "outgoing",
"duration": 185,
"new_call": 1
},
"errors": {},
"code": 200
}
Notes
number,start_datetime, andcall_typeare required.- Phone numbers are normalized to digits. An 11-digit number starting with
1is treated as a U.S./Canada number and reduced to 10 digits. - A value of
0000000000is treated as invalid. - For outgoing calls with a 7-digit number, the authenticated user’s area code may be prepended automatically.
- If a call already exists for the same user, phone number, call type, and start time, a new record is not created. If the duration differs, the existing call’s duration is updated and
new_callis set to0. - Field-level validation failures typically return HTTP
200with details in theerrorsobject and an emptyresultsvalue. - Invalid JSON in the request body returns HTTP
400.
Error Responses
| Status Code | Meaning |
|---|---|
| 200 | Validation issue – The phone number, start time, or call type is missing or invalid. |
| 400 | Bad Request – The JSON payload is invalid or required call data is missing. |
| 401 | Unauthorized – The API key and/or secret is missing, invalid, inactive, associated with a disabled account, or lacks permission to create calls. |
| 405 | Method Not Allowed – A method other than POST was used. |
| 500 | Internal Server Error – An unexpected server problem occurred. Not specified in Swagger. |
400 response body example:
{
"results": [],
"errors": ["Invalid json data"],
"code": 400
}
200 validation response example:
{
"results": [],
"errors": {
"number": "Valid number required",
"start_time": "Valid Start time required",
"call_type": "Valid call type required"
},
"code": 200
}
401 response body example:
{
"results": [],
"errors": ["Invalid API Key"],
"code": 401
}
405 response body example:
{
"results": [],
"errors": ["Method not allowed"],
"code": 405
}