# Pix Automático

Pix Automático is Bacen's recurring Pix product, which lets you charge a payer automatically over time without asking for a new authorization at each payment.

A Pix Pull Subscription authorizes recurring debits from a payer's account, defining the terms under which charges can be issued. A Pix Pull Request then issues each scheduled charge against an active subscription.

This guide walks you through both resources: authorizing subscriptions and issuing the scheduled charges that settle them.

**RESOURCE SUMMARY**

Pix Pull SubscriptionAuthorize recurring Pix payments (Pix Automático) from a payer's account.Pix Pull RequestIssue a charge against an active Pix Automático subscription.

## Pix Pull Subscription Overview

A Pix Pull Subscription is a recurring authorization (Pix Automático) that lets a receiver pull Pix payments from a payer's account on a defined schedule.

Here we will show you how to create and manage them.

### The Pix Pull Subscription Object

**Parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` | STRING | Unique id for the Pix pull subscription. |
| `bacenId` | STRING | Central Bank identifier of the recurring authorization. |
| `amount` | INTEGER | Fixed amount in cents pulled on each cycle. 0 when the amount is variable. |
| `amountMinLimit` | INTEGER | Minimum amount in cents allowed per pull when the amount is variable. |
| `interval` | STRING | Billing interval. Options: "week", "month", "quarter", "semester", "year". |
| `description` | STRING | Description presented to the payer. |
| `referenceCode` | STRING | Free reference code for the subscription. |
| `installmentStart` | STRING | Date when the recurring authorization starts. |
| `installmentEnd` | STRING | Date when the recurring authorization ends. |
| `due` | STRING | Due datetime for the payer to approve the authorization. |
| `pullRetryLimit` | INTEGER | Maximum number of pull retries allowed per cycle. |
| `type` | STRING | Subscription type. Options: "push", "qrcode", "qrcodeAndPayment", "paymentAndOrQrcode". |
| `externalId` | STRING | Unique external id to prevent duplicates. |
| `receiverName` | STRING | Name of the receiver (creditor). |
| `receiverTaxId` | STRING | CPF or CNPJ of the receiver. |
| `receiverBankCode` | STRING | Bank ISPB code of the receiver. |
| `senderTaxId` | STRING | CPF or CNPJ of the payer (debtor). |
| `senderAccountNumber` | STRING | Account number of the payer. |
| `senderBranchCode` | STRING | Branch code of the payer's account. |
| `senderBankCode` | STRING | Bank ISPB code of the payer. |
| `senderFinalName` | STRING | Name of the final payer, when different from the account holder. |
| `senderFinalTaxId` | STRING | CPF or CNPJ of the final payer, when different from the account holder. |
| `senderCityCode` | STRING | IBGE city code of the payer. |
| `status` | STRING | Current status. Options: "created", "pending", "approved", "active", "failed", "denied", "canceled", "expired". |
| `tags` | LIST OF STRINGS | Tags associated with the Pix pull subscription. |
| `flow` | STRING | Direction of the subscription. Options: "out" (you are the receiver), "in" (you are the payer). |
| `created` | STRING | Creation datetime. Example: "2020-04-23T23:00:00.000000+00:00". |
| `updated` | STRING | Last update datetime. Example: "2020-04-23T23:00:00.000000+00:00". |

### Authorization Journeys

A Pix Pull Subscription can be authorized through four journeys, selected via the subscription type. Each journey has a receiver-side and a payer-side communication flow:

1st journey — Push notification (type "push")

2nd journey — QR Code (type "qrcode")

3rd journey — QR Code with authorization upon payment (type "qrcodeAndPayment")

4th journey — Billing QR Code with authorization offer (type "paymentAndOrQrcode")

### Rules & Limits

The Pix Pull Subscription ecosystem follows a set of rules regarding cycle intervals, payment scheduling and settlement. Understanding these rules is essential for designing a payment flow aligned with your business needs.

Interval Cycle

Subscriptions are structured around a well-defined billing cycle, set by the receiver. Supported intervals: week, month, quarter, semester, year. Only one automatic debit can be settled per cycle, and the behavior depends on the date of the first installment.

Rule 1: weekly cycles are based on the weekday - if the first cycle starts on a Tuesday, it ends the following Monday and the second cycle starts the next Tuesday.
Rule 2: for other intervals the reference is the calendar day - if the first installment is on the 1st of the month, the next cycle starts on the 1st of the following month.
Rule 3: edge case for Rule 2 - if the day is not available in the following month (e.g. February), use the next available date, but the original day remains the reference for future cycles.

Examples

Weekly cycle starting January 27th, 2025: 1st cycle Jan 27 to Feb 2; 2nd cycle Feb 3 to Feb 10; 3rd cycle Feb 11 to Feb 18.
Monthly cycle starting January 31st, 2025: 1st cycle Jan 31 to Feb 28; 2nd cycle Mar 1 to Mar 30; 3rd cycle Mar 31 to Apr 30.
Quarter cycle starting February 5th, 2025: 1st cycle Feb 5 to May 4; 2nd cycle May 5 to Aug 4.
Semester cycle starting March 1st: 1st cycle Mar 1 to Aug 31; 2nd cycle Sep 1 to Feb 27 (2026).
Year cycle starting July 21st: 1st cycle Jul 21 to Jul 20 (2026); 2nd cycle Jul 21 (2026) to Jul 20 (2027).

Note: as the receiver, you do not need to request payment on the first day of the cycle - it can be triggered on any day before the cycle ends. For example, a monthly subscription starting on March 1st can have its second installment charged anytime between April 1st and April 30th.

Amount Limits

The receiver may define a fixed or variable charge amount.

Fixed: the payer authorizes the exact value for automatic debit.
Variable: the payer sets a maximum amount, and the receiver can define a minimum limit for what the payer is allowed to approve.

In addition, the payer's bank is required to establish general maximum charge limits for Pix Subscription transactions.

Retry Rules for the Receiver Bank

When creating a subscription, you can define whether Pix Pull Request retries are allowed. If enabled, retries follow these rules:

Rule 1: you may retry the payment one day before the expected settlement date (initial requests require a two-day lead).
Rule 2: a maximum of 3 retries within 7 days of the original payment date.
Rule 3: retry attempts must use the same amount as the original request.
Rule 4: you cannot retry within a new cycle window.

Example: a request scheduled for December 4th may be retried on up to 3 different days between December 5th and 11th, as long as those days do not overlap with a new cycle.

### The Pix Pull Subscription Status

You can use asynchronous Webhooks to monitor status changes. A Pix Pull Subscription follows this life cycle:

| Status | Description |
| --- | --- |
| Created | The subscription was created in Stark Infra. |
| Pending | The subscription was delivered to the payer PSP and awaits the payer's answer. |
| Failed | The subscription was not accepted by the payer PSP. |
| Denied | The subscription was denied by the payer. |
| Approved | The subscription was approved by the payer. |
| Active | The subscription was approved and recognized by Stark Infra; Pix Pull Requests can now be created. |
| Expired | The subscription reached its end date and is no longer active. |
| Canceled | The subscription was canceled (by the payer, receiver or a PSP). |

### The Pix Pull Subscription Logs

Every time we change a Pix Pull Subscription, we create a Log. Logs are useful for understanding its life cycle, and we fire a Webhook whenever a new Log is created. The possible logs:

| Log type | Status | Description |
| --- | --- | --- |
| Created | Created | Created in Stark Infra. |
| Delivering | Created | Sent to the other PSP. |
| Delivered | Pending | Delivered to the payer PSP. |
| Failed | Failed | Not accepted by the payer PSP or a process failure occurred. |
| Approved | Pending | Approved by the payer. |
| Denied | Denied | Denied by the payer or payer PSP. |
| Confirmed | Active | Approved and recognized by Stark Infra. |
| Expired | Expired | Reached its end date. |
| Canceling | Active | Cancellation request sent to the other PSP. |
| Canceled | Canceled | The subscription was canceled. |

### Create Pix Pull Subscriptions

`POST /v2/pix-pull-subscription`

Create recurring Pix authorizations (Pix Automático).

Authorization is obtained through one of four journeys via the subscription type: push (push notification to the payer's bank), qrcode (QR Code with direct authorization), qrcodeAndPayment (QR Code with authorization upon payment), and paymentAndOrQrcode (billing QR Code with an authorization offer).

**Request**

```python
import starkinfra

