Customers

The customers API endpoint is an essential feature within the Felloh API, designed to group customer data, empowering businesses to efficiently handle customer interactions. This endpoint serves as a central repository for customer-related information, enabling seamless integrations and enriching the overall customer experience.


Customer Model

Properties

  • Name
    id
    Type
    uuid
    Description

    The unique identifier of the customer entry.

  • Name
    customer_name
    Type
    string
    Description

    The name of the customer.

  • Name
    email
    Type
    string
    Description

    The email address of the customer.

  • Name
    address_1
    Type
    string
    Description

    The first line of the customer's address.

  • Name
    address_2
    Type
    string
    Description

    The second line of the customer's address.

  • Name
    city
    Type
    string
    Description

    The city of the customer.

  • Name
    county
    Type
    string
    Description

    The county of the customer address.

  • Name
    country
    Type
    string
    Description

    The ISO 3166-1 country code of the customer.

  • Name
    post_code
    Type
    string
    Description

    The postal code of the customer.

{
  "id": "cc15e9a7-21bf-4d55-b500-2a24c8e4ed1e",
  "customer_name": "Tom Jones",
  "email": "tom@felloh.org",
  "address_1": "The Old Rectory",
  "address_2": "Main Road",
  "city": "Belton",
  "county": "Lincolnshire",
  "country": "GB",
  "post_code": "NG32 2LW"
}

POST/agent/customers

Fetch All

This endpoint retrieves all customers. Customers are sorted by creation date, with the most recent customers coming first.

Parameters

  • Name
    organisationrequired
    Type
    string
    Description

    The organisation ID that you want to fetch customers for. You can find the organisation that you have access to by using the List all organisations method.

  • Name
    keyword
    Type
    string
    Description

    Customer name or email address that you want to filter by.

  • Name
    skip
    Type
    integer
    Description

    Pagination offset. See the pagination section for details.

  • Name
    take
    Type
    integer
    Description

    Number of records to return. Defaults to 25, maximum 25. See the pagination section for details.

  • Name
    show-child-organisations
    Type
    boolean
    Description

    Whether to also show customer for any of the requested organisation's child organisations.

Returns

Returns an array of customer summaries. Each item contains the customer's id, email, customer_name and created_at, the organisation it belongs to, and aggregates of the customer's completed transactions (count, amount, last_completed) and bookings (count, amount). Address fields are not returned by this endpoint.

Request

POST
/agent/customers
import axios from 'axios';

const response = await axios.post(
  'https://api.felloh.com/agent/customers',
  {
    organisation: 'X9876',
    keyword: 'james.dean@gmail.com',
    skip: 10,
    take: 20
  },
  {
    headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer <YOUR TOKEN HERE>` }
  }
);

Response

{
  "data": [
    {
      "id": "cc15e9a7-21bf-4d55-b500-2a24c8e4ed1e",
      "email": "tom@felloh.org",
      "customer_name": "Tom Jones",
      "created_at": "2024-01-28T10:57:32.456Z",
      "organisation": {
        "id": "X9876",
        "name": "Felloh"
      },
      "aggregates": {
        "transaction": {
          "count": 3,
          "amount": 125000,
          "last_completed": "2024-03-01T09:12:45.000Z"
        },
        "booking": {
          "count": 2,
          "amount": 250000
        }
      }
    }
  ],
  "errors": [],
  "meta": {
    "code": 200,
    "reason": "OK",
    "message": "The request was successful",
    "request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6",
    "count": 1
  }
}

PUT/agent/customers

Create One

This endpoint allows you to create a new customer. If a customer with the same email address already exists in the organisation, that customer is updated with the supplied details and its existing id is returned instead of creating a new record.

Parameters

  • Name
    organisationrequired
    Type
    string
    Description

    The organisation ID for which you want to create the customer.

  • Name
    customer_namerequired
    Type
    string
    Description

    The full name of the customer.

  • Name
    emailrequired
    Type
    string
    Description

    The customer's email address.

  • Name
    address_1required
    Type
    string
    Description

    The first line of the customer's address.

  • Name
    address_2
    Type
    string
    Description

    The second line of the customer's address.

  • Name
    cityrequired
    Type
    string
    Description

    The city where the customer resides.

  • Name
    countyrequired
    Type
    string
    Description

    The county where the customer's address is located.

  • Name
    country
    Type
    string
    Description

    The two-letter ISO 3166-1 alpha-2 country code, for example GB. Other formats (such as UK or full country names) are rejected.

  • Name
    post_coderequired
    Type
    string
    Description

    The postal code of the customer's address.

Returns

  • Name
    id
    Type
    uuid
    Description

    The ID of the customer that was created.

Request

PUT
/agent/customers
import axios from 'axios';

const response = await axios.put(
  'https://api.felloh.com/agent/customers',
  {
    organisation: 'X9876',
    customer_name: 'Tom Jones',
    email: 'tom@felloh.com',
    address_1: 'The Old Rectory',
    address_2: 'Main Road',
    city: 'Belton',
    county: 'Lincolnshire',
    country: 'GB',
    post_code: 'NG32 2LW'
  },
  {
    headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer <YOUR TOKEN HERE>` }
  }
);

Response

{
  "data": {
    "id": "226009ab-ffe9-4c80-922b-982e8e7849f8"
  },
  "errors": [],
  "meta": {
    "code": 200,
    "reason": "OK",
    "message": "The request was successful",
    "request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6"
  }
}