> For the complete documentation index, see [llms.txt](https://docs.pixone.com.br/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pixone.com.br/api/autenticacao.md).

# Autenticação

A API Pix One utiliza autenticação Basic Auth para todas as requisições. Esse método de autenticação é seguro e simples de implementar em suas ferramentas e sistemas.

## Credênciais de acesso

A autenticação na API Pix One é feita utilizando Basic Auth com suas chaves de API obtidas através de do painel da Pix One.

* **Username:** sk\_userKey (sua chave secreta)
* **Password:** pk\_userKey (sua chave pública)

## Como utilizar a autenticação

Para autenticar suas requisições, inclua as credenciais no cabeçalho HTTP de autorização:

```
Authorization: Basic {base64(sk_userKey:pk_userKey)}
```

#### Exemplo utilizando cURL

```sh
curl -X POST https://api.pixone.com.br/api/v1/transaction \
  -H "Authorization: Basic {base64(sk_userKey:pk_userKey)}" \
  -H "Content-Type: application/json" \
  -d '{
    ....
  }'
```

#### Exemplo em Javascript

```javascript
const response = await fetch('https://api.pixone.com.br/api/v1/transaction', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa('sk_userKey:pk_userKey'),
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    ....
  })
});

const data = await response.json();
console.log(data);
```

#### Exemplo em PHP

```php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.pixone.com.br/api/v1/transaction');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
  ....
]));

$headers = [
  'Authorization: Basic ' . base64_encode('sk_userKey:pk_userKey'),
  'Content-Type: application/json'
];

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
```


---

# 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.pixone.com.br/api/autenticacao.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.