subscriptions = starkinfra.pixpullsubscription.create([
    starkinfra.PixPullSubscription(
        type="push",
        external_id="my-subscription-id-1",
        bacen_id="RR20220101200181830000000000001",
        reference_code="contract-12345",
        interval="month",
        installment_start="2022-01-01",
        amount=1000,
        receiver_name="Iron Bank S.A.",
        receiver_tax_id="20.018.183/0001-80",
        sender_tax_id="012.345.678-90",
        sender_account_number="00000-0",
        sender_branch_code="0001",
        tags=["automatic", "pix"]
    )
])

for subscription in subscriptions:
    print(subscription)
```

**Response**

```python
[
    PixPullSubscription(
        id="5656565656565656",
        bacen_id="RR20220101200181830000000000001",
        amount=1000,
        amount_min_limit=0,
        interval="month",
        description="",
        reference_code="contract-12345",
        installment_start="2022-01-01T00:00:00+00:00",
        installment_end="",
        due="",
        pull_retry_limit=3,
        type="push",
        external_id="my-subscription-id-1",
        receiver_name="Iron Bank S.A.",
        receiver_tax_id="20.018.183/0001-80",
        receiver_bank_code="20018183",
        sender_tax_id="012.345.678-90",
        sender_account_number="00000-0",
        sender_branch_code="0001",
        sender_bank_code="00000000",
        sender_final_name="",
        sender_final_tax_id="",
        sender_city_code="",
        status="created",
        tags=["automatic", "pix"],
        flow="out",
        created="2022-01-01T00:00:00+00:00",
        updated="2022-01-01T00:00:00+00:00"
    )
]
```

### List Pix Pull Subscriptions

`GET /v2/pix-pull-subscription`

List and filter all Pix pull subscriptions. Results are paged.

**Request**

```python
import starkinfra

