DOCS

Last updated: 3:11 PM - December 8, 2024

Customers

This object represents a customer of your business. Your customers are people who have either claimed a wallet pass from your account or have been integrated and implemented from one of your connected integrations.

ENDPOINTS
  • POST /v1/customers/create
  • GET /v1/customers
  • GET /v1/customers/:id
  • PATCH /v1/customers/:id
  • DELETE /v1/customers/:id

The Customers object

Attributes

id string

Unique identifier for the object (MongoDB ObjectID).

email string

Customer's email address.

fname string

Customer's first name.

lname string

Customer's last name.

apn_push_token string

Apple Push Notification (APN) token for the customer.

pass_holder string

Indicates if the customer holds a pass (can be a specific identifier or boolean).

creatorID string

The ID of the creator of this customer (likely another user or admin).

total_spent integer

The total amount the customer has spent.

status string

The status of the customer (e.g., active, inactive).

metadata map

Additional metadata associated with the customer. Can contain key-value pairs for storing extra information.

created int64

Timestamp when the customer object was created (Unix timestamp).

updated_at int64

Timestamp of the last update to the customer object (Unix timestamp).

v integer

Version number of the customer object, typically used for concurrency control.

The Customers object
                    {
  "id": "670e8c20f5cc66995a0114d7",
  "email": "sipari9019@craftapk.com",
  "fname": "",
  "lname": "",
  "apn_push_token": "",
  "pass_holder": "",
  "creatorID": "670e8206f5cc66995a0114d5",
  "total_spent": 0,
  "status": "active",
  "metadata": {
  },
  "created": 1729006624,
  "updated_at": 1729006624,
  "v": 1,
}
                

Create a Customer

This endpoint initializes a customer object

Required Parameters

email string

Customer's email address.

Optional Parameters

status string

The status of the customer, e.g., new, active, inactive.

metadata map

A set of key-value pairs associated with the customer.

fname string

Customer's first name.

lname string

Customer's last name.

apn_push_token string

Apple Push Notification (APN) token for the customer.

pass_holder string

Indicates whether the customer holds a pass.

total_spent integer

Total amount the customer has spent.

created int64

Unix timestamp when the customer record was created.

updated_at int64

Unix timestamp when the customer record was last updated.

v integer

Version number of the customer record.

POST /v1/customers
curl --location 'https://api.gowithpush.com/v1/customers/create'   
-H 'Content-Type: application/json'   
-H 'X-API-Key: <YOUR-API-KEY>'   
-d '{
      "email": "vacir36811@avashost.com",
      "status": "new",
      "metadata": {}
  }'

RESPONSE

{
    "customer": {
        "id": "67196766522eb67a9154e473",
        "email": "vicor@mac.com",
        "fname": "",
        "lname": "",
        "apn_push_token": "",
        "pass_holder": "",
        "creatorID": "662eacdd93c3237c5873dc20",
        "total_spent": 0,
        "status": "active",
        "metadata": {},
        "created": 1729718118,
        "updated_at": 1729718118,
        "v": 1
    },
    "message": "Customer created successfully",
    "status": "success"
}

Retrieve a Customer by ID

This endpoint retrieves a specific customer object by its ID.

Required Parameters

id string

The unique identifier of the customer to retrieve.

X-API-Key string

API Key for authenticating the request.

Optional Parameters

GET /v1/customers/{id}
curl --location 'https://api.gowithpush.com/v1/customers/66cd471f5efb4a24dd3456f2'   
-H 'X-API-Key: <YOUR-API-KEY>'

RESPONSE

{
  "status": "success",
  "customer": {
      "id": "66cd471f5efb4a24dd3456f2",
      "email": "vacir36811@avashost.com",
      "fname": "",
      "lname": "",
      "apn_push_token": "",
      "pass_holder": "",
      "creatorID": "662eacdd93c3237c5873dc20",
      "total_spent": 0,
      "status": "active",
      "metadata": {},
      "created": 1724729119,
      "updated_at": 1724729119,
      "v": 1
  }
}

List Customers

This endpoint retrieves a paginated list of customer objects.

Required Parameters

page integer

The page number of the paginated results.

per_page integer

The number of results per page.

X-API-Key string

API Key for authenticating the request.

Optional Parameters

GET /v1/customers
curl --location 'https://api.gowithpush.com/v1/customers?page=1&per_page=2'   
-H 'X-API-Key: <YOUR-API-KEY>'

RESPONSE

{
  "status": "success",
  "customers": [
      {
          "id": "670e8c20f5cc66995a0114d7",
          "email": "sipari9019@craftapk.com",
          "fname": "",
          "lname": "",
          "apn_push_token": "",
          "pass_holder": "",
          "creatorID": "670e8206f5cc66995a0114d5",
          "total_spent": 0,
          "status": "active",
          "metadata": {},
          "created": 1729006624,
          "updated_at": 1729006624,
          "v": 1
      },
      {
          "id": "670e8c20f5cc66995a0114d8",
          "email": "vacir36811@avashost.com",
          "fname": "John",
          "lname": "Doe",
          "apn_push_token": "some_token",
          "pass_holder": "yes",
          "creatorID": "670e8206f5cc66995a0114d5",
          "total_spent": 100,
          "status": "inactive",
          "metadata": {},
          "created": 1729006625,
          "updated_at": 1729006625,
          "v": 1
      }
  ],
  "page": 1,
  "per_page": 2,
  "total": 2
}

Update Customer

This endpoint updates a customer's details by their unique ID.

Required Parameters

id string

The unique ID of the customer to be updated.

userID string

The ID of the user making the update request.

X-API-Key string

API Key for authenticating the request.

Optional Parameters

email string

The email address of the customer.

fname string

The first name of the customer.

lname string

The last name of the customer.

status string

The status of the customer (e.g., active, inactive).

metadata object

A set of key-value pairs associated with the customer.

PATCH /2024-10/customers/:id
curl -L -X PATCH 'https://api.gowithpush.com/2024-10/customers/66cd471f5efb4a24dd3456f2'  
  
-H 'userID: 66abe34930ac8b1edfd40a96'  
  
-H 'Content-Type: application/json'  
  
-H 'X-API-Key: <YOUR-API-KEY>'  
  
--data-raw '{
      "email": "vacir36811@avashost.com",
      "fname": "Hello",
      "lname": "There",
      "status": "active",
      "metadata": {}
  }'

RESPONSE

{
    "customer": {
        "id": "66cd471f5efb4a24dd3456f2",
        "email": "vacir36811@avashost.com",
        "fname": "Hello",
        "lname": "There",
        "apn_push_token": "",
        "pass_holder": "",
        "creatorID": "662eacdd93c3237c5873dc20",
        "total_spent": 0,
        "status": "active",
        "metadata": {},
        "created": 1724729119,
        "updated_at": 1729717316,
        "v": 1
    },
    "status": "success"
  }

Delete Customer

This endpoint deletes a customer by their unique ID.

Required Parameters

id string

The unique ID of the customer to be deleted.

X-API-Key string

API Key for authenticating the request.

Optional Parameters

DELETE /2024-10/customers/:id
curl -L -X DELETE 'https://api.gowithpush.com/2024-10/customers/67196766522eb67a9154e473'   
-H 'X-API-Key: <YOUR-API-KEY>'

RESPONSE

{
    "id": "67196766522eb67a9154e473",
    "isDeleted": false,
    "message": "Customer not found",
    "status": "error"
  }