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

# Criar produto ou serviço

POST https://wbudget.app/api/v1/items
Content-Type: application/json

Cria um produto ou serviço no cadastro.

**Autenticação:** Bearer Token da API WBudget. O acesso aos dados respeita as permissões do usuário.

Requer permissão de edição do cadastro de produtos. Envie um objeto JSON; name é obrigatório. Os demais campos seguem os padrões indicados. Erros de validação ou conflito não criam o item.

### Corpo da requisição

| Campo         | Tipo               | Obrigatório | Descrição                                                                                                                                 |
| ------------- | ------------------ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `name`        | string             | Sim         | Nome, entre 1 e 150 caracteres.                                                                                                           |
| `type`        | string             | Não         | product ou service. Padrão product.                                                                                                       |
| `category`    | integer ou null    | Não         | ID de categoria existente. Null remove a categoria; omitido na criação usa o padrão da conta.                                             |
| `value`       | number             | Não         | Preço unitário entre 0 e 99999999.9999. Padrão 0.                                                                                         |
| `qty`         | number             | Não         | Quantidade entre 0 e 99999999.9999. Padrão 1; arredondada conforme a unidade.                                                             |
| `unit`        | string             | Não         | Unidade cadastrada (até 8 caracteres). Na criação: un para produto e hour para serviço.                                                   |
| `description` | string ou null     | Não         | Descrição do produto ou serviço.                                                                                                          |
| `active`      | boolean ou integer | Não         | true/false ou 1/0. Padrão true. Itens inativos deixam de aparecer em GET /items.                                                          |
| `cost`        | number             | Não         | Custo não negativo, máximo 99999999.9999. Padrão 0; a consulta respeita as permissões do usuário.                                         |
| `tax`         | number             | Não         | Tributo não negativo, máximo 999999.999999. Padrão 0, conforme configuração comercial da conta.                                           |
| `sku`         | string ou null     | Não         | Código SKU único, até 45 caracteres. Null ou texto vazio remove o código.                                                                 |
| `pn`          | string ou null     | Não         | Código do fabricante único, até 45 caracteres. Null ou texto vazio remove o código.                                                       |
| `tag`         | string ou null     | Não         | Etiquetas do item.                                                                                                                        |
| `metadata`    | object ou null     | Não         | Campos personalizados. Chaves enviadas são mescladas; uma chave com null é removida. O objeto omitido ou null preserva os valores atuais. |

### Exemplo de JSON enviado

```json
{
  "name": "Consultoria",
  "type": "service",
  "unit": "hour",
  "value": 150,
  "qty": 1,
  "description": "Consultoria por hora",
  "sku": "SERV-501",
  "metadata": {
    "referencia": "ERP-501"
  }
}
```

### Resposta

HTTP **201**. Os exemplos usam dados fictícios e mostram os campos principais; outros campos podem acompanhar a resposta. Campos sem valor podem ser nulos.

Campos principais de `data`:

| Campo           | Tipo               | Descrição                                                                                                                                 |
| --------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `id`            | integer            | ID do produto ou serviço.                                                                                                                 |
| `name`          | string             | Nome, entre 1 e 150 caracteres.                                                                                                           |
| `type`          | string             | product ou service. Padrão product.                                                                                                       |
| `category`      | integer ou null    | ID de categoria existente. Null remove a categoria; omitido na criação usa o padrão da conta.                                             |
| `value`         | number             | Preço unitário entre 0 e 99999999.9999. Padrão 0.                                                                                         |
| `qty`           | number             | Quantidade entre 0 e 99999999.9999. Padrão 1; arredondada conforme a unidade.                                                             |
| `unit`          | string             | Unidade cadastrada (até 8 caracteres). Na criação: un para produto e hour para serviço.                                                   |
| `description`   | string ou null     | Descrição do produto ou serviço.                                                                                                          |
| `active`        | boolean ou integer | true/false ou 1/0. Padrão true. Itens inativos deixam de aparecer em GET /items.                                                          |
| `cost`          | number             | Custo não negativo, máximo 99999999.9999. Padrão 0; a consulta respeita as permissões do usuário.                                         |
| `tax`           | number             | Tributo não negativo, máximo 999999.999999. Padrão 0, conforme configuração comercial da conta.                                           |
| `sku`           | string ou null     | Código SKU único, até 45 caracteres. Null ou texto vazio remove o código.                                                                 |
| `pn`            | string ou null     | Código do fabricante único, até 45 caracteres. Null ou texto vazio remove o código.                                                       |
| `tag`           | string ou null     | Etiquetas do item.                                                                                                                        |
| `metadata`      | object ou null     | Campos personalizados. Chaves enviadas são mescladas; uma chave com null é removida. O objeto omitido ou null preserva os valores atuais. |
| `category_name` | string ou null     | Nome da categoria.                                                                                                                        |
| `create_date`   | string             | Data de criação.                                                                                                                          |