subscriptions = starkinfra.pixpullsubscription.query(
    limit=10,
    status="active"
)

for subscription in subscriptions:
    print(subscription)
```

**Response**

```python
PixPullSubscription(
    id="5656565656565656",
    bacen_id="RR20220101200181830000000000001",
    amount=1000,
    amount_min_limit=0,
    interval="month",
    description="",
    reference_code="contract-12345",
    installment_start="2022-01-01T00:00:00+00:00",
    installment_end="",
    due="",
    pull_retry_limit=3,
    type="push",
    external_id="my-subscription-id-1",
    receiver_name="Iron Bank S.A.",
    receiver_tax_id="20.018.183/0001-80",
    receiver_bank_code="20018183",
    sender_tax_id="012.345.678-90",
    sender_account_number="00000-0",
    sender_branch_code="0001",
    sender_bank_code="00000000",
    sender_final_name="",
    sender_final_tax_id="",
    sender_city_code="",
    status="active",
    tags=["automatic", "pix"],
    flow="out",
    created="2022-01-01T00:00:00+00:00",
    updated="2022-01-02T00:00:00+00:00"
)
```

### Get a Pix Pull Subscription

`GET /v2/pix-pull-subscription/:id`

Get a single Pix pull subscription by its id.

**Request**

```python
import starkinfra

subscription = starkinfra.pixpullsubscription.get("5656565656565656")

print(subscription)
```

**Response**

```python
PixPullSubscription(
    id="5656565656565656",
    bacen_id="RR20220101200181830000000000001",
    amount=1000,
    amount_min_limit=0,
    interval="month",
    description="",
    reference_code="contract-12345",
    installment_start="2022-01-01T00:00:00+00:00",
    installment_end="",
    due="",
    pull_retry_limit=3,
    type="push",
    external_id="my-subscription-id-1",
    receiver_name="Iron Bank S.A.",
    receiver_tax_id="20.018.183/0001-80",
    receiver_bank_code="20018183",
    sender_tax_id="012.345.678-90",
    sender_account_number="00000-0",
    sender_branch_code="0001",
    sender_bank_code="00000000",
    sender_final_name="",
    sender_final_tax_id="",
    sender_city_code="",
    status="active",
    tags=["automatic", "pix"],
    flow="out",
    created="2022-01-01T00:00:00+00:00",
    updated="2022-01-02T00:00:00+00:00"
)
```

### Update a Pix Pull Subscription

`PATCH /v2/pix-pull-subscription/:id`

Approve, deny or activate a Pix pull subscription. The allowed status transitions depend on whether you are the payer or the receiver.

When confirming a received subscription, include the senderCityCode field.

**Request**

```python
import starkinfra

