# 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](https://404850448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdDk4AHKGlMLAZPnf2hJ6%2Fuploads%2Fgit-blob-a3abbbcf5d962d5d3e023b94ddb4605b9d5f8ab9%2Fempowered_white.png?alt=media) ![empowered black](https://404850448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdDk4AHKGlMLAZPnf2hJ6%2Fuploads%2Fgit-blob-62d97745c570b2d5b1e2b8a045587597af1e9b3d%2Fempowered_black.png?alt=media)

## 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**
