# Get Campaigns

### Endpoint

```
POST /all-campaigns
```

### Response

```json
{
  "type": "object",
  "properties": {
    "result": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the campaign"
          },
          "banner_url": {
            "type": "string",
            "format": "uri",
            "description": "URL of the banner image shown to users"
          },
          "poster_url": {
            "type": "string",
            "format": "uri",
            "description": "URL of the poster image shown to users"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the campaign was created"
          },
          "created_by": {
            "type": "string",
            "description": "Username of the campaign creator"
          },
          "created_by_publicKey": {
            "type": "string",
            "description": "Public key of the campaign creator"
          },
          "description": {
            "type": "string",
            "description": "Detailed description of the campaign"
          },
          "starts_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the campaign starts"
          },
          "ends_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the campaign ends"
          },
          "fuel_required": {
            "type": "number",
            "description": "Amount of fuel required for participation"
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the campaign is currently active"
          },
          "latitude": {
            "type": "number",
            "description": "Geographical latitude of the campaign center"
          },
          "longitude": {
            "type": "number",
            "description": "Geographical longitude of the campaign center"
          },
          "radius": {
            "type": "number",
            "description": "Radius in kilometers within which the campaign is valid"
          },
          "location_limit_in_meters": {
            "type": "number",
            "description": "Limit in meters for location verification"
          },
          "max_submissions": {
            "type": "integer",
            "description": "Maximum total submissions allowed for the campaign"
          },
          "max_submissions_per_witness": {
            "type": "integer",
            "description": "Maximum submissions allowed per individual witness"
          },
          "submissions": {
            "type": "integer",
            "description": "Current number of submissions received"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Array of tags associated with the campaign"
          },
          "type": {
            "type": "string",
            "enum": ["individual", "group", "task"],
            "description": "Type of campaign"
          },
          "currency": {
            "type": "string",
            "description": "Currency type for rewards"
          },
          "reward_per_task": {
            "type": "number",
            "description": "Amount of reward given per completed task"
          },
          "total_rewards": {
            "type": "number",
            "description": "Total rewards available for the campaign"
          },
          "tasks": {
            "type": "object",
            "description": "For task-type campaigns, contains task definitions",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "description": {
                  "type": "string",
                  "description": "Description of the task"
                },
                "fuel_required": {
                  "type": "number",
                  "description": "Amount of fuel required for this specific task"
                }
              }
            }
          },
          "whitelist": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Array of public keys allowed to participate in this campaign"
          }
        }
      }
    }
  }
}
```

### Example Response

```json
{
  "result": [
    {
      "banner_url": "https://truesnap.s3.us-east-1.amazonaws.com/horizontal_artistics_eye_for_ai.png",
      "created_at": "2025-01-31T14:53:25.800Z",
      "created_by": "@witnesschain",
      "description": "Get started with the first artistic eye for AI campaign",
      "ends_at": "2025-05-11T14:53:25.800Z",
      "fuel_required": 1,
      "id": "ArtisticEyeForAI",
      "is_active": true,
      "latitude": 40,
      "longitude": -73,
      "max_submissions": 500000,
      "max_submissions_per_witness": 10,
      "poster_url": "https://truesnap.s3.us-east-1.amazonaws.com/2.png",
      "radius": 20000,
      "starts_at": "2025-01-31T14:53:25.800Z",
      "submissions": 110,
      "tags": ["AI", "Art"],
      "type": "individual"
    },
    {
      "banner_url": "https://truesnap.s3.us-east-1.amazonaws.com/6176690776340284330.jpg",
      "created_at": "2025-02-21T06:46:56.833Z",
      "created_by": "@witnesschain",
      "created_by_publicKey": "0x701441ee7150744fb01b7cb8aa5366617451f9f6",
      "currency": "POINTS",
      "description": "Prove your gains",
      "ends_at": "2025-06-01T06:43:37.751Z",
      "fuel_required": 1,
      "id": "ProveYourGains",
      "is_active": true,
      "latitude": 40,
      "location_limit_in_meters": 22000000,
      "longitude": -73,
      "max_submissions": 500000,
      "max_submissions_per_witness": 10,
      "poster_url": "https://truesnap.s3.us-east-1.amazonaws.com/6176690776340284331.jpg",
      "radius": 22000,
      "reward_per_task": 2,
      "starts_at": "2025-02-21T06:40:28.230Z",
      "submissions": 6,
      "tags": ["loss", "gains"],  
      "total_rewards": 10000,
      "type": "individual"
    }
  ]
}  
```

### Example Task-Type Campaign Response