subscription = starkinfra.pixpullsubscription.update(
    "5656565656565656",
    status="approved",
    sender_city_code="3550308"
)

print(subscription)
```

**Response**

```python
PixPullSubscription(
    id="5656565656565656",
    bacen_id="RR20220101200181830000000000001",
    amount=1000,
    amount_min_limit=0,
    interval="month",
    description="",
    reference_code="contract-12345",
    installment_start="2022-01-01T00:00:00+00:00",
    installment_end="",
    due="",
    pull_retry_limit=3,
    type="push",
    external_id="my-subscription-id-1",
    receiver_name="Iron Bank S.A.",
    receiver_tax_id="20.018.183/0001-80",
    receiver_bank_code="20018183",
    sender_tax_id="012.345.678-90",
    sender_account_number="00000-0",
    sender_branch_code="0001",
    sender_bank_code="00000000",
    sender_final_name="",
    sender_final_tax_id="",
    sender_city_code="3550308",
    status="approved",
    tags=["automatic", "pix"],
    flow="out",
    created="2022-01-01T00:00:00+00:00",
    updated="2022-01-02T00:00:00+00:00"
)
```

### Cancel a Pix Pull Subscription

`DELETE /v2/pix-pull-subscription/:id`

Cancel a Pix pull subscription.

**Request**

```python
import starkinfra

subscription = starkinfra.pixpullsubscription.cancel("5656565656565656")

print(subscription)
```

**Response**

```python
PixPullSubscription(
    id="5656565656565656",
    bacen_id="RR20220101200181830000000000001",
    amount=1000,
    amount_min_limit=0,
    interval="month",
    description="",
    reference_code="contract-12345",
    installment_start="2022-01-01T00:00:00+00:00",
    installment_end="",
    due="",
    pull_retry_limit=3,
    type="push",
    external_id="my-subscription-id-1",
    receiver_name="Iron Bank S.A.",
    receiver_tax_id="20.018.183/0001-80",
    receiver_bank_code="20018183",
    sender_tax_id="012.345.678-90",
    sender_account_number="00000-0",
    sender_branch_code="0001",
    sender_bank_code="00000000",
    sender_final_name="",
    sender_final_tax_id="",
    sender_city_code="",
    status="canceled",
    tags=["automatic", "pix"],
    flow="out",
    created="2022-01-01T00:00:00+00:00",
    updated="2022-01-03T00:00:00+00:00"
)
```

### List Pix Pull Subscription Logs

`GET /v2/pix-pull-subscription/log`

Get a paged list of all Pix pull subscription logs.

**Request**

```python
import starkinfra

logs = starkinfra.pixpullsubscription.log.query(
    limit=10,
    types=["approved"]
)

for log in logs:
    print(log)
```

**Response**

```python
Log(
    id="6767676767676767",
    subscription=PixPullSubscription(
        id="5656565656565656",
        bacen_id="RR20220101200181830000000000001",
        amount=1000,
        amount_min_limit=0,
        interval="month",
        description="",
        reference_code="contract-12345",
        installment_start="2022-01-01T00:00:00+00:00",
        installment_end="",
        due="",
        pull_retry_limit=3,
        type="push",
        external_id="my-subscription-id-1",
        receiver_name="Iron Bank S.A.",
        receiver_tax_id="20.018.183/0001-80",
        receiver_bank_code="20018183",
        sender_tax_id="012.345.678-90",
        sender_account_number="00000-0",
        sender_branch_code="0001",
        sender_bank_code="00000000",
        sender_final_name="",
        sender_final_tax_id="",
        sender_city_code="",
        status="approved",
        tags=["automatic", "pix"],
        flow="out",
        created="2022-01-01T00:00:00+00:00",
        updated="2022-01-02T00:00:00+00:00"
    ),
    type="approved",
    errors=[],
    reason="",
    created="2022-01-02T00:00:00+00:00"
)
```

### Get a Pix Pull Subscription Log

`GET /v2/pix-pull-subscription/log/:id`

Get a single Pix pull subscription log by its id.

**Request**

```python
import starkinfra

