> For the complete documentation index, see [llms.txt](https://docs.brasilcashbank.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.brasilcashbank.com/pix-in/create-qrcode.md). Agents can also search and read this documentation through its [MCP server](https://docs.brasilcashbank.com/~gitbook/mcp).

# Create QRCODE

### Integration and Implementation Guide

#### 1. Overview

This document describes how to integrate with the PIX Charge Creation API.

The endpoint allows an application to create a PIX charge (COB) by submitting debtor information, payment amount, and charge expiration settings.

The request requires a valid access token obtained through the BrasilCashBank OAuth authentication endpoint.

Upon successful processing, the API returns a response containing information about the created PIX charge.

#### 2. API Endpoint

| Property       | Value                                       |
| -------------- | ------------------------------------------- |
| HTTP Method    | POST                                        |
| Endpoint       | `https://api-qrcode.brasilcashbank.com/cob` |
| Content-Type   | `application/json`                          |
| Authentication | Bearer Token                                |

#### 3. Authentication

Before creating a PIX charge, the application must obtain an access token through the OAuth authentication endpoint.

**Required HTTP Headers:**

```
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json                
```

**Important:** The access token must be valid when the charge creation request is submitted.

#### 4. Request Parameters

The request body must be sent in JSON format.

The payload contains three main objects:

* `calendar`: Defines the charge expiration settings.
* `debtor`: Contains the payer's identification information.
* `amount`: Defines the original payment amount and change configuration.

#### 5. Complete Request Example

**HTTP Request:**

http

```
POST /cob HTTP/1.1
Host: api-qrcode.brasilcashbank.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

{
  "referenceId": "21312",
  "calendar": {
    "expiration": 3600
  },
  "debtor": {
    "name": "John Leno",
    "document": "00000000000"
  },
  "amount": {
    "original": 10000,
    "change_type": true
  }
}
```

<table><thead><tr><th>Input</th><th width="121">Required</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>calendar.expiration</td><td>no</td><td>integer</td><td>default 3600</td></tr><tr><td>referenceId</td><td>no</td><td>string</td><td>Id to be used for conciliation of the resulting Pix transaction</td></tr><tr><td>debtor.name</td><td>no</td><td>string</td><td>Final payer's name</td></tr><tr><td>debtor.document</td><td>no</td><td>string</td><td>Final payer's document</td></tr><tr><td>amount.original</td><td>yes</td><td>long</td><td>1000 = R$ 10.00</td></tr><tr><td>amount.change_type</td><td>yes</td><td>boolean</td><td>can amount be changed</td></tr></tbody></table>

{% tabs %}
{% tab title="C#" %}
{% code expandable="true" %}

```csharp
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api-qrcode.brasilcashbank.com/cob");
request.Headers.Add("Authorization", "Bearer TG9yanBkb0dHdlJVNEtWUDZHUzBUNXNJWHlqQzNuWXl3Y1M4d2hOamNqVGxSMWJaa29iNGJwUU1ZZFo0QlZ4R0kzTnhPY3cyOEZwc2lqZnhHb2h3QlBBeEtsaDk3eTdaVEN0cnYwcGdacTc4eG50bU9zSHhwWExzclp5YW4xY05qSm5nOGp6NHI1YTNER29QczJIMmg0OUxJVGp6OGF0dA==");
var content = new StringContent("{\n  \"calendar\": {\n    \"expiration\": 3600\n  },\n  \"debtor\": {\n    \"name\": \"John Leno\",\n    \"document\": \"00000000000\"\n  },\n  \"amount\": {\n    \"original\": 10000,\n    \"change_type\": true\n  }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

{% endcode %}
{% endtab %}

{% tab title="Javascript" %}

<pre class="language-javascript" data-expandable="true"><code class="lang-javascript">const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer TG9yanBkb0dHdlJVNEtWUDZHUzBUNXNJWHlqQzNuWXl3Y1M4d2hOamNqVGxSMWJaa29iNGJwUU1ZZFo0QlZ4R0kzTnhPY3cyOEZwc2lqZnhHb2h3QlBBeEtsaDk3eTdaVEN0cnYwcGdacTc4eG50bU9zSHhwWExzclp5YW4xY05qSm5nOGp6NHI1YTNER29QczJIMmg0OUxJVGp6OGF0dA==");

const raw = JSON.stringify({
  "calendar": {
    "expiration": 3600
  },
  "debtor": {
    "name": "John Leno",
    "document": "00000000000"
  },
  "amount": {
    "original": 10000,
    "change_type": true
  }
});

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};

fetch("https://api-qrcode.brasilcashbank.com/cob", requestOptions)
  .then((response) => response.<a data-footnote-ref href="#user-content-fn-1">text</a>())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
</code></pre>

{% endtab %}

{% tab title="Node.js (AXIOS)" %}
{% code expandable="true" %}

```typescript
const axios = require('axios');
let data = JSON.stringify({
  "calendar": {
    "expiration": 3600
  },
  "debtor": {
    "name": "John Leno",
    "document": "00000000000"
  },
  "amount": {
    "original": 10000,
    "change_type": true
  }
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api-qrcode.brasilcashbank.com/cob',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer TG9yanBkb0dHdlJVNEtWUDZHUzBUNXNJWHlqQzNuWXl3Y1M4d2hOamNqVGxSMWJaa29iNGJwUU1ZZFo0QlZ4R0kzTnhPY3cyOEZwc2lqZnhHb2h3QlBBeEtsaDk3eTdaVEN0cnYwcGdacTc4eG50bU9zSHhwWExzclp5YW4xY05qSm5nOGp6NHI1YTNER29QczJIMmg0OUxJVGp6OGF0dA=='
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code expandable="true" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api-qrcode.brasilcashbank.com/cob',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
  "calendar": {
    "expiration": 3600
  },
  "debtor": {
    "name": "John Leno",
    "document": "00000000000"
  },
  "amount": {
    "original": 10000,
    "change_type": true
  }
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Bearer TG9yanBkb0dHdlJVNEtWUDZHUzBUNXNJWHlqQzNuWXl3Y1M4d2hOamNqVGxSMWJaa29iNGJwUU1ZZFo0QlZ4R0kzTnhPY3cyOEZwc2lqZnhHb2h3QlBBeEtsaDk3eTdaVEN0cnYwcGdacTc4eG50bU9zSHhwWExzclp5YW4xY05qSm5nOGp6NHI1YTNER29QczJIMmg0OUxJVGp6OGF0dA=='
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code expandable="true" %}

```python
import http.client
import json

conn = http.client.HTTPSConnection("api-qrcode.brasilcashbank.com")
payload = json.dumps({
  "calendar": {
    "expiration": 3600
  },
  "debtor": {
    "name": "John Leno",
    "document": "00000000000"
  },
  "amount": {
    "original": 10000,
    "change_type": True
  }
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer TG9yanBkb0dHdlJVNEtWUDZHUzBUNXNJWHlqQzNuWXl3Y1M4d2hOamNqVGxSMWJaa29iNGJwUU1ZZFo0QlZ4R0kzTnhPY3cyOEZwc2lqZnhHb2h3QlBBeEtsaDk3eTdaVEN0cnYwcGdacTc4eG50bU9zSHhwWExzclp5YW4xY05qSm5nOGp6NHI1YTNER29QczJIMmg0OUxJVGp6OGF0dA=='
}
conn.request("POST", "/cob", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endcode %}
{% endtab %}
{% endtabs %}

<details>

<summary> 🟢 200 - S<strong>uccessfully</strong></summary>

<sub>Response body</sub>

```javascript
{
    "txid": "190d3509194163869bf2977be22452",
    "status": "ACTIVE",
    "amount": 10000,
    "userId": "12321",
    "copy_and_past": "00020126850014br.gov.bcb.pix2563pix.bacen.com.br/qr/v3/at/41471610-3fe7-4922-91d1-3be661454a405204000053039865802BR5925PAYGO_PROCESSAMENTOS_DE6006RECIFE62070503***6304B1B7",
    "qr_code": "00020126850014br.gov.bcb.pix2563pix.bacen.com.br/qr/v3/at/41471610-3fe7-4922-91d1-3be661454a405204000053039865802BR5925PAYGO_PROCESSAMENTOS_DE6006RECIFE62070503***6304B1B7",
    "endToEndId": null,
    "debtor": {
        "name": null,
        "document": null
    },
    "calendar": {
        "created": null,
        "expiration": 0
    }
}
```

</details>

<details>

<summary>🔴400 - Bad request</summary>

</details>

<details>

<summary>🔴401 - Unauthorized</summary>

</details>

<details>

<summary>🔴500 - Internal server error</summary>

</details>

[^1]:


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.brasilcashbank.com/pix-in/create-qrcode.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
