> For the complete documentation index, see [llms.txt](https://docs.barte.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.barte.com/guias/pedidos-e-cobrancas/criando-um-comprador.md).

# Criando um Comprador

Na Barte, todo pedido (**order**) precisa estar associado a um **comprador**.\
Por isso, antes de criar uma order, é necessário registrar o comprador e obter o seu **`uuid`** ou buscar por um comprador já cadastrado para associá-lo ao pedido.    &#x20;

O **comprador** representa a pessoa física ou jurídica que realizará a transação.\
Ele armazena informações como:

* Nome e e-mail
* Documento (CPF/CNPJ)
* Dados de contato
* Endereço

### Criar um comprador (Buyer)

O comprador representa a pessoa que realizará o pagamento.

#### Endpoint

```
POST /v2/buyers
https://api.barte.com/v2/buyers
```

#### Headers

```
X-Token-Api: YOUR_API_KEY
Content-Type: application/json
Accept: */*
```

#### Body

```json
{
  "document": {
    "documentNumber": "48637879012",
    "documentType": "cpf",
    "documentNation": "BR"
  },
  "name": "John Doe",
  "email": "johndoe@barte.com",
  "countryCode": "+55",
  "phone": "34999991111",
  "alternativeEmail": "johndoealt@barte.com",
  "address": {
    "street": "Rua Orleans",
    "number": "100",
    "complement": "Bloco A",
    "district": "Jardim Europa",
    "city": "Uberlândia",
    "state": "Minas Gerais",
    "country": "BR",
    "zipCode": "38414552"
  }
}
```

#### Response

```json
{
  "uuid": "1ee849a4-6bb3-47f0-b32a-293a8f0e811c",
  "document": "48637879012",
  "name": "John Doe",
  "countryCode": "+55",
  "phone": "34999991111",
  "email": "johndoe@barte.com",
  "alternativeEmail": "johndoe@barte.com"
}
```

> ✅ Guarde o campo **uuid**, ele será utilizado na criação do pedido.

Veja a referencia API do endpoint de criação de buyers clicando no link abaixo para entender sobre todos os campos, retornos de sucesso e erro e demais informações:

{% content-ref url="/spaces/hY03QzfTvLWOjOsYfPiz/pages/AWqGHk0JpyBAFok3KhB9" %}
[Criar Comprador](/api-reference/compradores/criar-comprador.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.barte.com/guias/pedidos-e-cobrancas/criando-um-comprador.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