log = starkinfra.pixpullsubscription.log.get("6767676767676767")

print(log)
```

**Response**

```python
Log(
    id="6767676767676767",
    subscription=PixPullSubscription(
        id="5656565656565656",
        bacen_id="RR20220101200181830000000000001",
        amount=1000,
        amount_min_limit=0,
        interval="month",
        description="",
        reference_code="contract-12345",
        installment_start="2022-01-01T00:00:00+00:00",
        installment_end="",
        due="",
        pull_retry_limit=3,
        type="push",
        external_id="my-subscription-id-1",
        receiver_name="Iron Bank S.A.",
        receiver_tax_id="20.018.183/0001-80",
        receiver_bank_code="20018183",
        sender_tax_id="012.345.678-90",
        sender_account_number="00000-0",
        sender_branch_code="0001",
        sender_bank_code="00000000",
        sender_final_name="",
        sender_final_tax_id="",
        sender_city_code="",
        status="approved",
        tags=["automatic", "pix"],
        flow="out",
        created="2022-01-01T00:00:00+00:00",
        updated="2022-01-02T00:00:00+00:00"
    ),
    type="approved",
    errors=[],
    reason="",
    created="2022-01-02T00:00:00+00:00"
)
```

## Pix Pull Request Overview

A Pix Pull Request is a single charge issued against an active Pix Pull Subscription (Pix Automático), pulling a payment from the payer's account.

Here we will show you how to create and manage them.

### The Pix Pull Request Object

**Parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` | STRING | Unique id for the Pix pull request. |
| `amount` | INTEGER | Amount in cents to be pulled. |
| `description` | STRING | Description of the pull request. |
| `due` | STRING | Due datetime for the pull. |
| `endToEndId` | STRING | End-to-end id of the Pix pull request. |
| `reconciliationId` | STRING | Reconciliation id (txid) of the pull. |
| `subscriptionId` | STRING | Id of the Pix pull subscription this request belongs to. |
| `subscriptionBacenId` | STRING | Central Bank id of the related subscription. |
| `receiverName` | STRING | Name of the receiver (creditor). |
| `receiverTaxId` | STRING | CPF or CNPJ of the receiver. |
| `receiverBankCode` | STRING | Bank ISPB code of the receiver. |
| `receiverAccountNumber` | STRING | Account number of the receiver. |
| `receiverBranchCode` | STRING | Branch code of the receiver's account. |
| `receiverAccountType` | STRING | Type of the receiver's account. |
| `senderTaxId` | STRING | CPF or CNPJ of the payer (debtor). |
| `senderBankCode` | STRING | Bank ISPB code of the payer. |
| `senderFinalName` | STRING | Name of the final payer, when different from the account holder. |
| `senderFinalTaxId` | STRING | CPF or CNPJ of the final payer, when different from the account holder. |
| `attemptType` | STRING | Pull attempt type. Options: "default", "scheduledRetry", "instantRetry". |
| `tags` | LIST OF STRINGS | Tags associated with the Pix pull request. |
| `flow` | STRING | Direction of the pull request. Options: "out" (you are the receiver), "in" (you are the payer). |
| `status` | STRING | Current status. Options: "created", "processing", "scheduled", "denied", "success", "failed", "canceled", "expired". |
| `created` | STRING | Creation datetime. Example: "2020-04-23T23:00:00.000000+00:00". |
| `updated` | STRING | Last update datetime. Example: "2020-04-23T23:00:00.000000+00:00". |

### Receiving a Pix Pull Request

In this section we will show you how to receive and handle a Pix Pull Request as the payer bank.

### Rules & Limits

The Pix Pull Request ecosystem follows a set of rules regarding cycle intervals, payment scheduling and settlement. Understanding these rules is essential for designing a payment flow aligned with your business needs.

Scheduling

