# Campaigns

{% hint style="info" %}
**Requirement** You are required to show empowered by RE:DREAMER if you used our protocol in any part of your product.
{% endhint %}

![empowered white](/files/gEjvXfdl8K6iMeRwUzvz) ![empowered black](/files/mYCm6o8AEPxDKrp5SI9G)

## Domain

* Mainnet: `mainnet-api.redreamer.io`
* Testnet: `testnet-api.redreamer.io`

### Request Headers

* \[Required] `Authorization`: `Bearer ${token}`
* \[Required] `X-API-Key`: `${api key}`

> Please contacts RE:DREAMER to get API keys.

## GET /api/v1/passport/:network/campaigns

List valid campaigns by given network.

### Request Parameters

* \[Required] `network`: the network of campaigns

### Query Strings

* \[Optional] `mine`: Boolean

> It will only returns the campaigns created by same creator of API key.

### Response

#### 200

```json
{
  "data": [
    {
      "contract_addresses": [
        "string"
      ],
      "created_at": "2022-05-25T11:53:06.778Z",
      "deleted_at": "2022-05-25T11:53:06.778Z",
      "description": "string",
      "end_time": "2022-05-25T11:53:06.778Z",
      "id": [
        0
      ],
      "image_url": "string",
      "name": "string",
      "network": "string",
      "redeemed_description": "string",
      "start_time": "2022-05-25T11:53:06.778Z",
      "updated_at": "2022-05-25T11:53:06.778Z",
      "validated_description": "string"
    }
  ]
}
```

#### 400, 500

```json
{
  "code": "ERROR_CODE"
}
```

#### Error Code

*

## GET /api/v1/passport/:network/campaigns/:id/nfts

List all available NFTs for given campaign.

### Request Headers

* \[Required] `Authorization`: `Bearer ${token}`
* \[Required] `X-API-Key`: `${api key}`

> Please contacts RE:DREAMER to get API keys.

### Request Paramters

* \[Required] `id`: the campaign id

### Response

#### 200

```json
{
  "data": [
    {
      "animation_url": "string",
      "attributes": [
        {}
      ],
      "contract_address": "string",
      "created_at": "2022-05-25T11:53:18.066Z",
      "deleted_at": "2022-05-25T11:53:18.066Z",
      "description": "string",
      "external_url": "string",
      "id": "string",
      "image": "string",
      "is_redeemable": true,
      "is_valid": true,
      "name": "string",
      "network": "string",
      "token_id": 0,
      "updated_at": "2022-05-25T11:53:18.066Z"
    }
  ]
}
```

#### 400, 500

```json
{
	"code": "ERROR_CODE"
}
```

#### Error Code

*

## POST /api/v1/passport/:network/campaigns/:id/redeem

Send request to redeem PASSPORT QR code.

### Request Headers

* \[Required] `Authorization`: `Bearer ${token}`

### Request Paramters

* \[Required] `id`: the campaign id

### Request Body

```json
{
	"contract_address": "0xe3f08b6fe26d0057e310185481bb30b02c5aee25",
	"signature": "0x7f9aaea4f0f54eba217a516584e1bf4ed06bdc022f9832ed3062ee6f345e89ed6bef86f6e769a8a272b0cbed55f8af663a6e743652878da7b1fda459feb0d9371c",
	"token_id": 5
}
```

* `signature`: sign the message with the format below

```
campaign_id:${campaign_id},contract_address:${contract_address},token_id:${token_id}
```

### Response

#### 200

```json
{
  "after_redeemed": 0,
  "created_at": "2022-05-25T11:53:41.016Z",
  "qr_code": "string",
  "redeemed_description": "string",
  "validated_description": "string"
}
```

* `after_redeemed`:
  * `0`: User want to present PASSPORT QR code.
  * `1`: User do not want to present PASSPORT QR code.
  * `2`: User want to present text only.
* `qr_code`: PASSPORT QR code content.
* `redeemed_description`: User want to present this message after PASSPORT QR code is presenting.
* `validated_description`: User want to present this message after this PASSPORT QR code is validated by validator.

#### 400, 500

```json
{
	"code": "ERROR_CODE"
}
```

#### Error Code

*

### Information

Posted: **May 25, 2022**


---

# 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-2022.redreamer.io/re-dreamer-labs-product/redeem-passport/campaigns.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.
