HydraCore
API by router

Customers

List Customers

List all end-customers for the current tenant.

Admin-only. Supports pagination, search by email and sorting. RLS ensures only the current tenant's customers are visible.

"Round up the usual suspects." - Captain Renault, Casablanca

GET
/v1/customers
AuthorizationBearer <token>

In: header

Query Parameters

page?Page

Page number

Default1
Range1 <= value
per_page?Per Page

Items per page

Default20
Range1 <= value <= 100
search?Search

Search by email

Default""
sort_by?Sort By

Sort field

Default"created_at"
sort_dir?Sort Dir

Sort direction: asc or desc

Default"desc"

Header Parameters

X-Api-Key?X-Api-Key

Response Body

curl -X GET "https://loading/v1/customers?page=1&per_page=20&search=&sort_by=created_at&sort_dir=desc" \  -H "X-Api-Key: string"
{
  "customers": [
    {
      "active_subscription_count": 0,
      "company_name": "string",
      "country_code": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "currency": "string",
      "email": "string",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "instance_count": 0,
      "latest_subscription_status": "string",
      "running_instance_count": 0,
      "subscription_count": 0,
      "timezone": "string"
    }
  ],
  "page": 0,
  "per_page": 0,
  "total": 0,
  "total_pages": 0
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Create Customer

Create a new end-customer for the current tenant.

Admin-only. This is how tenants (e.g. CrewAmp) onboard their customers (e.g. IQM, Steve) programmatically or via the dashboard.

Duplicate email within the same tenant is rejected.

POST
/v1/customers
AuthorizationBearer <token>

In: header

Header Parameters

X-Api-Key?X-Api-Key
company_name?Company Name
country_code?Country Code
currency?Currency
email?Email
industry?Industry
locale?Locale
timezone?Timezone

Response Body

curl -X POST "https://loading/v1/customers" \  -H "X-Api-Key: string" \  -H "Content-Type: application/json" \  -d '{}'
{
  "company_name": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "email": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Get Customer

Get detailed info for a single customer.

"You're gonna need a bigger boat." - Chief Brody, Jaws (what you say when a customer's instance count keeps growing)

GET
/v1/customers/{customer_id}
AuthorizationBearer <token>

In: header

Path Parameters

customer_idCustomer Id
Formatuuid

Header Parameters

X-Api-Key?X-Api-Key

Response Body

curl -X GET "https://loading/v1/customers/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "X-Api-Key: string"
{
  "active_subscription_count": 0,
  "company_name": "string",
  "country_code": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "currency": "string",
  "email": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "instance_count": 0,
  "instances": [],
  "latest_subscription_status": "string",
  "locale": "string",
  "running_instance_count": 0,
  "stripe_customer_id": "string",
  "subscription_count": 0,
  "subscriptions": [],
  "timezone": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Clone Customer Setup

Clone a customer's rules to a new customer. 'Set up like Steve but for this new plumber.'

POST
/v1/customers/{customer_id}/clone
AuthorizationBearer <token>

In: header

Path Parameters

customer_idCustomer Id
Formatuuid

Header Parameters

X-Api-Key?X-Api-Key
clone_rules?Clone Rules
Defaulttrue
company_nameCompany Name
Lengthlength <= 200
email?Email
source_customer_idSource Customer Id
Formatuuid

Response Body

curl -X POST "https://loading/v1/customers/497f6eca-6276-4993-bfeb-53cbbbba6f08/clone" \  -H "X-Api-Key: string" \  -H "Content-Type: application/json" \  -d '{    "company_name": "string",    "source_customer_id": "22f9e5e1-5129-4cc7-9d8d-1248b092e05b"  }'
{
  "company_name": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "email": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}