Create a company
Creates a legal invoice sender inside the authenticated account. The WorkOS organization is always derived from the verified token.
POST
/v1/companiesAuthorization
AuthorizationBearer token (JWT) · headerrequiredWorkOS AuthKit user, service, or agent access token
Header parameters
idempotency-keystringrequiredmin length 8 · max length 255 · matches ^[\u0021-\u007E]+$
Request body
requiredapplication/jsonaddressobjectrequiredShow propertiesHide properties
citystringrequiredmin length 1 · max length 120
country_codestringrequiredmatches ^[A-Z]{2}$
line_1stringrequiredmin length 1 · max length 200
line_2stringmax length 200
postal_codestringrequiredmin length 1 · max length 32
regionstringmax length 120
default_currencystringrequiredmatches ^[A-Z]{3}$
default_languagestringmatches ^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$ · default: "en"
default_payment_terms_daysintegermin 0 · max 365 · default: 30
emailstring<email>external_referencestringmin length 1 · max length 255
identifiersobject[]max items 20 · default: []
Show propertiesHide properties
Array of
objectcountry_codestringmatches ^[A-Z]{2}$
schemestringrequiredmatches ^[a-z][a-z0-9._-]{0,63}$
valuestringrequiredmin length 1 · max length 200
legal_namestringrequiredmin length 1 · max length 200
trading_namestringmin length 1 · max length 200
Responses
201Company created or idempotently replayed
addressobjectrequiredShow propertiesHide properties
citystringrequiredmin length 1 · max length 120
country_codestringrequiredmatches ^[A-Z]{2}$
line_1stringrequiredmin length 1 · max length 200
line_2stringmax length 200
postal_codestringrequiredmin length 1 · max length 32
regionstringmax length 120
archived_atstring<date-time> | nullrequiredcreated_atstring<date-time>requireddefault_currencystringrequiredmatches ^[A-Z]{3}$
default_languagestringmatches ^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$ · default: "en"
default_payment_terms_daysintegermin 0 · max 365 · default: 30
emailstring<email>external_referencestringmin length 1 · max length 255
idstring<uuid>requiredidentifiersobject[]max items 20 · default: []
Show propertiesHide properties
Array of
objectcountry_codestringmatches ^[A-Z]{2}$
schemestringrequiredmatches ^[a-z][a-z0-9._-]{0,63}$
valuestringrequiredmin length 1 · max length 200
legal_namestringrequiredmin length 1 · max length 200
trading_namestringmin length 1 · max length 200
updated_atstring<date-time>requiredversionintegerrequired400Malformed request
errorobjectrequiredShow propertiesHide properties
codestringrequireddetailsobject[]Show propertiesHide properties
Array of
objectmessagestringrequiredpathstringrequiredmessagestringrequiredrequest_idstringrequired401Authentication failed
errorobjectrequiredShow propertiesHide properties
codestringrequireddetailsobject[]Show propertiesHide properties
Array of
objectmessagestringrequiredpathstringrequiredmessagestringrequiredrequest_idstringrequired403Permission denied
errorobjectrequiredShow propertiesHide properties
codestringrequireddetailsobject[]Show propertiesHide properties
Array of
objectmessagestringrequiredpathstringrequiredmessagestringrequiredrequest_idstringrequired409Request conflict
errorobjectrequiredShow propertiesHide properties
codestringrequireddetailsobject[]Show propertiesHide properties
Array of
objectmessagestringrequiredpathstringrequiredmessagestringrequiredrequest_idstringrequired413Request body is too large
errorobjectrequiredShow propertiesHide properties
codestringrequireddetailsobject[]Show propertiesHide properties
Array of
objectmessagestringrequiredpathstringrequiredmessagestringrequiredrequest_idstringrequired415Unsupported media type
errorobjectrequiredShow propertiesHide properties
codestringrequireddetailsobject[]Show propertiesHide properties
Array of
objectmessagestringrequiredpathstringrequiredmessagestringrequiredrequest_idstringrequired422Request validation failed
errorobjectrequiredShow propertiesHide properties
codestringrequireddetailsobject[]Show propertiesHide properties
Array of
objectmessagestringrequiredpathstringrequiredmessagestringrequiredrequest_idstringrequired500Unexpected server error
errorobjectrequiredShow propertiesHide properties
codestringrequireddetailsobject[]Show propertiesHide properties
Array of
objectmessagestringrequiredpathstringrequiredmessagestringrequiredrequest_idstringrequiredRequest
curl -X POST "/v1/companies" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "idempotency-key: stringst" \
-H "Content-Type: application/json" \
-d '{
"address": {
"city": "string",
"country_code": "string",
"line_1": "string",
"line_2": "string",
"postal_code": "string",
"region": "string"
},
"default_currency": "string",
"default_language": "en",
"default_payment_terms_days": 30,
"email": "user@example.com",
"external_reference": "string",
"identifiers": [],
"legal_name": "string",
"trading_name": "string"
}'const response = await fetch("/v1/companies", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"idempotency-key": "stringst",
"Content-Type": "application/json"
},
body: JSON.stringify({
"address": {
"city": "string",
"country_code": "string",
"line_1": "string",
"line_2": "string",
"postal_code": "string",
"region": "string"
},
"default_currency": "string",
"default_language": "en",
"default_payment_terms_days": 30,
"email": "user@example.com",
"external_reference": "string",
"identifiers": [],
"legal_name": "string",
"trading_name": "string"
})
});import requests
response = requests.post(
"/v1/companies",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"idempotency-key": "stringst",
"Content-Type": "application/json"
},
json={
"address": {
"city": "string",
"country_code": "string",
"line_1": "string",
"line_2": "string",
"postal_code": "string",
"region": "string"
},
"default_currency": "string",
"default_language": "en",
"default_payment_terms_days": 30,
"email": "user@example.com",
"external_reference": "string",
"identifiers": [],
"legal_name": "string",
"trading_name": "string"
},
)Response
{
"address": {
"city": "string",
"country_code": "string",
"line_1": "string",
"line_2": "string",
"postal_code": "string",
"region": "string"
},
"archived_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z",
"default_currency": "string",
"default_language": "en",
"default_payment_terms_days": 30,
"email": "user@example.com",
"external_reference": "string",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"identifiers": [],
"legal_name": "string",
"trading_name": "string",
"updated_at": "2019-08-24T14:15:22Z",
"version": 0
}{
"error": {
"code": "string",
"details": [
{
"message": "string",
"path": "string"
}
],
"message": "string",
"request_id": "string"
}
}{
"error": {
"code": "string",
"details": [
{
"message": "string",
"path": "string"
}
],
"message": "string",
"request_id": "string"
}
}{
"error": {
"code": "string",
"details": [
{
"message": "string",
"path": "string"
}
],
"message": "string",
"request_id": "string"
}
}{
"error": {
"code": "string",
"details": [
{
"message": "string",
"path": "string"
}
],
"message": "string",
"request_id": "string"
}
}{
"error": {
"code": "string",
"details": [
{
"message": "string",
"path": "string"
}
],
"message": "string",
"request_id": "string"
}
}{
"error": {
"code": "string",
"details": [
{
"message": "string",
"path": "string"
}
],
"message": "string",
"request_id": "string"
}
}{
"error": {
"code": "string",
"details": [
{
"message": "string",
"path": "string"
}
],
"message": "string",
"request_id": "string"
}
}{
"error": {
"code": "string",
"details": [
{
"message": "string",
"path": "string"
}
],
"message": "string",
"request_id": "string"
}
}