Once cycles and limits are defined, schedule the Pix Pull Request. To receive a payment on a specific date, the request must be sent 2 to 10 days before the expected settlement.

Example: to receive funds on July 14th, the request must be made between July 4th and July 12th.

Retry Rules for the Payer Bank

When a Pix Pull Request is successfully created, the payer's bank must attempt settlement in at least two time windows:

First attempt: between 00h00 and 08h00.
Second attempt: between 18h00 and 21h00.

Note: after 21:00, settlement attempts are no longer accepted by Stark Infra. A webhook is triggered if the automatic debit fails.

### The Pix Pull Request Status

You can use asynchronous Webhooks to monitor status changes. A Pix Pull Request follows this life cycle:

| Status | Description |
| --- | --- |
| Created | The Pix Pull Request was created in Stark Infra. |
| Processing | The request was delivered to the payer PSP. |
| Scheduled | The request was scheduled by the payer PSP. |
| Denied | The request was denied by the payer PSP. |
| Success | The request was settled. |
| Failed | The request was unsuccessful. |
| Canceled | The request was canceled. |
| Expired | The request expired. |

### The Pix Pull Request Logs

Every time we change a Pix Pull Request, we create a Log. Logs are useful for understanding its life cycle, and we fire a Webhook whenever a new Log is created. The possible logs:

| Log type | Status | Description |
| --- | --- | --- |
| Created | Created | Created in Stark Infra. |
| Sent | Processing | Delivered to the payer PSP. |
| Scheduled | Scheduled | Scheduled by the payer PSP. |
| Denied | Denied | Denied by the payer PSP. |
| Success | Success | The request was settled. |
| Canceling | Scheduled | Cancellation requested. |
| Canceled | Canceled | The request was canceled. |
| Expired | Expired | The request expired. |

### Create Pix Pull Requests

`POST /v2/pix-pull-request`

Issue charges against active Pix pull subscriptions.

As the receiver bank, create a Pix Pull Request to instruct a debit from the payer's account on a scheduled date. Stark Infra verifies that the subscription is approved, the amount is within the authorized limit, the settlement date matches the subscription's charge cycle, payer/receiver details match the contract, the request is made between 10 and 2 days before settlement, and there is no other scheduled request for the same cycle.

**Request**

```python
import starkinfra

requests = starkinfra.pixpullrequest.create([
    starkinfra.PixPullRequest(
        subscription_id="5656565656565656",
        amount=1000,
        due="2022-02-01T00:00:00+00:00",
        attempt_type="default",
        end_to_end_id="E20018183202201010000000000001",
        reconciliation_id="txid1234567890",
        receiver_account_number="00000-0",
        receiver_account_type="checking",
        tags=["automatic", "pix"]
    )
])

for request in requests:
    print(request)
```

**Response**

```python
[
    PixPullRequest(
        id="4646464646464646",
        amount=1000,
        description="",
        due="2022-02-01T00:00:00+00:00",
        end_to_end_id="E20018183202201010000000000001",
        reconciliation_id="txid1234567890",
        subscription_id="5656565656565656",
        subscription_bacen_id="RR20220101200181830000000000001",
        receiver_name="Iron Bank S.A.",
        receiver_tax_id="20.018.183/0001-80",
        receiver_bank_code="20018183",
        receiver_account_number="00000-0",
        receiver_branch_code="0001",
        receiver_account_type="checking",
        sender_tax_id="012.345.678-90",
        sender_bank_code="00000000",
        sender_final_name="",
        sender_final_tax_id="",
        attempt_type="default",
        tags=["automatic", "pix"],
        flow="out",
        status="created",
        created="2022-01-15T00:00:00+00:00",
        updated="2022-01-15T00:00:00+00:00"
    )
]
```

### List Pix Pull Requests

`GET /v2/pix-pull-request`

List and filter all Pix pull requests. Results are paged.

**Request**

```python
import starkinfra

requests = starkinfra.pixpullrequest.query(
    limit=10,
    subscription_ids=["5656565656565656"]
)

for request in requests:
    print(request)
```

**Response**

