# Issuing Withdrawal

The Issuing Withdrawal resource is used to transfer funds from your issuing balance back to your main balance.

Use withdrawals to move excess funds from your issuing wallet to your regular Stark Infra account.

### The Issuing Withdrawal object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | STRING | Unique identifier for the issuing withdrawal. |
| `amount` | INTEGER | Amount in cents to be withdrawn. Example: 10000 (R$100.00). |
| `externalId` | STRING | Your unique identifier for this withdrawal. Must be unique per workspace to prevent duplicates. |
| `description` | STRING | Description of the withdrawal. |
| `tags` | LIST OF STRINGS | Tags associated with the withdrawal. |
| `transactionId` | STRING | Id of the bank transaction linked to this withdrawal. |
| `issuingTransactionId` | STRING | Id of the issuing transaction linked to this withdrawal. |
| `created` | STRING | Creation datetime. Example: "2022-01-01T00:00:00.000000+00:00". |
| `updated` | STRING | Last update datetime. Example: "2022-01-01T00:00:00.000000+00:00". |

### Create an Issuing Withdrawal

`POST /v2/issuing-withdrawal`

Use this route to create a new issuing withdrawal and move funds from your issuing balance.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `amount` | REQUIRED | Amount in cents to withdraw. The minimum is 0, so any non-negative amount is accepted. Example: 10000 (R$100.00). |
| `externalId` | REQUIRED | Your unique identifier for this withdrawal, used to prevent duplicates. Example: "withdrawal-2024-001". |
| `description` | REQUIRED | Description of the withdrawal purpose. |
| `tags` | OPTIONAL | Array of strings to tag the entity for future queries. |

**Request**

```python
import starkinfra

withdrawal = starkinfra.issuingwithdrawal.create(
    starkinfra.IssuingWithdrawal(
        amount=10000,
        external_id="withdrawal-2022-001",
        description="Excess funds withdrawal",
        tags=["tony", "stark"]
    )
)

print(withdrawal)
```

**Response**

```python
IssuingWithdrawal(
    id=5715709195239424,
    amount=10000,
    external_id=withdrawal-2022-001,
    description=Excess funds withdrawal,
    tags=['tony', 'stark'],
    transaction_id=6724771005489152,
    issuing_transaction_id=7834882116598271,
    created=2022-01-01 00:00:00,
    updated=2022-01-01 00:00:00
)
```

### List Issuing Withdrawals

`GET /v2/issuing-withdrawal`

Get a list of issuing withdrawals in chunks of at most 100.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `limit` | OPTIONAL | Number of results per cursor. Max = 100. |
| `cursor` | OPTIONAL | String used to get the next batch of results. Our SDKs handle this for you. |
| `after` | OPTIONAL | Filter entities created after this date. |
| `before` | OPTIONAL | Filter entities created before this date. |
| `tags` | OPTIONAL | Filter entities that contain the specified tags. |
| `externalIds` | OPTIONAL | List of strings to get specific entities by their external ids. |

**Request**

```python
import starkinfra

withdrawals = starkinfra.issuingwithdrawal.query(
    limit=10,
    after="2022-01-01",
    before="2022-12-31",
    tags=["tony", "stark"]
)

for withdrawal in withdrawals:
    print(withdrawal)
```

**Response**

```python
IssuingWithdrawal(
    id=5715709195239424,
    amount=10000,
    external_id=withdrawal-2022-001,
    description=Excess funds withdrawal,
    tags=['tony', 'stark'],
    transaction_id=6724771005489152,
    issuing_transaction_id=7834882116598271,
    created=2022-01-01 00:00:00,
    updated=2022-01-01 00:00:00
)
```

### Get an Issuing Withdrawal

`GET /v2/issuing-withdrawal/:id`

Get a single issuing withdrawal by its id.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Id of the issuing withdrawal entity. |

**Request**

```python
import starkinfra

withdrawal = starkinfra.issuingwithdrawal.get("5715709195239424")

print(withdrawal)
```

**Response**

```python
IssuingWithdrawal(
    id=5715709195239424,
    amount=10000,
    external_id=withdrawal-2022-001,
    description=Excess funds withdrawal,
    tags=['tony', 'stark'],
    transaction_id=6724771005489152,
    issuing_transaction_id=7834882116598271,
    created=2022-01-01 00:00:00,
    updated=2022-01-01 00:00:00
)
```

## Available Languages

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

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