Customer Management Service

Download OpenAPI specification:Download

The Customer Management service allows you to manage customers in your system.

Key Features:

  • Upsert support that enables seamless updates and inserts.

Locations

Creating location

Creates a new location for the tenant. A location represents address information about a legal entity of the Company.


Required scopes

  • customermanagement.location_manage
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

Request Body schema: application/json
id
string [ 1 .. 66 ] characters ^[a-zA-Z0-9_-]$

Custom location identifier. If not provided, it is automatically generated.

name
string

The name of the location,

type
required
string

The type of the location.

Enum: "HEADQUARTER" "WAREHOUSE" "OFFICE"
required
object (Contact Details)
object (metadata_create)

Metadata request.

mixins
object

Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.

Responses
201

The request was successful. The location has been created.

400

Request was syntactically incorrect. Details will be provided in the response payload.

401

Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.

403

Given authorization scopes are not sufficient and do not match scopes required by the endpoint.

409

Given resource already exists

500

Internal Service Error occurred.

post/{tenant}/locations
Request samples
application/json
{
  • "name": "Main HQ",
  • "type": "HEADQUARTER",
  • "contactDetails": {
    }
}
Response samples
application/json
{
  • "id": "53ac81fd0cce8b26b36f1234"
}

Retrieving all locations

Retrieves all locations assigned to the tenant. You can filter, sort and paginate the results with query parameters.


Required scopes

  • customermanagement.location_read
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

query Parameters
pageNumber
integer >= 1
Default: 1

The page number to be retrieved where the size of the pages must be specified by the pageSize parameter. The number of the first page is 1.

pageSize
integer >= 1
Default: 16

The number of documents being retrieved on the page.

sort
string

Fields to sort the response data by following order of the parameters from left to right. Can contain multiple fields in format: field name:sort direction separated by a comma. The colon with sort direction parameter is redundant and descending order is taken only if it is equal to desc or DESC. Ascending order is considered in any other case.

Example: sort=name,metadata.createdAt:desc
q
string

Query param for filtering entities by specified type. Examples of query params which are supported:

Q Param Description
name:"Exact match" find an entity with name field with Exact match value
name:~John find an entity with name field containing John value
locDescription.fr:"Description traduction française 02" find an entity with localized locDescription field with Description traduction française 02 value in french language
primary:true find an entity with primary field with true value
metadata.createdAt:(>"2019-01-06T10:29:30.602Z" AND <"2020-01-07T10:29:30.602Z") find an entity with metadata.createdAt field with value between 2019-01-06T10:29:30.602Z and 2020-01-07T10:29:30.602Z
name:exists find an entity with existing name field
name:null find an entity with non-existing name field
name:missing find an entity with non-existing name field
name:"John" surname:~Smith find an entity with name exactly equals to John and surname containing Smith value
name:("John","Jack","James") find an entity with name field with one of the following value: John or Jack or James
Example: q=name:~john
fields
string

Comma-separated list of fields to return in the response. If not specified, all fields are returned.

Example: fields=name,type
name
string

Location name. When specified, only locations containing the specified name will be returned.

Note: When filtering the results with this field, the contains operator is used. The operator is case-insensitive.

type
string

The type of the location. When specified, only locations of the specified type will be returned.

Note: When filtering the results with this field, the equals operator is used.

Enum: "HEADQUARTER" "WAREHOUSE" "OFFICE"
contactDetails.email
string

The email of the contact details of the location. When specified, only locations with contact details containing the specified email will be returned.

Note: When filtering the results with this field, the contains operator is used. The operator is case-insensitive.

contactDetails.phone
string

The phone number of the contact details of the location. When specified, only locations with contact details containing the specified phone number will be returned.

Note: When filtering the results with this field, the contains operator is used. The operator is case-insensitive.

contactDetails.address
string

The address of the contact details of the location. When specified, only locations with contact details containing the specified address will be returned.

Note: When filtering the results with this field, the contains operator is used. The operator is case-insensitive.

