Customers

On this page, we'll dive into the different customer endpoints you can use to manage customers programmatically. We'll look at how to query, create, update, and delete customers. Customers are people that have made a Payment into a Pot, Customers can make one or more Payments into one or more Pots.

The customer model

The customer model contains all the information about your customers, such as their name and email address.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the customer.

  • Name
    first_name
    Type
    string
    Description

    The first name of the customer.

  • Name
    last_name
    Type
    string
    Description

    The last name of the customer

  • Name
    email
    Type
    string
    Description

    The email address of the customer.

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the customer was created.

  • Name
    metadata
    Type
    hash
    Description

    Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.


GET/v1/customers

List all customers

This endpoint allows you to retrieve a paginated list of all your customers. By default, a maximum of ten customers are shown per page.

Optional attributes

  • Name
    limit
    Type
    integer
    Description

    Limit the number of customers returned.

  • Name
    page
    Type
    integer
    Description

    The page you wish to fetch.

Request

GET
/v1/customers
curl -G https://api.collctiv.com/v1/customers \
  -H "Authorization: Bearer {token}" \
  -d limit=3

Response

{
  "has_more": false,
  "data": [
    {
      "id": "dee11d4e-63c6-4d90-983c-5c9f1e79e96c",
      "first_name": "Janice",
      "last_name": "Jones",
      "email": "janice.jones@example.com",
      "metadata": {},
      "created_at": 692233200
    },
    {
      "id": "3b241101-e2bb-4255-8caf-4136c566a962"
      // ...
    }
  ]
}

GET/v1/customers/:id

Retrieve a customer

This endpoint allows you to retrieve a customer by providing their id. Refer to the list at the top of this page to see which properties are included with customer objects.

Request

GET
/v1/customers/dee11d4e-63c6-4d90-983c-5c9f1e79e96c
curl https://api.collctiv.com/v1/customers/dee11d4e-63c6-4d90-983c-5c9f1e79e96c \
  -H "Authorization: Bearer {token}"

Response

{
    "id": "dee11d4e-63c6-4d90-983c-5c9f1e79e96c",
    "first_name": "Janice",
    "last_name": "Jones",
    "email": "janice.jones@example.com",
    "created_at": 692233200,
    "metadata":{}
}

POST/v1/customers/

Create a customer

This endpoint allows you to create a customer.

Required attributes

  • Name
    first_name
    Type
    string
    Description

    The first name of the customer.

  • Name
    last_name
    Type
    string
    Description

    The last name of the customer

  • Name
    email
    Type
    string
    Description

    The email address of the customer.

Optional attributes

  • Name
    metadata
    Type
    hash
    Description

    Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

Request

POST
/v1/customers/
curl -X POST https://api.collctiv.com/v1/customers \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{"first_name":"Janice", "last_name": "Jones", "email": "janice.jones@example.com"}'

Response

{
    "id": "dee11d4e-63c6-4d90-983c-5c9f1e79e96c",
    "first_name": "Janice",
    "last_name": "Jones",
    "email": "janice.jones@example.com",
    "created_at": 692233200,
    "metadata":{}
}

Was this page helpful?