# Corporate Transaction

The Corporate Transaction resource represents each balance shift in your corporate ledger.

Every corporate purchase, corporate withdrawal, corporate invoice payment and billing invoice cashback creates a Corporate Transaction, so you can use this resource to reconcile your corporate balance and understand your corporate statement.

**NOTE:**Corporate Transactions are created by Stark Bank as a consequence of other events. There is no route to create, update or cancel them.

### The Corporate Transaction object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | STRING | Unique id for the corporate transaction. Example: "5656565656565656". |
| `amount` | INTEGER | Corporate Transaction value in cents. It is positive for credits and negative for debits. Example: 1234 (R$12.34). |
| `balance` | INTEGER | Balance amount of the Workspace in cents at the instant of the corporate transaction. Example: 200 (R$2.00). |
| `description` | STRING | Corporate Transaction description. Example: "Buying food". |
| `source` | STRING | Source of the corporate transaction. Example: "corporate-purchase/5656565656565656". |
| `tags` | LIST OF STRINGS | List of strings inherited from the source resource. Example: ["tony", "stark"]. |
| `created` | STRING | Creation datetime. Example: "2020-03-10T10:30:00.000000+00:00". |

### List Corporate Transactions

`GET /v2/corporate-transaction`

Get a list of corporate transactions in chunks of at most 1000. If you need smaller chunks, use the limit parameter.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `after` | OPTIONAL | Filter entities created after this date. |
| `before` | OPTIONAL | Filter entities created before this date. |
| `cursor` | OPTIONAL | String used to get the next batch of results. Our SDKs handle this for you. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |
| `limit` | OPTIONAL | Number of results per cursor. Max = 1000. |
| `source` | OPTIONAL | Filter entities created by a single source resource. Example: "corporate-purchase/5730174175805440" |
| `tags` | OPTIONAL | Filter entities that contain the specified tags. |

**Request**

```python
import starkbank
from datetime import date

transactions = starkbank.corporatetransaction.query(
    after=date(2022, 3, 1),
    before=date(2022, 3, 31),
    limit=10
)

for transaction in transactions:
    print(transaction)
```

**Response**

```python
CorporateTransaction(
    amount=-9000,
    balance=1291000,
    created=2022-03-10 10:30:00.000000,
    description=Pizzaria Dom Domingos,
    id=5155165527080960,
    source=corporate-purchase/5730174175805440,
    tags=['corporate-holder/5484278772695040', 'corporate-card/5673295890087936']
)
```

### Get a Corporate Transaction

`GET /v2/corporate-transaction/:id`

Get a single corporate transaction by its id.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Id of the corporate transaction entity. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |

**Request**

```python
import starkbank

transaction = starkbank.corporatetransaction.get("5155165527080960")

print(transaction)
```

**Response**

```python
CorporateTransaction(
    amount=-9000,
    balance=1291000,
    created=2022-03-10 10:30:00.000000,
    description=Pizzaria Dom Domingos,
    id=5155165527080960,
    source=corporate-purchase/5730174175805440,
    tags=['corporate-holder/5484278772695040', 'corporate-card/5673295890087936']
)
```

## Available Languages

Code samples on this page are in Python. The same content is available with samples in:

- [Python](https://docs.starkbank.com/api/v2/corporate-transaction-python.md)
- [Node.js](https://docs.starkbank.com/api/v2/corporate-transaction-node.md)
- [PHP](https://docs.starkbank.com/api/v2/corporate-transaction-php.md)
- [Java](https://docs.starkbank.com/api/v2/corporate-transaction-java.md)
- [Ruby](https://docs.starkbank.com/api/v2/corporate-transaction-ruby.md)
- [Elixir](https://docs.starkbank.com/api/v2/corporate-transaction-elixir.md)
- [.NET](https://docs.starkbank.com/api/v2/corporate-transaction-dotnet.md)
- [Go](https://docs.starkbank.com/api/v2/corporate-transaction-go.md)
- [Clojure](https://docs.starkbank.com/api/v2/corporate-transaction-clojure.md)
- [cURL](https://docs.starkbank.com/api/v2/corporate-transaction-curl.md)
