Skip to content

Create a supplier

POST
/stores/{storeRef}/suppliers
curl --request POST \
--url https://apibase.ecomweb.app/api/v1/stores/example/suppliers \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{ "name": "Sidotech", "contact_name": "example", "email": "example", "phone": "example", "address_line1": "example", "address_line2": "example", "province": "79", "ward": "27199", "country": "VN", "note": "example" }'

Creates a supplier and returns it. Only name is required, and it must be unique among the store’s live suppliers, otherwise the request answers 409 with the code SUPPLIER_NAME_TAKEN. country defaults to VN.

Required scopes: write:purchase_orders

storeRef
required
string

The store’s ref, as returned by GET /stores.

Media typeapplication/json
object
name
required

Supplier name

string
>= 1 characters <= 255 characters

Example

Sidotech
contact_name

Name of the contact person.

string
nullable <= 255 characters
email

Email address that purchase orders are sent to.

string
nullable <= 255 characters
phone

Phone number.

string
nullable <= 20 characters
address_line1

First address line.

string
nullable <= 255 characters
address_line2

Second address line.

string
nullable <= 255 characters
province

Province code.

string
nullable <= 100 characters

Example

79
ward

Ward code.

string
nullable <= 100 characters

Example

27199
country

Two-letter country code. Defaults to VN.

string
default: VN >= 2 characters <= 2 characters
note

Internal note about the supplier.

string
nullable <= 2000 characters
Media typeapplication/json
object
id
required

Supplier ID.

number
name
required

Supplier name. Unique among the store’s live suppliers.

string
contact_name
required

Name of the contact person, or null.

string
nullable
email
required

Email address that purchase orders are sent to, or null.

string
nullable
phone
required

Phone number, or null.

string
nullable
address_line1
required

First address line, or null.

string
nullable
address_line2
required

Second address line, or null.

string
nullable
province
required

Province code, or null.

string
nullable
ward
required

Ward code, or null.

string
nullable
country
required

Two-letter country code.

string
note
required

Internal note about the supplier, or null.

string
nullable
archived_at
required

When the supplier was archived, as an ISO 8601 timestamp, or null while the supplier is live.

string
nullable
created_at
required

When the supplier was created, as an ISO 8601 timestamp.

string
updated_at
required

When the supplier was last updated, as an ISO 8601 timestamp.

string

Example generated

{
"id": 1,
"name": "example",
"contact_name": "example",
"email": "example",
"phone": "example",
"address_line1": "example",
"address_line2": "example",
"province": "example",
"ward": "example",
"country": "example",
"note": "example",
"archived_at": "example",
"created_at": "example",
"updated_at": "example"
}

The request is malformed or failed validation.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key is missing, invalid, revoked or expired.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The request conflicts with the resource’s current state.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}