Create Supplier
Creates a new supplier for the authenticated company.
Rules:
- The
namefield is required and must not be empty. - Two suppliers with the same name cannot exist for the same company.
Once created, use the returned supplier ID to classify expenses when recording transactions.
curl -X POST "https://api-sandbox.contasimples.com/suppliers/v1/suppliers" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"name": "Example Supplier LLC"
}'
import requests
import json
url = "https://api-sandbox.contasimples.com/suppliers/v1/suppliers"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"name": "Example Supplier LLC"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api-sandbox.contasimples.com/suppliers/v1/suppliers", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"name": "Example Supplier LLC"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"name": "Example Supplier LLC"
}`)
req, err := http.NewRequest("POST", "https://api-sandbox.contasimples.com/suppliers/v1/suppliers", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api-sandbox.contasimples.com/suppliers/v1/suppliers')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"name": "Example Supplier LLC"
}'
response = http.request(request)
puts response.body
{
"id": 16,
"name": "Example Supplier LLC",
"type": {
"id": 1,
"type": "CUSTOM"
}
}
{
"error": "Bad Request",
"message": "One or more request parameters are invalid.",
"code": 400,
"requestId": "123e4567-e89b-12d3-a456-426614174000",
"details": [
"The example field must have a value between 5 and 100.",
"Dates must be in YYYY-MM-DD format."
]
}
{
"error": "Unauthorized",
"message": "Invalid or expired access token.",
"requestId": "123e4567-e89b-12d3-a456-426614174000",
"code": 401
}
{
"error": "Conflict",
"message": "A supplier with the same name already exists for this company.",
"requestId": "123e4567-e89b-12d3-a456-426614174000",
"code": 409
}
{
"error": "Internal Server Error",
"message": "An unexpected error occurred while processing the request.",
"requestId": "123e4567-e89b-12d3-a456-426614174000",
"code": 500
}
POST
/suppliers/v1/suppliers
POST
Base URLstring
Target server for requests. Edit to use your own host.
Bearer Token
Bearer Tokenstring
RequiredBearer token from OAuth 2.0 client credentials. Format: Bearer TOKEN
Bearer token from OAuth 2.0 client credentials. Format:
Bearer TOKENContent-Typestring
RequiredThe media type of the request body
Options: application/json
namestring
RequiredSupplier name. Must be unique per company.
Request Preview
Response
Response will appear here after sending the request
Authentication
header
Authorizationstring
RequiredBearer token. Bearer token from OAuth 2.0 client credentials. Format: Bearer TOKEN
Body
application/json
Responses
Was this page helpful?