Create Tenant
1 min
POST
https://api.upstartcommerce.com/v1/tenants
Header Parameters
- x-upstart-tenantstringrequiredDescription
Body Parameters
- bodyCreateTenantrequiredExample
{ "name": "Acme Retail Corporation", "email": "[email protected]", "domain": "acme-retail", "tenant": "acme001", "sites": [ { "name": "Main Store", "url": "shop.acmeretail.com", "enabled": true, "activationDate": "2024-01-15T00:00:00Z" } ] }Description- namestringrequiredExampleDescription
- emailstring<email>requiredExampleDescriptionFormatemail
- domainstringExampleDescriptionPattern^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$
- sitesCreateSite[]requiredDescription
- activationDatestring<date-time>ExampleDescriptionFormatdate-time
- archivedbooleanDescriptionDefaultfalse
- deactivationDatestring<date-time>ExampleDescriptionFormatdate-time
- enabledbooleanExampleDescriptionDefaulttrue
- idstringExampleDescription
- namestringrequiredExampleDescription
- urlstringrequiredExampleDescription
- tenantstringExampleDescriptionPattern^[0-9a-zA-Z]{0,40}$
Responses
201
- TenantSummaryExample
{ "tenant": "acme001", "name": "Acme Retail Corporation", "email": "[email protected]", "domain": "acme-retail", "sites": [ { "id": "main-store", "name": "Main Store", "url": "shop.acmeretail.com", "enabled": true, "archived": false, "activationDate": "2024-01-15T00:00:00Z" } ] }Description- namestringrequiredExampleDescription
- sitesSiteData[]requiredDescription
- activationDatestring<date-time>ExampleDescriptionFormatdate-time
- archivedbooleanrequiredDescriptionDefaultfalse
- deactivationDatestring<date-time>ExampleDescriptionFormatdate-time
- enabledbooleanrequiredExampleDescriptionDefaulttrue
- idstringrequiredExampleDescription
- namestringrequiredExampleDescription
- urlstringrequiredExampleDescription
- tenantstringrequiredExampleDescription
- emailstringrequiredExampleDescription
- domainstringExampleDescription
400
- ValidationErrorResponseExample
{ "name": "ValidationError", "code": "INVALID_EMAIL_FORMAT", "detail": "The email field must be a valid email address. Received: \"invalid-email\"" }Description- namestringrequiredExampleDescription
- codestringrequiredExampleDescription
- detailstringExampleDescription
401
- UnauthorizedErrorExample
{ "name": "AuthorizationError", "code": "INSUFFICIENT_PERMISSIONS", "detail": "User does not have the required tenant.create permission to perform this operation.", "reason": "Your access token does not include the necessary permissions. Contact your administrator to request access." }Description- namestringrequiredDescription
- codestringrequiredDescription
- detailstringDescription
- reasonstringDescription
409
- ConflictErrorExample
{ "name": "ConflictError", "code": "TENANT_DOMAIN_ALREADY_EXISTS", "detail": "A tenant with the domain \"acme-retail\" already exists in the system.", "reason": "Tenant domains must be globally unique. Please choose a different domain name for your tenant." }Description- namestringrequiredDescription
- codestringrequiredDescription
- detailstringDescription
- reasonstringDescription
422
- UnprocessableEntityErrorExample
{ "name": "UnprocessableEntityError", "code": "INVALID_SITE_CONFIGURATION", "detail": "The deactivationDate must be after the activationDate.", "reason": "A site cannot be deactivated before it is activated. Please adjust the dates so that deactivation occurs after activation." }Description- namestringrequiredDescription
- codestringrequiredDescription
- detailstringDescription
- reasonstringDescription
500
- InternalServerErrorExample
{ "name": "InternalServerError", "code": "UNEXPECTED_ERROR", "detail": "An unexpected error occurred while processing your request.", "reason": "Our team has been notified. Please try again, and if the problem persists, contact support with trace ID: 550e8400-e29b-41d4-a716-446655440000" }Description- namestringrequiredDescription
- codestringrequiredDescription
- detailstringDescription
- reasonstringDescription
503
- ServiceUnavailableErrorExample
{ "name": "Service Unavailable", "code": "UNKNOWN", "detail": "Permission resolution is unavailable, please retry", "reason": "A dependency required to authorize this request is temporarily unreachable. Please retry shortly." }Description- namestringrequiredDescription
- codestringrequiredDescription
- detailstringDescription
- reasonstringDescription
curl
curl --request POST \
--url https://api.upstartcommerce.com/v1/tenants \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-upstart-tenant: string' \
--data-raw '{
"name": "Acme Retail Corporation",
"email": "[email protected]",
"sites": [
{
"enabled": true,
"name": "US West Coast Store",
"url": "westcoast.acmeretail.com"
}
]
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
myHeaders.append("x-upstart-tenant", "string");
var raw = JSON.stringify({
"name": "Acme Retail Corporation",
"email": "[email protected]",
"sites": [
{
"enabled": true,
"name": "US West Coast Store",
"url": "westcoast.acmeretail.com"
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.upstartcommerce.com/v1/tenants", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.upstartcommerce.com/v1/tenants")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request["x-upstart-tenant"] = "string"
request.body = JSON.dump({
"name": "Acme Retail Corporation",
"email": "[email protected]",
"sites": [
{
"enabled": true,
"name": "US West Coast Store",
"url": "westcoast.acmeretail.com"
}
]
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.upstartcommerce.com/v1/tenants"
payload = json.dumps({
"name": "Acme Retail Corporation",
"email": "[email protected]",
"sites": [
{
"enabled": True,
"name": "US West Coast Store",
"url": "westcoast.acmeretail.com"
}
]
})
headers = {
'accept': 'application/json',
'content-type': 'application/json',
'x-upstart-tenant': 'string'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// Success-tenant created successfully.
{
"name": "Acme Retail Corporation",
"sites": [
{
"activationDate": "2024-01-15T00:00:00Z",
"archived": false,
"deactivationDate": "2025-12-31T23:59:59Z",
"enabled": true,
"id": "us-west-store",
"name": "US West Coast Store",
"url": "westcoast.acmeretail.com"
}
],
"tenant": "acme001",
"email": "[email protected]",
"domain": "acme-retail"
}400
// The request contained information that the server was unable to process. Appropriate errors are provided in the response body.
{
"name": "ValidationError",
"code": "INVALID_EMAIL_FORMAT",
"detail": "The email field must be a valid email address. Received: \"invalid-email\""
}401
// The provided credentials were not valid for this endpoint. It may be that they are expired or that the user's roles are insufficient.
{
"name": "",
"code": "",
"detail": "",
"reason": ""
}409
// The request conflicts with the current state of the resource. This typically occurs when trying to create a resource that already exists or when there's a conflict with business rules.
{
"name": "",
"code": "",
"detail": "",
"reason": ""
}422
// The request was well-formed but contains semantic errors or violates business rules that prevent processing.
{
"name": "",
"code": "",
"detail": "",
"reason": ""
}500
// An unexpected internal server error occurred. The request may be retried, and if the problem persists, contact support with the traceId from the error response.
{
"name": "",
"code": "",
"detail": "",
"reason": ""
}503
// A downstream dependency was unavailable, so the request could not be authorized or completed. The request may be retried.
{
"name": "",
"code": "",
"detail": "",
"reason": ""
}