# Pull Requests

## Create a card asynchronously

## Create a pull request.

<mark style="color:green;">`POST`</mark> `https://api.walleo.io/partners/v1/pull_requests`

Creates a new pull request.

#### Request Body

| Name                                               | Type    | Description                 |
| -------------------------------------------------- | ------- | --------------------------- |
| amount<mark style="color:red;">\*</mark>           | Integer | The amount of the gift card |
| gift\_card\_code<mark style="color:red;">\*</mark> | String  | The code of the gift card   |
| request\_id<mark style="color:red;">\*</mark>      | String  | Request ID of pull request  |

#### Response

{% tabs %}
{% tab title="200: OK Pull request created" %}

```json
{
  "pull_request": {
    "id": "3db15189-ef10-49b4-8265-58e3fe946ffb",
    "status": "waiting",
    "request_id": "your_request_id",
    "amount_cents": 5000,
    "created_at": "2024-02-05T11:33:39.999+01:00",
    "updated_at": "2024-02-05T11:33:39.999+01:00",
    "card": null
  }
}
```

{% endtab %}
{% endtabs %}

#### Errors

{% tabs %}
{% tab title="404: Not Found Gift card not found" %}

```json
{
  "errors": [
    {
      "code": "gift_card_not_found",
      "message": "Gift card not found with code 'IKEA-FR'"
    }
  ],
  "status": "not_found"
}
```

{% endtab %}

{% tab title="422: Unprocessable Entity Not enough funds" %}

```json
{
  "errors": [                       
    {
      "code": "not_enough_funds",            
      "message": "Your balance account is not high enough" 
    }                                            
  ],                                             
  "status": "unprocessable_entity"               
}
```

{% endtab %}

{% tab title="422: Unprocessable Entity Out of stock" %}

```json
{
  "errors": [                       
    {
      "code": "out_of_stock",            
      "message": "Out of stock gift card 'IKEA-FR'" 
    }                                            
  ],                                             
  "status": "unprocessable_entity"               
}
```

{% endtab %}

{% tab title="422: Unprocessable Entity Invalid amount (sku doesn't exist)" %}

```json
{
  "errors": [                       
    {
      "code": "invalid_amount",            
      "message": "Amount must be one of 15, 30 or 100." 
    }                                            
  ],                                             
  "status": "unprocessable_entity"               
}
```

{% endtab %}

{% tab title="422: Unprocessable Entity Invalid amount (invalid range)" %}

```json
{
  "errors": [                       
    {
      "code": "invalid_amount",            
      "message": "Amount must be within range from 20 to 500 with steps of 10." 
    }                                            
  ],                                             
  "status": "unprocessable_entity"               
}
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized" %}

```json
{
  "errors": [
    {
      "code": "unauthorized",
      "message": "Not authorized"
    }
  ],
  "status": "unauthorized"
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid signature" %}

```json
{
  "errors": [
    {
      "code": "invalid_signature",
      "message": "Your request does not match your signature"
    }
  ],
  "status": "unauthorized"
}
```

{% endtab %}

{% tab title="422: Unprocessable Entity Request ID already used" %}

```json
{
  "errors": [                       
    {
      "code": "unprocessable_entity",            
      "message": "Request id is already used" 
    }                                            
  ],                                             
  "status": "unprocessable_entity"               
}
```

{% endtab %}
{% endtabs %}

## Show pull request

## Show pull request.

<mark style="color:blue;">`GET`</mark> `https://api.walleo.io/partners/v1/pull_requests/:request_id`

Show pull request details.

#### Path Parameters

| Name                                          | Type   | Description                |
| --------------------------------------------- | ------ | -------------------------- |
| request\_id<mark style="color:red;">\*</mark> | String | Request ID of pull request |

#### Response

{% tabs %}
{% tab title="200: OK Pull request successfully found" %}

```json
{
  "pull_request": {
    "id": "3db15189-ef10-49b4-8265-58e3fe946ffb",
    "status": "success",
    "request_id": "your_request_id",
    "created_at": "2024-02-05T11:33:39.999+01:00",
    "updated_at": "2024-02-05T11:33:41.488+01:00",
    "card": {
      "id": "4fe88e46-eb22-436c-91ec-6bf874fcf2ae",
      "code": "345454545451154154",
      "expire_at": "2022-06-24T00:00:00.000+02:00",
      "pin_code": "1234",
      "amount": 50,
      "gift_card_code": "IKEA",
      "pdf_url": "https://url.pdf"
    }
  }
}
```

{% endtab %}
{% endtabs %}

#### Errors

{% tabs %}
{% tab title="404: Not Found Pull request not found" %}

```json
{
  "errors": [
    {
      "code": "pull_request_not_found",
      "message": "Pull request not found with request_id: REQ-ID-TEST"
    }
  ],
  "status": "not_found"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.walleo.io/partners-api/api-reference/pull-requests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
