Agency

On this page, we’ll dive into how as the agency you can manage your customers via the API.


POST/api/agency/v1/customers

Create Customer

This endpoint allows you to create customers via the API.

Required attributes

  • Name
    name
    Type
    string
    Description

    The name of the customer.

  • Name
    company
    Type
    string
    Description

    The company (organization) name.

  • Name
    email
    Type
    string
    Description

    The email of the customer. Will be the email used to login to the platform.

  • Name
    password
    Type
    string
    Description

    The password should be a minimum of 8 characters long.

  • Name
    custom_plan_id
    Type
    string
    Description

    The plan you would like the customer assigned to.

Stripe tax enabled (Required attributes)

Only required if you are using our built-in Stripe integration and have enabled Stripe Tax.

  • Name
    country
    Type
    string
    Description

    The country the customers business is registered in. Should ISO 3166-1 alpha-2 i.e. for United States of America it would be US.

  • Name
    postal_code
    Type
    string
    Description

    This is optional unless the country is US or CA.

Optional attributes

  • Name
    phone
    Type
    string
    Description

    The phone for the customer must be a valid phone number. Phone number in E.164 format e.g. +14275238194.

  • Name
    location_limit
    Type
    integer
    Description

    The number of locations the customer is allowed to create. The minimum limit is 1. If not specified the custom plans limit will be used.

  • Name
    member_limit
    Type
    integer
    Description

    The number of members the customer is allowed to add. When set to zero unlimited members can be added. If not specified the custom plans limit will be used.

  • Name
    send_invite
    Type
    boolean
    Description

    Send an invite email to the customer which will contain the login details.

Request

POST
/api/agency/v1/customers
curl https://your-whitelabel-domain.com/api/agency/v1/customers \
  -H "Authorization: Bearer {token}" \
  -d name="John Smith" \
  -d company="My Clinic" \
  -d email="[email protected]" \
  -d password="Password123456" \
  -d custom_plan_id="2"

Response

{
  "data": {
        "id": 1,
        "name": "John Smith",
        "email": "[email protected]",
        "phone": null,
        "language": "en",
        "trial_ends_at": null,
        "created_at": "2024-09-26T19:57:52.000000Z",
        "updated_at": "2024-09-26T19:57:52.000000Z",
        "custom_plan": {
            "id": 2,
            "name": "Pro"
        },
        "organizations": [
            {
                "id": 1,
                "name": "My Clinic"
            }
        ]
    }
}

PUT/api/agency/v1/customers/{customer}

Switch Customers Plan

This endpoint allows you to switch the customers custom plan.

Required attributes

  • Name
    custom_plan_id
    Type
    string
    Description

    The plan you would like the customer assigned to.

Request

PUT
/api/agency/v1/customers/{customer}
curl https://your-whitelabel-domain.com/api/agency/v1/customers/{customer} \
  -H "Authorization: Bearer {token}" \
  -d custom_plan_id="2"

Response

{
  "data": {
        "id": 1,
        "name": "John Smith",
        "email": "[email protected]",
        "phone": null,
        "language": "en",
        "trial_ends_at": null,
        "created_at": "2024-09-26T19:57:52.000000Z",
        "updated_at": "2024-09-26T19:57:52.000000Z",
        "custom_plan": {
            "id": 2,
            "name": "Pro"
        },
        "organizations": [
            {
                "id": 1,
                "name": "My Clinic"
            }
        ]
    }
}

PUT/api/agency/v1/customers/{customer}/location-limit

Update Location Limit

This endpoint allows you to update/override the customers location limit.

Required attributes

  • Name
    location_limit
    Type
    integer
    Description

    The number of locations the customer is allowed to create. The minimum limit is 1.

Request

PUT
/api/agency/v1/customers/{customer}/location-limit
curl https://your-whitelabel-domain.com/api/agency/v1/customers/{customer}/location-limit \
  -H "Authorization: Bearer {token}" \
  -d location_limit="2"

Response

{
  "message": "Location limit updated successfully."
}

PUT/api/agency/v1/customers/{customer}/member-limit

Update Member Limit

This endpoint allows you to update/override the customers member limit i.e. how many team members in total can be added.

Required attributes

  • Name
    member_limit
    Type
    integer
    Description

    The number of members the customer is allowed to add. When set to zero unlimited members can be added.

Request

PUT
/api/agency/v1/customers/{customer}/member-limit
curl https://your-whitelabel-domain.com/api/agency/v1/customers/{customer}/member-limit \
  -H "Authorization: Bearer {token}" \
  -d member_limit="2"

Response

{
  "message": "Member limit updated successfully."
}