contactDetails.city
string

The address of the contact details of the location. When specified, only locations with contact details containing the specified city will be returned.

Note: When filtering the results with this field, the contains operator is used. The operator is case-insensitive.

contactDetails.state
string

The address of the contact details of the location. When specified, only locations with contact details containing the specified state will be returned.

Note: When filtering the results with this field, the contains operator is used. The operator is case-insensitive.

contactDetails.postcode
string

The postcode of the contact details of the location. When specified, only locations with contact details containing the specified postcode will be returned.

Note: When filtering the results with this field, the contains operator is used. The operator is case-insensitive.

contactDetails.countryCode
string

The country code of the contact details of the location. When specified, only locations with contact details having the specified country code will be returned.

Note: When filtering the results with this field, the equals operator is used.

header Parameters
X-Total-Count
boolean
Default: false

In order to get information how many entities meet a filter requirements, X-Total-Count header has been introduced. The header is optional and its default value is false. It the header is provided and it is true then total count is returned in the X-Total-Count response header. In both cases (X-Total-Count true, false or not provided), the response body has the same format (array of entities). In other words, the information about total count is returned on demand, depending of an existence of X-Total-Count header in a request. Therefore, the X-Total-Count header is not returned if an API consumer didn't ask for it.

Responses
200

The request was successful. A list of locations is returned.

400

Request was syntactically incorrect. Details will be provided in the response payload.

401

Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.

403

Given authorization scopes are not sufficient and do not match scopes required by the endpoint.

500

Internal Service Error occurred.

get/{tenant}/locations
Request samples
Response samples
application/json
[
  • {
    },
  • {
    }
]

Retrieving a location

Retrieves a location by the specified unique identifier.


Required scopes

  • customermanagement.location_read
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

locationId
required
string

The location unique identifier.

query Parameters
fields
string

Comma-separated list of fields to return in the response. If not specified, all fields are returned.

Example: fields=name,type
Responses
200

The request was successful. The requested location is returned.

400

Request was syntactically incorrect. Details will be provided in the response payload.

401

Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.

403

Given authorization scopes are not sufficient and do not match scopes required by the endpoint.

404

The requested resource does not exist.

500

Internal Service Error occurred.

get/{tenant}/locations/{locationId}
Request samples
Response samples
application/json
{
  • "id": "627e06ecf0452c2d6c0b81391",
  • "name": "Main HQ",
  • "type": "HEADQUARTER",
  • "contactDetails": {
    },
  • "metadata": {
    }
}

Upserting a location

Updates or creates a location with given location id. You can omit the metadata.version, but then optimistic locking is not enabled.


Required scopes

  • customermanagement.location_manage
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

locationId
required
string

The location unique identifier.

Request Body schema: application/json
name
string

The name of the location

type
required
string

The type of the location.

Enum: "HEADQUARTER" "WAREHOUSE" "OFFICE"
required
object (Contact Details)
object (metadataUpdate)
mixins
object

Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.

Responses
201

The request was successful. The location has been created.

204

The location has been updated successfully.

400

Request was syntactically incorrect. Details will be provided in the response payload.

401

Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.

403

Given authorization scopes are not sufficient and do not match scopes required by the endpoint.

404

The requested resource does not exist.

409

Given resource already exists

500

Internal Service Error occurred.

put/{tenant}/locations/{locationId}
Request samples
application/json
{
  • "name": "Main Warehouse",
  • "type": "WAREHOUSE",
  • "contactDetails": {
    },
  • "metadata": {
    }
}
Response samples
application/json
{
  • "id": "53ac81fd0cce8b26b36f3492"
}

Delete a location

Deletes a location.


Required scopes

  • customermanagement.location_manage
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

locationId
required
string

The location unique identifier.

Responses
204

The location has been deleted successfully.

400

Request was syntactically incorrect. Details will be provided in the response payload.

401

Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.

403

Given authorization scopes are not sufficient and do not match scopes required by the endpoint.

