> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.josecarlosonate.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.josecarlosonate.com/_mcp/server.

# Create Supplier

POST http://localhost:8000/api/v1/suppliers
Content-Type: application/json

**Endpoint:** `http://localhost:8000/api/v1/suppliers`

Creates a new supplier record.

## Request Body

| Field       | Type    | Required | Description                                      |
| ----------- | ------- | -------- | ------------------------------------------------ |
| `name`      | string  | ✓        | Supplier company name                            |
| `tax_id`    | string  | —        | Tax identification number (NIT / RUT)            |
| `email`     | string  | —        | Contact email address                            |
| `phone`     | string  | —        | Contact phone number                             |
| `address`   | string  | —        | Physical address                                 |
| `is_active` | boolean | —        | Whether the supplier is active (default: `true`) |

### Example

```json
{
    "name": "TechImport Colombia",
    "tax_id": "900123456",
    "email": "ventas@techimport.com",
    "phone": "+57 300 123 4567",
    "address": "Valledupar, Cesar",
    "is_active": true
}
```

## Response Schema `201 Created`

```json
{
    "data": {
        "id": "integer",
        "name": "string",
        "tax_id": "string",
        "email": "string",
        "phone": "string",
        "address": "string",
        "is_active": "boolean",
        "created_at": "string (ISO 8601)",
        "updated_at": "string (ISO 8601)"
    }
}
```

## Error Responses

| Status                     | Description                                  |
| -------------------------- | -------------------------------------------- |
| `422 Unprocessable Entity` | Validation error — missing or invalid fields |

Reference: https://api.josecarlosonate.com/stock-core-api/suppliers/create-supplier

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects an object.

- `name` (string, required)
- `tax_id` (string, required)
- `email` (string, required)
- `phone` (string, required)
- `address` (string, required)
- `is_active` (boolean, required)

## Response

### 200

Successful response

## Examples

**Request**

```json
{
  "name": "TechImport Colombia",
  "tax_id": "900123456",
  "email": "ventas@techimport.com",
  "phone": "+57 300 123 4567",
  "address": "Valledupar, Cesar",
  "is_active": true
}
```

**Response**

```json
{}
```

**SDK Code**

```python Suppliers_Create Supplier_example
import requests

url = "http://localhost:8000/api/v1/suppliers"

payload = {
    "name": "TechImport Colombia",
    "tax_id": "900123456",
    "email": "ventas@techimport.com",
    "phone": "+57 300 123 4567",
    "address": "Valledupar, Cesar",
    "is_active": True
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Suppliers_Create Supplier_example
const url = 'http://localhost:8000/api/v1/suppliers';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"TechImport Colombia","tax_id":"900123456","email":"ventas@techimport.com","phone":"+57 300 123 4567","address":"Valledupar, Cesar","is_active":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Suppliers_Create Supplier_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:8000/api/v1/suppliers"

	payload := strings.NewReader("{\n  \"name\": \"TechImport Colombia\",\n  \"tax_id\": \"900123456\",\n  \"email\": \"ventas@techimport.com\",\n  \"phone\": \"+57 300 123 4567\",\n  \"address\": \"Valledupar, Cesar\",\n  \"is_active\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Suppliers_Create Supplier_example
require 'uri'
require 'net/http'

url = URI("http://localhost:8000/api/v1/suppliers")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"TechImport Colombia\",\n  \"tax_id\": \"900123456\",\n  \"email\": \"ventas@techimport.com\",\n  \"phone\": \"+57 300 123 4567\",\n  \"address\": \"Valledupar, Cesar\",\n  \"is_active\": true\n}"

response = http.request(request)
puts response.read_body
```

```java Suppliers_Create Supplier_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("http://localhost:8000/api/v1/suppliers")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"TechImport Colombia\",\n  \"tax_id\": \"900123456\",\n  \"email\": \"ventas@techimport.com\",\n  \"phone\": \"+57 300 123 4567\",\n  \"address\": \"Valledupar, Cesar\",\n  \"is_active\": true\n}")
  .asString();
```

```php Suppliers_Create Supplier_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:8000/api/v1/suppliers', [
  'body' => '{
  "name": "TechImport Colombia",
  "tax_id": "900123456",
  "email": "ventas@techimport.com",
  "phone": "+57 300 123 4567",
  "address": "Valledupar, Cesar",
  "is_active": true
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Suppliers_Create Supplier_example
using RestSharp;

var client = new RestClient("http://localhost:8000/api/v1/suppliers");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"TechImport Colombia\",\n  \"tax_id\": \"900123456\",\n  \"email\": \"ventas@techimport.com\",\n  \"phone\": \"+57 300 123 4567\",\n  \"address\": \"Valledupar, Cesar\",\n  \"is_active\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Suppliers_Create Supplier_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "TechImport Colombia",
  "tax_id": "900123456",
  "email": "ventas@techimport.com",
  "phone": "+57 300 123 4567",
  "address": "Valledupar, Cesar",
  "is_active": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8000/api/v1/suppliers")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```