# Customers

Customers represent Debtors. You can attach one or more Debt Accounts to the Customer. Creating Customers allows them to login to the Portal and pay off Debt.

# Create Customer

POST https://<org-uuid>.production.tratta.io/api/v1/customers

curl https://<org-uuid>.production.tratta.io/api/v1/customers \
 -H "Authorization: Bearer eyJ0eXA3asdk..." \
 -d name="Customer Name" \
 -d email="test@email.com"

# Parameters


name required|string

Name of the customer. For example, first name and last name or company name.

email string|email

Email of the customer.

external_id optional|string

External id of customer in the 3rd party application.

phone optional|string|US

US Phone number of customer.

date_of_birth optional|date

Date of birth of customer in the format 1991-12-31

ssn_last4 optional|number

last 4 digits of customer Social security number

address optional

  • name optional|string
  • line1 optional|string
  • line2 optional|string
  • city optional|string
  • postal_code optional|string
  • state optional|string
  • country optional|string
  • is_primary optional|boolean

metadata optional|key:max:255|value:max:255

Json object of key value pairs for meta data you may want to attach to customer object.

# Returns


A json with data property that contains created customer object.

{
  "id": "string",
  "external_id": "string",
  "name": "string",
  "email": "string",
  "phone": "string",
  "dob": "date",
  "ssn": "string",
  "address": [{
    "name": "string",
    "city" : "string",
    "postal_code" : "string",
    "country" : "string",
    "line1" : "string",
    "line2" : "string",
    "state" : "string",
    "is_primary": "boolean"
  }],
  "metadata": [{
    "attribute": "key",
    "value": "value"
  }, {
    "attribute": "key1",
    "value": "value"
  }]
}

# Update Customer

PUT https://<org-uuid>.production.tratta.io/api/v1/customers/{id|external_id}

curl https://<org-uuid>.production.tratta.io/api/v1/customers/{id|external_id} \
 -H "Authorization: Bearer eyJ0eXA3asdk..." \
 -d name="Updated Customer Name" \
 -X PUT

# Parameters


name string

Name of the customer. For example, first name and last name or company name.

email string|email

Email of the customer.

external_id string

External id of customer in the 3rd party application.

phone string|US

US Phone number of customer.

date_of_birth optional|date

Date of birth of customer in the format 1991-12-31

ssn_last4 optional|number

last 4 digits of customer Social security number

address object

  • id optional|string
  • name string
  • line1 string
  • line2 string
  • city string
  • postal_code required (only when id doesnt exist)|string
  • state string
  • country string
  • is_primary optional|boolean

metadata optional|key:max:255|value:max:255

Key value pairs can be updated, when you PUT to the key a different value. When you PUT an empty value to existing key, it will be deleted. When you put and empty value to whole metadata, all of the metadata associated with customer object will be deleted.

# Get Customer

GET https://<org-uuid>.production.tratta.io/api/v1/customers/{id|external_id}

curl https://<org-uuid>.production.tratta.io/api/v1/customers/{id|external_id} \
 -H "Authorization: Bearer eyJ0eXA3asdk..."

# Parameters


id required_if:external_id missing|string

Uuid of customer provided from Tratta when Creating Customer object. This url parameter is required only if the external_id wasn't provided instead.

external_id required_if:id missing|string

External id of customer provided by you through external_id parameter when Creating Customer object. This url parameter is required only if the id wasn't provided instead.

# Returns


A json with data property that contains created customer object.

{
  "id": "string",
  "external_id": "string",
  "name": "string",
  "email": "string",
  "phone": "string",
  "dob": "date",
  "ssn": "string",
  "addresses": [
    {
      "name": "string",
      "city": "string",
      "postal_code": "string",
      "country": "string",
      "line1": "string",
      "line2": "string",
      "state": "string",
      "is_primary": "boolean"
    }
  ],
  "metadata": [
    {
      "attribute": "key",
      "value": "value"
    },
    {
      "attribute": "key1",
      "value": "value"
    }
  ]
}

# List Customers

GET https://<org-uuid>.production.tratta.io/api/v1/customers

curl https://<org-uuid>.production.tratta.io/api/v1/customers \
 -H "Authorization: Bearer eyJ0eXA3asdk..."

# Returns


A json with data property that contains array of customer objects.