```json
{
  "data": {
    "id": 501,
    "name": "Consultoria",
    "type": "service",
    "category": null,
    "category_name": null,
    "value": 150,
    "qty": 1,
    "unit": "hour",
    "description": "Consultoria por hora",
    "active": true,
    "cost": 0,
    "tax": 0,
    "sku": "SERV-501",
    "pn": null,
    "tag": "consultoria",
    "metadata": {
      "referencia": "ERP-501"
    },
    "create_date": "2026-09-06T10:00:00-03:00"
  }
}
```

### Erros específicos

| HTTP | Código                | Situação                           |
| ---- | --------------------- | ---------------------------------- |
| 422  | `VALIDATION_FAILED`   | Invalid field: name.               |
| 409  | `ITEM_ALREADY_EXISTS` | SKU or part number already exists. |

Consulte a introdução da collection para o formato de erros e a configuração das variáveis.

Reference: https://developers.wbudget.app/w-budget/produtos-e-servicos/criar-produto-ou-servi-o

## 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.

- `description` (string, optional)
- `metadata` (ItemsPostRequestBodyContentApplicationJsonSchemaMetadata, optional)
- `name` (string, optional)
- `qty` (double, optional)
- `sku` (string, optional)
- `type` (string, optional)
- `unit` (string, optional)
- `value` (double, optional)

## Response

### 201

201 — Sucesso — exemplo ilustrativo

- `data` (ItemsPostResponsesContentApplicationJsonSchemaData, optional)

## Errors

### 409 Conflict Error

409 — ITEM_ALREADY_EXISTS — exemplo ilustrativo

- `error` (ItemsPostResponsesContentApplicationJsonSchemaError, optional)

### 422 Unprocessable Entity Error

422 — VALIDATION_FAILED — exemplo ilustrativo

- `error` (ItemsPostResponsesContentApplicationJsonSchemaError, optional)

## Types

### ItemsPostRequestBodyContentApplicationJsonSchemaMetadata

- `referencia` (string, optional)

### ItemsPostResponsesContentApplicationJsonSchemaData

- `active` (boolean, optional)
- `category` (any, optional, nullable)
- `category_name` (any, optional, nullable)
- `cost` (double, optional)
- `create_date` (string, optional)
- `description` (string, optional)
- `id` (double, optional)
- `metadata` (ItemsPostResponsesContentApplicationJsonSchemaDataMetadata, optional)
- `name` (string, optional)
- `pn` (any, optional, nullable)
- `qty` (double, optional)
- `sku` (string, optional)
- `tag` (string, optional)
- `tax` (double, optional)
- `type` (string, optional)
- `unit` (string, optional)
- `value` (double, optional)

### ItemsPostResponsesContentApplicationJsonSchemaError

- `code` (string, optional)
- `message` (string, optional)

### ItemsPostResponsesContentApplicationJsonSchemaDataMetadata

- `referencia` (string, optional)

## Examples

### 201 — Sucesso — exemplo ilustrativo

**Response**

```json
{
  "data": {
    "active": true,
    "category": null,
    "category_name": null,
    "cost": 0,
    "create_date": "2026-09-06T10:00:00-03:00",
    "description": "Consultoria por hora",
    "id": 501,
    "metadata": {
      "referencia": "ERP-501"
    },
    "name": "Consultoria",
    "pn": null,
    "qty": 1,
    "sku": "SERV-501",
    "tag": "consultoria",
    "tax": 0,
    "type": "service",
    "unit": "hour",
    "value": 150
  }
}
```

**SDK Code**

```python 201 — Sucesso — exemplo ilustrativo
import requests

url = "https://wbudget.app/api/v1/items"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript 201 — Sucesso — exemplo ilustrativo
const url = 'https://wbudget.app/api/v1/items';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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

```go 201 — Sucesso — exemplo ilustrativo
package main

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