```json
{
  "result": [
    {
      "banner_url": "https://images.wallpapersden.com/image/download/serene-nature-hd-pixel-art-sunset_bmhlZ22UmZqaraWkpJRnamtlrWZpaGo.jpg",
      "created_at": "2025-02-21T13:07:15.584Z",
      "created_by": "@witnesschain",
      "created_by_publicKey": "0xae3c67152ee393082f85e9d59a471b375f3ce406",
      "currency": "POINTS",
      "description": "This is a test campaign for the type \"task\"",
      "ends_at": "2025-03-06T11:33:07.423Z",
      "fuel_required": 1,
      "id": "my-task-campaign",
      "is_active": true,
      "latitude": 13.03,
      "location_limit_in_meters": 1000,
      "longitude": 77.5,
      "max_submissions": 10000,
      "poster_url": "https://placehold.co/180x320",
      "radius": 100,
      "reward_per_task": 1,
      "starts_at": "2025-02-24T11:33:07.423Z",
      "submissions": 7,
      "tags": [],
      "tasks": {
        "task0": {
          "description": "Test task 0. Upload a random picture to test multi-task campaigns",
          "fuel_required": 1
        },
        "task1": {
          "description": "Test task 1. Upload a random picture to test multi-task campaigns",
          "fuel_required": 1
        },
        "task2": {
          "description": "Test task 2. Upload a random picture to test multi-task campaigns",
          "fuel_required": 1
        }
      },
      "total_rewards": 10,
      "type": "task",
      "whitelist": [
        "0x...",
        "0x..."
      ]
    }
  ]
}
```

### Error Codes

| Status Code | Error Code               | Description                                           |
| ----------- | ------------------------ | ----------------------------------------------------- |
| 400         | INVALID\_REQUEST         | Request is malformed or missing required fields       |
| 400         | INVALID\_CAMPAIGN\_TYPE  | Campaign type must be one of: individual, group, task |
| 400         | INVALID\_COORDINATES     | Invalid latitude or longitude values                  |
| 400         | INVALID\_DATE\_RANGE     | End date must be after start date                     |
| 401         | UNAUTHORIZED             | Authentication token is missing or invalid            |
| 403         | FORBIDDEN                | User does not have permission to perform this action  |
| 403         | CAMPAIGN\_LIMIT\_REACHED | User has reached maximum allowed campaigns            |
| 404         | CAMPAIGN\_NOT\_FOUND     | The requested campaign does not exist                 |
| 409         | DUPLICATE\_CAMPAIGN\_ID  | A campaign with this ID already exists                |
| 429         | RATE\_LIMIT\_EXCEEDED    | Too many requests, please try again later             |
| 500         | INTERNAL\_SERVER\_ERROR  | An unexpected error occurred                          |
| 503         | SERVICE\_UNAVAILABLE     | Service is temporarily unavailable                    |

### Response Fields

#### Common Campaign Fields

| Field                  | Type    | Description                             |
| ---------------------- | ------- | --------------------------------------- |
| id                     | string  | Unique identifier for the campaign      |
| banner\_url            | string  | Banner image URL                        |
| poster\_url            | string  | Poster image URL                        |
| created\_at            | string  | Creation timestamp (ISO 8601)           |
| created\_by            | string  | Username of campaign creator            |
| created\_by\_publicKey | string  | Public key of campaign creator          |
| description            | string  | Campaign description                    |
| starts\_at             | string  | Start timestamp (ISO 8601)              |
| ends\_at               | string  | End timestamp (ISO 8601)                |
| is\_active             | boolean | Active status                           |
| type                   | string  | Campaign type (individual, group, task) |
| tags                   | array   | Array of campaign tags                  |
| submissions            | integer | Current submission count                |

#### Location Fields

| Field                       | Type   | Description                   |
| --------------------------- | ------ | ----------------------------- |
| latitude                    | number | Center latitude               |
| longitude                   | number | Center longitude              |
| radius                      | number | Campaign radius in kilometers |
| location\_limit\_in\_meters | number | Location verification limit   |

#### Reward Fields

| Field             | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| currency          | string | Reward currency type            |
| total\_rewards    | number | Total available rewards         |
| reward\_per\_task | number | Reward per completed task       |
| fuel\_required    | number | Required fuel for participation |

#### Task-Type Campaign Fields

| Field     | Type   | Description                         |
| --------- | ------ | ----------------------------------- |
| tasks     | object | Map of task IDs to task definitions |
| whitelist | array  | List of authorized public keys      |


---

# 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.witnesschain.com/infinity-watch/apis/campaign-apis/get-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.