404

The requested resource does not exist.

500

Internal Service Error occurred.

delete/{tenant}/locations/{locationId}
Request samples
Response samples
application/json
{
  • "code": 400,
  • "status": "Bad Request",
  • "message": "Tenant in the header is not matching with the one provided in the URI."
}

Contact Assignments

Creating contact assignment

Creates a new contact assignment for the tenant. A contact assignment represents assignment of an employee of the Company to a legal entity.


Required scopes

  • customermanagement.contactassignment_manage
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

Request Body schema: application/json
id
string [ 1 .. 66 ] characters ^[a-zA-Z0-9_-]$

Custom assignment identifier. If not provided, it is automatically generated.

required
object

The legal entity unique identifier.

required
object

The customer unique identifier.

type
required
string

The type of the customer assignment.

Enum: "PRIMARY" "BILLING" "LOGISTICS"
primary
boolean
Default: false

Indicates whether the customer is primary.

object (metadata_create)

Metadata request.

mixins
object

Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.

Responses
201

The request was successful. The customer assignment has been created.

400

Request was syntactically incorrect. Details will be provided in the response payload.

401

Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.

403

Given authorization scopes are not sufficient and do not match scopes required by the endpoint.

409

Given resource already exists

500

Internal Service Error occurred.

post/{tenant}/contact-assignments
Request samples
application/json
{
  • "legalEntity": {
    },
  • "customer": {
    },
  • "type": "BILLING",
  • "primary": true
}
Response samples
application/json
{
  • "id": "53ac81fd0cce8b26b36f1234"
}

Retrieving all contact assignments

Retrieves all contact assignments assigned to the tenant. You can filter, sort and paginate the results with query parameters.


Required scopes

  • customermanagement.contactassignment_read
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

query Parameters
pageNumber
integer >= 1
Default: 1

The page number to be retrieved where the size of the pages must be specified by the pageSize parameter. The number of the first page is 1.

pageSize
integer >= 1
Default: 16

The number of documents being retrieved on the page.

sort
string

Fields to sort the response data by following order of the parameters from left to right. Can contain multiple fields in format: field name:sort direction separated by a comma. The colon with sort direction parameter is redundant and descending order is taken only if it is equal to desc or DESC. Ascending order is considered in any other case.

Example: sort=name,metadata.createdAt:desc
q
string

Query param for filtering entities by specified type. Examples of query params which are supported:

Q Param Description
name:"Exact match" find an entity with name field with Exact match value
name:~John find an entity with name field containing John value
locDescription.fr:"Description traduction française 02" find an entity with localized locDescription field with Description traduction française 02 value in french language
primary:true find an entity with primary field with true value
metadata.createdAt:(>"2019-01-06T10:29:30.602Z" AND <"2020-01-07T10:29:30.602Z") find an entity with metadata.createdAt field with value between 2019-01-06T10:29:30.602Z and 2020-01-07T10:29:30.602Z
name:exists find an entity with existing name field
name:null find an entity with non-existing name field
name:missing find an entity with non-existing name field
name:"John" surname:~Smith find an entity with name exactly equals to John and surname containing Smith value
name:("John","Jack","James") find an entity with name field with one of the following value: John or Jack or James
Example: q=name:~john
fields
string

Comma-separated list of fields to return in the response. If not specified, all fields are returned.

Example: fields=name,type
legalEntity.id
string

The id of the legal entity. When specified, only customer assignments attached to the specified legal entity will be returned.

Note: When filtering the results with this field, the equals operator is used.

customer.id
string

The id of the customer. When specified, only customer assignments attached to the specified customer will be returned.

Note: When filtering the results with this field, the equals operator is used.

type
string

The type of the customer assignment. When specified, only customer assignments with the specified type will be returned.

Note: When filtering the results with this field, the equals operator is used.

Enum: "PRIMARY" "BILLING" "LOGISTICS"
primary
boolean

The primary customer flag. When specified, only customers with the specified primary flag value will be returned.

