API
API Reference
Customer
Customer upload

Customer upload

Import customer data into Customerscore via the Customers API endpoint.

For interactive API documentation, see the Swagger reference (opens in a new tab).

Endpoint

MethodURL
POSThttps://api.customerscore.io/api/v1/customers

Request Body

The customers field is mandatory in the JSON body. Each customer object within the customers array must include the following attributes:

FieldTypeRequiredDescription
external_idstringYesIdentifier for the customer, max 255 characters
namestringYesName of the customer, max 255 characters
owner_emailstringNoOwner's email address, max 255 characters
attributesobjectNoCustomer attributes object
metricsarrayNoArray of metric objects (up to 200 items)

Example Request

curl -X POST "https://api.customerscore.io/api/v1/customers" \
  -H "Content-Type: application/json" \
  -H "customerscore-key: your-generated-key" \
  -d '{
    "customers": [
      {
        "external_id": "12345",
        "name": "Knapp-Cruz Inc.",
        "owner_email": "owner@example.com",
        "attributes": {
          "crm_link": "https://your-crm.com/12345",
          "contact_email": "contact@example.com",
          "renewal_date": "2025-05-25"
        },
        "metrics": [
          {
            "date": "2024-04-29",
            "resolved_tickets": 39
          }
        ]
      }
    ]
  }'

Full Request Body Example

{
  "customers": [
    {
      "external_id": "12345",
      "name": "Knapp-Cruz Inc.",
      "owner_email": "owner@example.com",
      "attributes": {
        "crm_link": "https://example.com",
        "contact_email": "example@example.com",
        "renewal_date": "2024-05-25",
        "country_name": "Czech Republic",
        "customers_count": 99,
        "has_avatar": true
      },
      "metrics": [
        {
          "date": "2024-04-29",
          "country": "Czechia",
          "has_picture": true,
          "resolved_tickets": 39,
          "created_at": "2024-08-15"
        }
      ]
    }
  ]
}

Owner Email Field

If owner_email is provided, the customer will be automatically linked to the user in your account (if such a user exists).

Attributes Field

The attributes field is an object that contains useful information about a given customer. You can add:

  • System attributes: crm_link, contact_email, renewal_date
  • Custom attributes: Configured in the Customerscore.io application under Attributes (opens in a new tab)

Example Attributes Object

{
  "crm_link": "https://your-crm-link.com/12345",
  "contact_email": "example@example.com",
  "renewal_date": "2025-05-25",
  "country_name": "Czech Republic",
  "customers_count": 99,
  "has_avatar": true
}

Supported Value Types

TypeExample
String"abcd"
Number1234
Booleantrue or false
Date"2024-08-14"

Each key must precisely match the codename of the attribute configured in Customerscore. Keys are case-sensitive. Only matching keys will be stored and used for score calculation.

Metrics Field

The metrics field contains product-usage data that feeds into the health score calculation. It can hold up to 200 items.

FieldTypeRequiredDescription
datestringYesDate for the metric, must be unique in the array

Example Metrics Array

[
  {
    "date": "2024-04-29",
    "country": "Czechia",
    "has_picture": true,
    "resolved_tickets": 39,
    "created_at": "2024-08-15"
  }
]

Each key must precisely match the codename of the metric configured in Metrics (opens in a new tab). Keys are case-sensitive.

Processing

Upon successful data import, internal processing will occur, including a scoring process that may take up to 30 minutes. After processing is complete, all users in the account will receive a notification regarding the newly imported customer data.

Response Codes

CodeDescription
200Customer data has been successfully received and forwarded for processing
400Bad request
401Unauthorized - Missing customerscore-key in the header
403Forbidden - Invalid key
405Method Not Allowed - Only POST method is allowed
406Not Acceptable
429Too Many Requests
490Unconfigured scoring