Create a customer
POST
/{currentTeam}/customers
const url = 'https://api.tradeops.cc/v1/example/customers';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","number":"example","type":"example","channel":"example","region":"example","territory":"example","address":"example","city":"example","parish":"example","latitude":1,"longitude":1,"contact_name":"example","contact_phone":"example","contact_email":"hello@example.com","metadata":"example","is_active":true,"locations":[{"id":1,"name":"example","address":"example","city":"example","state_province":"example","latitude":1,"longitude":1,"contact_name":"example","contact_phone":"example","contact_email":"hello@example.com","is_primary":true,"is_active":true}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.tradeops.cc/v1/example/customers \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "number": "example", "type": "example", "channel": "example", "region": "example", "territory": "example", "address": "example", "city": "example", "parish": "example", "latitude": 1, "longitude": 1, "contact_name": "example", "contact_phone": "example", "contact_email": "hello@example.com", "metadata": "example", "is_active": true, "locations": [ { "id": 1, "name": "example", "address": "example", "city": "example", "state_province": "example", "latitude": 1, "longitude": 1, "contact_name": "example", "contact_phone": "example", "contact_email": "hello@example.com", "is_primary": true, "is_active": true } ] }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”currentTeam
required
string
The current team slug
Query Parameters
Section titled “Query Parameters”include
Array<string>
fields[customers]
Array<string>
fields[customer_locations]
Array<string>
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
StoreCustomerRequest
object
name
required
string
number
string | null
type
string | null
channel
string | null
region
string | null
territory
string | null
address
string | null
city
string | null
parish
string | null
latitude
number | null
longitude
number | null
contact_name
string | null
contact_phone
string | null
contact_email
string | null format: email
metadata
Custom attributes keyed by attribute name.
object | null
is_active
boolean
locations
Array<object>
object
id
integer | null
name
string
address
string | null
city
string | null
state_province
string | null
latitude
number | null
longitude
number | null
contact_name
string | null
contact_phone
string | null
contact_email
string | null format: email
is_primary
boolean
is_active
boolean
Example generated
{ "name": "example", "number": "example", "type": "example", "channel": "example", "region": "example", "territory": "example", "address": "example", "city": "example", "parish": "example", "latitude": 1, "longitude": 1, "contact_name": "example", "contact_phone": "example", "contact_email": "hello@example.com", "metadata": "example", "is_active": true, "locations": [ { "id": 1, "name": "example", "address": "example", "city": "example", "state_province": "example", "latitude": 1, "longitude": 1, "contact_name": "example", "contact_phone": "example", "contact_email": "hello@example.com", "is_primary": true, "is_active": true } ]}Responses
Section titled “Responses”CustomerResource
Media typeapplication/vnd.api+json
object
data
required
CustomerResource
object
id
required
string
type
required
string
attributes
object
name
string
slug
string
number
string | null
type
string | null
channel
string | null
region
string | null
territory
string | null
address
string | null
city
string | null
parish
string | null
latitude
string | null
longitude
string | null
contact_name
string | null
contact_phone
string | null
contact_email
string | null
metadata
object
is_active
boolean
created_at
string | null format: date-time
updated_at
string | null format: date-time
relationships
object
locations
object
data
required
Array<object>
object
id
required
string
type
required
string
links
required
object
self
required
string
included
Array<object>
CustomerLocationResourceobject
id
required
string
type
required
string
attributes
object
name
string | null
address
string | null
city
string | null
state_province
string | null
latitude
string | null
longitude
string | null
contact_name
string | null
contact_phone
string | null
contact_email
string | null
is_primary
boolean
is_active
boolean
created_at
string | null format: date-time
updated_at
string | null format: date-time
Example
{ "data": { "type": "customers", "relationships": { "locations": { "data": [ { "type": "customer_locations" } ] } } }, "included": [ { "type": "customer_locations" } ]}Unauthenticated
Media typeapplication/json
object
message
required
Error overview.
string
Example generated
{ "message": "example"}Authorization error
Media typeapplication/json
object
message
required
Error overview.
string
Example generated
{ "message": "example"}Not found
Media typeapplication/json
object
message
required
Error overview.
string
Example generated
{ "message": "example"}Validation error
Media typeapplication/json
object
message
required
Errors overview.
string
errors
required
A detailed description of each field that failed validation.
object
key
additional properties
Array<string>
Example generated
{ "message": "example", "errors": { "additionalProperty": [ "example" ] }}Too many requests. Wait for Retry-After seconds before trying again.
Media typeapplication/json
object
message
required
string
Example generated
{ "message": "example"}Headers
Section titled “Headers”Retry-After
integer
Seconds until you can try again.