Difference between revisions of "API:Reps:Stats:HTML:Update"

From docs
Jump to: navigation, search
 
Line 1: Line 1:
 
== [[API]] » Update Rep Stats HTML ==
 
== [[API]] » Update Rep Stats HTML ==
 
== Update Rep Stats HTML ==
 
  
 
=== Base URL ===
 
=== Base URL ===

Latest revision as of 12:00, 17 July 2026

API » Update Rep Stats HTML

Base URL

https://app.callproof.com

Endpoint

/api/reps/stats/html/update/

Purpose

Creates or updates custom HTML statistics content for a specific sales representative. Use this endpoint to store or refresh the HTML content displayed for a rep's statistics in CallProof or related integrations. If a record already exists for the rep, it is updated; otherwise, a new record is created.

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 update rep statistics HTML. Authentication credentials are provided in the request body.

Parameters

Path Parameters

None.

Query Parameters

None.

Request Body

Parameter Type Required Description
api_key object Yes Authentication credentials.
api_key.key string Yes Public API key assigned to your CallProof account.
api_key.secret string Yes Private API secret associated with the API key.
rep object Yes Sales representative information.
rep.id integer Yes User ID of the sales representative whose HTML statistics should be created or updated.
rep.html string No HTML content to store for the sales representative. Leading and trailing whitespace is removed. Maximum length is 4,096 characters.

cURL Example

curl -X POST "https://app.callproof.com/api/reps/stats/html/update/" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": {
      "key": "YOUR_API_KEY",
      "secret": "YOUR_API_SECRET"
    },
    "rep": {
      "id": 456,
      "html": "<div>Calls today: 12</div>"
    }
  }'

Successful Response (200)

Returns the saved HTML statistics associated with the specified sales representative.

Field Type Description
results object Updated rep statistics record.
results.user_id integer User ID of the sales representative.
results.user string Sales representative's display name.
results.email string Sales representative's email address.
results.html string or null Stored HTML statistics content.
errors array Empty when the request succeeds.
code integer HTTP-style status code (200).

Example response:

{
  "results": {
    "user_id": 456,
    "user": "Jane Smith",
    "email": "rep@example.com",
    "html": "<div>Calls today: 12</div>"
  },
  "errors": [],
  "code": 200
}

Error Responses

Status Code Meaning
400 Bad Request – The rep ID is missing, invalid, or does not belong to your company.
401 Unauthorized – The API key or secret is missing, invalid, inactive, associated with a disabled account, or does not have permission to update rep statistics.
405 Method Not Allowed – A method other than POST was used.
500 Internal Server Error – An unexpected server error occurred.

400 response example:

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

401 response example:

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

405 response example:

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

Notes

  • If the sales representative already has stored HTML statistics, they are replaced with the new HTML provided.
  • If no statistics record exists for the sales representative, one is created automatically.
  • The rep.id must reference a valid sales representative belonging to the authenticated company.
  • The HTML content supports up to 4,096 characters.
  • Authentication is supplied in the JSON request body rather than HTTP headers.
  • This endpoint accepts only POST requests with a JSON payload.