```python
PixPullRequest(
    id="4646464646464646",
    amount=1000,
    description="",
    due="2022-02-01T00:00:00+00:00",
    end_to_end_id="E20018183202201010000000000001",
    reconciliation_id="txid1234567890",
    subscription_id="5656565656565656",
    subscription_bacen_id="RR20220101200181830000000000001",
    receiver_name="Iron Bank S.A.",
    receiver_tax_id="20.018.183/0001-80",
    receiver_bank_code="20018183",
    receiver_account_number="00000-0",
    receiver_branch_code="0001",
    receiver_account_type="checking",
    sender_tax_id="012.345.678-90",
    sender_bank_code="00000000",
    sender_final_name="",
    sender_final_tax_id="",
    attempt_type="default",
    tags=["automatic", "pix"],
    flow="out",
    status="success",
    created="2022-01-15T00:00:00+00:00",
    updated="2022-02-01T00:00:00+00:00"
)
```

### Get a Pix Pull Request

`GET /v2/pix-pull-request/:id`

Get a single Pix pull request by its id.

**Request**

```python
import starkinfra

request = starkinfra.pixpullrequest.get("4646464646464646")

print(request)
```

**Response**

```python
PixPullRequest(
    id="4646464646464646",
    amount=1000,
    description="",
    due="2022-02-01T00:00:00+00:00",
    end_to_end_id="E20018183202201010000000000001",
    reconciliation_id="txid1234567890",
    subscription_id="5656565656565656",
    subscription_bacen_id="RR20220101200181830000000000001",
    receiver_name="Iron Bank S.A.",
    receiver_tax_id="20.018.183/0001-80",
    receiver_bank_code="20018183",
    receiver_account_number="00000-0",
    receiver_branch_code="0001",
    receiver_account_type="checking",
    sender_tax_id="012.345.678-90",
    sender_bank_code="00000000",
    sender_final_name="",
    sender_final_tax_id="",
    attempt_type="default",
    tags=["automatic", "pix"],
    flow="out",
    status="success",
    created="2022-01-15T00:00:00+00:00",
    updated="2022-02-01T00:00:00+00:00"
)
```

### Update a Pix Pull Request

`PATCH /v2/pix-pull-request/:id`

Schedule or deny a Pix pull request. Only the payer may update a pull request.

**Request**

```python
import starkinfra

request = starkinfra.pixpullrequest.update(
    "4646464646464646",
    status="denied",
    reason="senderAccountClosed"
)

print(request)
```

**Response**

```python
PixPullRequest(
    id="4646464646464646",
    amount=1000,
    description="",
    due="2022-02-01T00:00:00+00:00",
    end_to_end_id="E20018183202201010000000000001",
    reconciliation_id="txid1234567890",
    subscription_id="5656565656565656",
    subscription_bacen_id="RR20220101200181830000000000001",
    receiver_name="Iron Bank S.A.",
    receiver_tax_id="20.018.183/0001-80",
    receiver_bank_code="20018183",
    receiver_account_number="00000-0",
    receiver_branch_code="0001",
    receiver_account_type="checking",
    sender_tax_id="012.345.678-90",
    sender_bank_code="00000000",
    sender_final_name="",
    sender_final_tax_id="",
    attempt_type="default",
    tags=["automatic", "pix"],
    flow="in",
    status="denied",
    created="2022-01-15T00:00:00+00:00",
    updated="2022-01-16T00:00:00+00:00"
)
```

### Cancel a Pix Pull Request

`DELETE /v2/pix-pull-request/:id`

Cancel a Pix pull request.

**Request**

```python
import starkinfra

request = starkinfra.pixpullrequest.cancel(
    "4646464646464646",
    reason="senderAccountClosed"
)

print(request)
```

**Response**

```python
PixPullRequest(
    id="4646464646464646",
    amount=1000,
    description="",
    due="2022-02-01T00:00:00+00:00",
    end_to_end_id="E20018183202201010000000000001",
    reconciliation_id="txid1234567890",
    subscription_id="5656565656565656",
    subscription_bacen_id="RR20220101200181830000000000001",
    receiver_name="Iron Bank S.A.",
    receiver_tax_id="20.018.183/0001-80",
    receiver_bank_code="20018183",
    receiver_account_number="00000-0",
    receiver_branch_code="0001",
    receiver_account_type="checking",
    sender_tax_id="012.345.678-90",
    sender_bank_code="00000000",
    sender_final_name="",
    sender_final_tax_id="",
    attempt_type="default",
    tags=["automatic", "pix"],
    flow="out",
    status="canceled",
    created="2022-01-15T00:00:00+00:00",
    updated="2022-01-16T00:00:00+00:00"
)
```