{
  "id": "string",
  "external_id": "string",
  "name": "string",
  "email": "string",
  "phone": "string",
  "dob": "date",
  "ssn": "string",
  "addresses": [
    {
      "name": "string",
      "city": "string",
      "postal_code": "string",
      "country": "string",
      "line1": "string",
      "line2": "string",
      "state": "string",
      "is_primary": "boolean"
    }
  ],
  "metadata": [
    {
      "attribute": "key",
      "value": "value"
    },
    {
      "attribute": "key1",
      "value": "value"
    }
  ]
}

# Delete Customer

DELETE https://<org-uuid>.production.tratta.io/api/v1/customers/{id/external_id}

curl https://<org-uuid>.production.tratta.io/api/v1/customers \
 -H "Authorization: Bearer eyJ0eXA3asdk..." \
 -X DELETE

# Returns


{
  "success": "boolean"
}

# Create Customer Address

GET https://<org-uuid>.production.tratta.io/api/v1/customers/{id/external_id}/addresses

curl https://<org-uuid>.production.tratta.io/api/v1/customers/{id/external_id}/addresses \
 -H "Authorization: Bearer eyJ0eXA3asdk..." \
 -d name="Updated Address Name" \
 -d is_primary=false \
 -X POST

# Parameters


name optional|string

country optional|string

city optional|string

state optional|string

postal_code required|string|5 digits

line1 optional|string

line2 optional|string

is_primary optional|string

is_primary determines if this the primary address of the customer. Defaults to false, but set to true when creating the first address for the customer. A customer can have only one primary address at any given time.

# Returns


{
    "id": "string",
    "name": "string",
    "city": "string",
    "postal_code": "string",
    "country": "string",
    "line1": "string",
    "line2": "string",
    "state": "string",
    "is_primary": "boolean"
}

# List Customer Addresses

GET https://<org-uuid>.production.tratta.io/api/v1/customers/{id/external_id}/addresses

curl https://<org-uuid>.production.tratta.io/api/v1/customers/{id/external_id}/addresses \
 -H "Authorization: Bearer eyJ0eXA3asdk..."

# Parameters


id required_if:external_id missing|string

Uuid of customer provided from Tratta when Creating Customer object. This url parameter is required only if the external_id wasn't provided instead.

# Returns


{
    "id": "string",
    "name": "string",
    "city": "string",
    "postal_code": "string",
    "country": "string",
    "line1": "string",
    "line2": "string",
    "state": "string",
    "is_primary": "boolean"
}

# Update Customer Address

PUT https://<org-uuid>.production.tratta.io/api/v1/customers/{id/external_id}/addresses/{addressId}

curl https://<org-uuid>.production.tratta.io/api/v1/customers/{id/external_id}/addresses/{addressId} \
 -H "Authorization: Bearer eyJ0eXA3asdk..." \
 -d name="Updated Address Name" \
 -d is_primary=true \
 -X PUT

# Parameters


id required_if:external_id missing|string

Uuid of customer provided from Tratta when Creating Customer object. This url parameter is required only if the external_id wasn't provided instead.

addressId required

uuid of address provided by Tratter when Creating Customer object

name optional|string

country optional|string

city optional|string

state optional|string

postal_code required|string|5 digits

line1 optional|string

line2 optional|string

is_primary optional|string

is_primary determines if this the primary address of the customer. Defaults to false, but set to true when creating the first address for the customer. A customer can have only one primary address at any given time.

# Returns


{
    "id": "string",
    "name": "string",
    "city": "string",
    "postal_code": "string",
    "country": "string",
    "line1": "string",
    "line2": "string",
    "state": "string",
    "is_primary": "boolean"
}

# Delete Customer Address

DELETE https://<org-uuid>.production.tratta.io/api/v1/customers/{id/external_id}/addresses/{addressId}

curl https://<org-uuid>.production.tratta.io/api/v1/customers/{id/external_id}/addresses/{addressId} \
 -H "Authorization: Bearer eyJ0eXA3asdk..." \
 -X DELETE

# Parameters


id required_if:external_id missing|string

Uuid of customer provided from Tratta when Creating Customer object. This url parameter is required only if the external_id wasn't provided instead.

addressId required

uuid of address provided by Tratter when Creating Customer object

# Returns


{
  "success": "boolean"
}