Note: When filtering the results with this field, the equals operator is used.

header Parameters
X-Total-Count
boolean
Default: false

In order to get information how many entities meet a filter requirements, X-Total-Count header has been introduced. The header is optional and its default value is false. It the header is provided and it is true then total count is returned in the X-Total-Count response header. In both cases (X-Total-Count true, false or not provided), the response body has the same format (array of entities). In other words, the information about total count is returned on demand, depending of an existence of X-Total-Count header in a request. Therefore, the X-Total-Count header is not returned if an API consumer didn't ask for it.

Responses
200

The request was successful. A list of customer assignments is returned.

400

Request was syntactically incorrect. Details will be provided in the response payload.

401

Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.

403

Given authorization scopes are not sufficient and do not match scopes required by the endpoint.

500

Internal Service Error occurred.

get/{tenant}/contact-assignments
Request samples
Response samples
application/json
[
  • {
    },
  • {
    }
]

Retrieving a contact assignment

Retrieves a contact assignment by the specified unique identifier.


Required scopes

  • customermanagement.contactassignment_read
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

contactAssignmentId
required
string

The identifier of the customer assignment

query Parameters
fields
string

Comma-separated list of fields to return in the response. If not specified, all fields are returned.

Example: fields=name,type
Responses
200

The request was successful. The requested customer assignment is returned.

400

Request was syntactically incorrect. Details will be provided in the response payload.

401

Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.

403

Given authorization scopes are not sufficient and do not match scopes required by the endpoint.

404

The requested resource does not exist.

500

Internal Service Error occurred.

get/{tenant}/contact-assignments/{contactAssignmentId}
Request samples
Response samples
application/json
{
  • "id": "627e06ecf0452c2d6c0b81391",
  • "legalEntity": {
    },
  • "customer": {
    },
  • "type": "BILLING",
  • "primary": true,
  • "metadata": {
    }
}

Upserting a contact assignment

Updates or creates a contact assignment with given contact assignment id. You can omit the metadata.version, but then optimistic locking is not enabled.


Required scopes

  • customermanagement.contactassignment_manage
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

contactAssignmentId
required
string

The identifier of the customer assignment

Request Body schema: application/json
required
object

The legal entity unique identifier.

required
object

The customer unique identifier.

type
required
string

The type of the customer assignment.

Enum: "PRIMARY" "BILLING" "LOGISTICS"
primary
boolean
Default: false

Indicates whether the customer is primary.

object (metadataUpdate)
mixins
object

Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.

Responses
201

The request was successful. The contact assignment has been created.

204

The customer assignment has been updated successfully.

400

Request was syntactically incorrect. Details will be provided in the response payload.

401

Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.

403

Given authorization scopes are not sufficient and do not match scopes required by the endpoint.

404

The requested resource does not exist.

409

Given resource already exists

500

Internal Service Error occurred.

put/{tenant}/contact-assignments/{contactAssignmentId}
Request samples
application/json
{
  • "legalEntity": {
    },
  • "customer": {
    },
  • "type": "LOGISTICS",
  • "primary": false,
  • "metadata": {
    }
}
Response samples
application/json
{
  • "id": "53ac81fd0cce8b26b36f3492"
}

Delete a contact assignment

Deletes a contact assignment.


Required scopes

  • customermanagement.contactassignment_manage
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

contactAssignmentId
required
string

The identifier of the customer assignment

Responses
204

The customer assignment has been deleted successfully.

400

Request was syntactically incorrect. Details will be provided in the response payload.

401

Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.

403

Given authorization scopes are not sufficient and do not match scopes required by the endpoint.

404

The requested resource does not exist.

500

Internal Service Error occurred.

delete/{tenant}/contact-assignments/{contactAssignmentId}
Request samples
Response samples
application/json
{
  • "code": 400,
  • "status": "Bad Request",
  • "message": "Tenant in the header is not matching with the one provided in the URI."
}

Legal Entities