### List Pix Pull Request Logs

`GET /v2/pix-pull-request/log`

Get a paged list of all Pix pull request logs.

**Request**

```python
import starkinfra

logs = starkinfra.pixpullrequest.log.query(
    limit=10,
    types=["success"]
)

for log in logs:
    print(log)
```

**Response**

```python
Log(
    id="5757575757575757",
    request=PixPullRequest(
        id="4646464646464646",
        amount=1000,
        description="",
        due="2022-02-01T00:00:00+00:00",
        end_to_end_id="E20018183202201010000000000001",
        reconciliation_id="txid1234567890",
        subscription_id="5656565656565656",
        subscription_bacen_id="RR20220101200181830000000000001",
        receiver_name="Iron Bank S.A.",
        receiver_tax_id="20.018.183/0001-80",
        receiver_bank_code="20018183",
        receiver_account_number="00000-0",
        receiver_branch_code="0001",
        receiver_account_type="checking",
        sender_tax_id="012.345.678-90",
        sender_bank_code="00000000",
        sender_final_name="",
        sender_final_tax_id="",
        attempt_type="default",
        tags=["automatic", "pix"],
        flow="out",
        status="success",
        created="2022-01-15T00:00:00+00:00",
        updated="2022-02-01T00:00:00+00:00"
    ),
    type="success",
    errors=[],
    reason="",
    description="The Pix Pull Request was settled.",
    created="2022-02-01T00:00:00+00:00"
)
```

### Get a Pix Pull Request Log

`GET /v2/pix-pull-request/log/:id`

Get a single Pix pull request log by its id.

**Request**

```python
import starkinfra

log = starkinfra.pixpullrequest.log.get("5757575757575757")

print(log)
```

**Response**

```python
Log(
    id="5757575757575757",
    request=PixPullRequest(
        id="4646464646464646",
        amount=1000,
        description="",
        due="2022-02-01T00:00:00+00:00",
        end_to_end_id="E20018183202201010000000000001",
        reconciliation_id="txid1234567890",
        subscription_id="5656565656565656",
        subscription_bacen_id="RR20220101200181830000000000001",
        receiver_name="Iron Bank S.A.",
        receiver_tax_id="20.018.183/0001-80",
        receiver_bank_code="20018183",
        receiver_account_number="00000-0",
        receiver_branch_code="0001",
        receiver_account_type="checking",
        sender_tax_id="012.345.678-90",
        sender_bank_code="00000000",
        sender_final_name="",
        sender_final_tax_id="",
        attempt_type="default",
        tags=["automatic", "pix"],
        flow="out",
        status="success",
        created="2022-01-15T00:00:00+00:00",
        updated="2022-02-01T00:00:00+00:00"
    ),
    type="success",
    errors=[],
    reason="",
    description="The Pix Pull Request was settled.",
    created="2022-02-01T00:00:00+00:00"
)
```

---

## Other Languages

- [Python](https://docs.starkinfra.com/get-started/pix-automatico-python.md)
- [Node.js](https://docs.starkinfra.com/get-started/pix-automatico-node.md)
- [PHP](https://docs.starkinfra.com/get-started/pix-automatico-php.md)
- [Java](https://docs.starkinfra.com/get-started/pix-automatico-java.md)
- [Ruby](https://docs.starkinfra.com/get-started/pix-automatico-ruby.md)
- [Elixir](https://docs.starkinfra.com/get-started/pix-automatico-elixir.md)
- [.NET](https://docs.starkinfra.com/get-started/pix-automatico-dotnet.md)
- [Go](https://docs.starkinfra.com/get-started/pix-automatico-go.md)
- [Clojure](https://docs.starkinfra.com/get-started/pix-automatico-clojure.md)
- [cURL](https://docs.starkinfra.com/get-started/pix-automatico-curl.md)
