Clients

As the name suggests, clients are our primary model. You'll find how to create clients using the information you obtained from the configurations endpoint.

The client model

The client model has all the relevant client information, such as the id and name. It also contains the valid actions you can take on a client, like view and create.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the client.

  • Name
    name
    Type
    string
    Description

    The name of the client.


get/api/v1/clients

Client list

This endpoint returns the list of clients.

Query Parameters

  • Name
    page
    Type
    number
    Description

    The page number.

  • Name
    per_page
    Type
    number
    Description

    The number of items per page.

  • Name
    q
    Type
    object
    Description

    Search parameters using Ransack syntax.

Request

GET
/api/v1/clients
curl --location --request GET 'https://app.collateralxp.com/api/v1/clients?page=1&per_page=10' \
  --header 'X-API-KEY: {api_key}' \
  --header 'Accept: application/json'

Response

[
  {
      "id": "2b619884-2e18-485c-96ec-42d2ac3648f4",
      "name": "Local Bank - Mortgage"
  }
]

get/api/v1/client_types

Client type list

This endpoint returns the list of client types.

Query Parameters

  • Name
    page
    Type
    number
    Description

    The page number.

  • Name
    per_page
    Type
    number
    Description

    The number of items per page.

  • Name
    q
    Type
    object
    Description

    Search parameters using Ransack syntax.

Request

GET
/api/v1/client_types
curl --location --request GET 'https://app.collateralxp.com/api/v1/client_types?page=1&per_page=10' \
  --header 'X-API-KEY: {api_key}' \
  --header 'Accept: application/json'

Response

[
  {
    "id": "787200d6-940f-450e-bbcf-11dd32f5f415",
    "name": "Attorney"
  },
  {
      "id": "1b61834e-8c70-4b7b-b93f-1ec02af5bd23",
      "name": "Bank"
  },
  {
      "id": "f9b899aa-5cbb-4f3d-a05d-9ffa2d18beb5",
      "name": "Branch"
  }
]

post/api/v1/clients

Create a client

This endpoint will create a client.

Attributes

  • Name
    name
    Type
    string required
    Description

    The name of the client.

  • Name
    client_type_id
    Type
    string required
    Description

    The client type ID.

  • Name
    add_all_products
    Type
    boolean required
    Description

    Whether to add all products.

  • Name
    address_attributes
    Type
    object required
    Description

    The property address.

    Show child attributes
  • Name
    contacts_attributes
    Type
    object required
    Description

    The contact information.

    Show child attributes

Request

POST
/api/v1/clients
curl --location 'https://app.collateralxp.com/api/v1/clients' \
  --header 'Accept: application/json' \
  --header 'X-API-KEY: {api_key}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "organization": {
          "name": "New client API",
          "client_type_id": "1b61834e-8c70-4b7b-b93f-1ec04af5bd23",
          "add_all_products": false,
          "address_attributes": {
              "address_one": "6103 W Montrose Ave",
              "address_two": "",
              "city": "Chicago",
              "state": "IL",
              "zip": "61634"
          },
          "contacts_attributes": [{
              "name": "John Doe",
              "emails": ["email@mail.com"],
              "phones_attributes": [
                  { "phone_number": "(123) 123-1234", "phone_type": "cellphone" }
              ]
          }]
      }
  }'

Response

{
    "success": true,
    "client": {
        "id": "1186a441-beee-4fea-88d7-35f55424e3ea",
        "name": "New client API"
    }
}