POST/api/agency/v1/customers/{customer}/add-credits

Add Credits

This endpoint allows you to add credits to your customers account.

Required attributes

  • Name
    type
    Type
    string
    Description

    The type of credit you would like to add. Accepted values include: email, sms.

  • Name
    credits
    Type
    integer
    Description

    The amount of credits you would like to add. Minimum value is 1.

Optional attributes

  • Name
    expires_at
    Type
    date
    Description

    Provide an expiry date if you want the credits to expire. Format: Y-m-d

  • Name
    notes
    Type
    string
    Description

    Add a note to this transaction. This will be visible to the customer.

Request

POST
/api/agency/v1/customers/{customer}/add-credits
curl https://your-whitelabel-domain.com/api/agency/v1/customers/{customer}/add-credits \
  -H "Authorization: Bearer {token}" \
  -d type="email" \
  -d credits="1000" \

Response

{
  	"message": "Credits added successfully.",
    "balance": 250
}

PUT/api/agency/v1/customers/{customer}/pause

Pause Subscription

This endpoint allows you to pause the customers subscription. This action is only available when the custom plan is not linked to Stripe via the platform.

Request

PUT
/api/agency/v1/customers/{customer}/pause
curl https://your-whitelabel-domain.com/api/agency/v1/customers/{customer}/pause \
  -H "Authorization: Bearer {token}"

Response

{
  "message": "Subscription has been paused."
}

PUT/api/agency/v1/customers/{customer}/resume

Resume Subscription

This endpoint allows you to resume the customers subscription. This action is only available when the custom plan is not linked to Stripe via the platform.

Request

PUT
/api/agency/v1/customers/{customer}/resume
curl https://your-whitelabel-domain.com/api/agency/v1/customers/{customer}/resume \
  -H "Authorization: Bearer {token}"

Response

{
  "message": "Subscription has been resumed."
}

DELETE/api/agency/v1/customers/{customer}

Delete Customer

This endpoint allows you to delete the customer.

Request

DELETE
/api/agency/v1/customers/{customer}
curl https://your-whitelabel-domain.com/api/agency/v1/customers/{customer} \
  -H "Authorization: Bearer {token}"

Response

{
  "message": "Customer deleted successfully."
}

GET/api/agency/v1/customers

Get All Customers

This endpoint allows you to fetch all your customers via the API.

Optional attributes

  • Name
    search
    Type
    string
    Description

    Search for customers by name or email.

Request

GET
/api/agency/v1/customers
curl https://your-whitelabel-domain.com/api/agency/v1/customers \
  -H "Authorization: Bearer {token}" \

Response

{
  "data": [
    {
		"id": 2,
		"name": "John Smith",
		"email": "[email protected]",
		"phone": null,
		"language": "en",
		"trial_ends_at": "2023-08-24T16:57:57.000000Z",
		"created_at": "2023-07-25T16:57:57.000000Z",
		"updated_at": "2023-08-04T15:01:11.000000Z",
		"custom_plan": {
			"id": 2,
			"name": "Pro"
		},
		"organizations": [
			{
				"id": 2,
				"name": "My Clinic"
			}
		]
	},
  ],

  "links": {
        "first": "https:\/\/your-whitelabel-domain.com\/api\/agency\/v1\/customers?page=1",
        "last": null,
        "prev": null,
        "next": "https:\/\/your-whitelabel-domain.com\/api\/agency\/v1\/customers?page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "path": "https:\/\/your-whitelabel-domain.com\/api\/agency\/v1\/customers",
        "per_page": 10,
        "to": 10
    }
}

GET/api/agency/v1/custom-plans

Get All Custom Plans

This endpoint allows you to fetch all your custom plans via the API.

Request

GET
/api/agency/v1/custom-plans
curl https://your-whitelabel-domain.com/api/agency/v1/custom-plans \
  -H "Authorization: Bearer {token}" \

Response

{
  "data": [
	{
		"id": 1,
		"stripe_monthly_id": "",
		"stripe_yearly_id": "",
		"name": "Basic",
		"is_default": false,
		"is_hidden": false,
		"is_free": true,
		"updated_at": "2024-09-26T10:19:58.000000Z",
		"created_at": "2023-07-25T15:14:02.000000Z"
	},
}

GET/api/v1/me

Get Current User

This endpoint allows you to fetch the current authenticated user.

Request

GET
/api/v1/me
curl https://your-whitelabel-domain.com/api/v1/me \
  -H "Authorization: Bearer {token}" \

Response

{
    "id": 1,
    "name": "John Smith",
    "email": "[email protected]"
}