Skip to main content

Customer

Base path: /api/data/customer

POST /api/data/customer

Find or create a customer record. If a customer with the given discordId already exists for the tenant, returns the existing record with status 200; otherwise creates a new one with status 201.

Auth: Session cookie required Tenant: Scoped via x-tenant-id header

Request Body

FieldTypeRequiredDescription
discordIdstringYesCustomer's Discord user ID
discordUsernamestringYesCustomer's Discord username
discordDisplayNamestringYesCustomer's Discord display name
sourceenumNoDISCORD (default), EMAIL, MANUAL
emailstringNoCustomer email address (must be valid email)
phonestringNoCustomer phone number
userIdstringNoAssociated platform user ID

Response (201 Created / 200 OK)

Returns the full customer record.

Errors

StatusCondition
400Validation error

GET /api/data/customer/:id

Retrieve a customer by ID.

Auth: Session cookie required Tenant: Scoped via x-tenant-id header

Response (200)

Returns the customer record.

Errors

StatusCondition
400Missing customer ID
404Customer not found

PATCH /api/data/customer/:id

Update a customer record.

Auth: Session cookie required Tenant: Scoped via x-tenant-id header

Request Body

All fields are optional:

FieldTypeRequiredDescription
discordUsernamestringNoUpdated Discord username
discordDisplayNamestringNoUpdated Discord display name
emailstringNoUpdated email (must be valid email)
phonestringNoUpdated phone number
notesstringNoFree-form notes
userIdstringNoAssociated platform user ID

Response (200)

Returns the updated customer record.

Errors

StatusCondition
400Missing customer ID or validation error

DELETE /api/data/customer/:id

Deactivate a customer (soft delete — sets isActive to false).

Auth: Session cookie required Tenant: Scoped via x-tenant-id header

Response (200)

Returns the deactivated customer record.

Errors

StatusCondition
400Missing customer ID

GET /api/data/customer

List all customers for the current tenant.

Auth: Session cookie required Tenant: Scoped via x-tenant-id header

Response (200)

Returns an array of customer records.

Errors

StatusCondition
500Internal server error

POST /api/data/customer/:id/address

Add an address to a customer.

Auth: Session cookie required Tenant: Scoped via x-tenant-id header

Request Body

FieldTypeRequiredDescription
addressIdstringYesUnique identifier for the address
namestringYesRecipient name
line1stringYesStreet address line 1
line2stringNoStreet address line 2
citystringYesCity
statestringYesState / province
postalCodestringYesZIP / postal code
countrystringYesCountry code (min 2 chars)
phonestringNoPhone number

Response (200)

Returns the updated customer record with the new address.

Errors

StatusCondition
400Validation error or operation failure

DELETE /api/data/customer/:id/address/:addressId

Remove an address from a customer.

Auth: Session cookie required Tenant: Scoped via x-tenant-id header

Response (200)

Returns the updated customer record.

Errors

StatusCondition
400Operation failure

PATCH /api/data/customer/:id/default-address

Set the default address for a customer.

Auth: Session cookie required Tenant: Scoped via x-tenant-id header

Request Body

FieldTypeRequiredDescription
addressIdstringYesID of the address to set as default

Response (200)

Returns the updated customer record.

Errors

StatusCondition
400Missing addressId or operation failure

POST /api/data/customer/:id/link

Link a customer to a platform user.

Auth: Session cookie required Tenant: Scoped via x-tenant-id header

Request Body

FieldTypeRequiredDescription
userIdstringYesPlatform user ID to link

Response (200)

Returns the updated customer record.

Errors

StatusCondition
400Missing userId or operation failure