func main() {

	url := "https://wbudget.app/api/v1/items"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

```ruby 201 — Sucesso — exemplo ilustrativo
require 'uri'
require 'net/http'

url = URI("https://wbudget.app/api/v1/items")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

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

```java 201 — Sucesso — exemplo ilustrativo
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://wbudget.app/api/v1/items")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php 201 — Sucesso — exemplo ilustrativo
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://wbudget.app/api/v1/items', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp 201 — Sucesso — exemplo ilustrativo
using RestSharp;

var client = new RestClient("https://wbudget.app/api/v1/items");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift 201 — Sucesso — exemplo ilustrativo
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://wbudget.app/api/v1/items")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

### Criar produto ou serviço

**Request**

```json
{
  "description": "Consultoria por hora",
  "metadata": {
    "referencia": "ERP-501"
  },
  "name": "Consultoria",
  "qty": 1,
  "sku": "SERV-501",
  "type": "service",
  "unit": "hour",
  "value": 150
}
```

**Response**

```json
{
  "data": {
    "active": true,
    "category": null,
    "category_name": null,
    "cost": 0,
    "create_date": "2026-09-06T10:00:00-03:00",
    "description": "Consultoria por hora",
    "id": 501,
    "metadata": {
      "referencia": "ERP-501"
    },
    "name": "Consultoria",
    "pn": null,
    "qty": 1,
    "sku": "SERV-501",
    "tag": "consultoria",
    "tax": 0,
    "type": "service",
    "unit": "hour",
    "value": 150
  }
}
```

**SDK Code**

```python Criar produto ou serviço
import requests

url = "https://wbudget.app/api/v1/items"

payload = {
    "description": "Consultoria por hora",
    "metadata": { "referencia": "ERP-501" },
    "name": "Consultoria",
    "qty": 1,
    "sku": "SERV-501",
    "type": "service",
    "unit": "hour",
    "value": 150
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Criar produto ou serviço
const url = 'https://wbudget.app/api/v1/items';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"description":"Consultoria por hora","metadata":{"referencia":"ERP-501"},"name":"Consultoria","qty":1,"sku":"SERV-501","type":"service","unit":"hour","value":150}'
};

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

```go Criar produto ou serviço
package main

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

func main() {

	url := "https://wbudget.app/api/v1/items"

	payload := strings.NewReader("{\n  \"description\": \"Consultoria por hora\",\n  \"metadata\": {\n    \"referencia\": \"ERP-501\"\n  },\n  \"name\": \"Consultoria\",\n  \"qty\": 1,\n  \"sku\": \"SERV-501\",\n  \"type\": \"service\",\n  \"unit\": \"hour\",\n  \"value\": 150\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 Criar produto ou serviço
require 'uri'
require 'net/http'

url = URI("https://wbudget.app/api/v1/items")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"description\": \"Consultoria por hora\",\n  \"metadata\": {\n    \"referencia\": \"ERP-501\"\n  },\n  \"name\": \"Consultoria\",\n  \"qty\": 1,\n  \"sku\": \"SERV-501\",\n  \"type\": \"service\",\n  \"unit\": \"hour\",\n  \"value\": 150\n}"

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

```java Criar produto ou serviço
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://wbudget.app/api/v1/items")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"description\": \"Consultoria por hora\",\n  \"metadata\": {\n    \"referencia\": \"ERP-501\"\n  },\n  \"name\": \"Consultoria\",\n  \"qty\": 1,\n  \"sku\": \"SERV-501\",\n  \"type\": \"service\",\n  \"unit\": \"hour\",\n  \"value\": 150\n}")
  .asString();
```

```php Criar produto ou serviço
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://wbudget.app/api/v1/items', [
  'body' => '{
  "description": "Consultoria por hora",
  "metadata": {
    "referencia": "ERP-501"
  },
  "name": "Consultoria",
  "qty": 1,
  "sku": "SERV-501",
  "type": "service",
  "unit": "hour",
  "value": 150
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Criar produto ou serviço
using RestSharp;

var client = new RestClient("https://wbudget.app/api/v1/items");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"description\": \"Consultoria por hora\",\n  \"metadata\": {\n    \"referencia\": \"ERP-501\"\n  },\n  \"name\": \"Consultoria\",\n  \"qty\": 1,\n  \"sku\": \"SERV-501\",\n  \"type\": \"service\",\n  \"unit\": \"hour\",\n  \"value\": 150\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Criar produto ou serviço
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "description": "Consultoria por hora",
  "metadata": ["referencia": "ERP-501"],
  "name": "Consultoria",
  "qty": 1,
  "sku": "SERV-501",
  "type": "service",
  "unit": "hour",
  "value": 150
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://wbudget.app/api/v1/items")! 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()
```