# Referral Campaigns

## Get Campaigns

<mark style="color:blue;">`GET`</mark> `https://api.sparkloop.app/v2/campaigns`

Returns all of your campaigns. At the moment you're only allowed to have one campaign per Sparkloop account.

{% tabs %}
{% tab title="200 Campaigns successfully retrieved." %}

```json
{ 
  "campaigns": [
    <Campaign Object>,
    <Campaign Object>,
    <Campaign Object>
  ]
}
```

{% endtab %}

{% tab title="401 " %}
{% tabs %}
{% tab title="Missing API key" %}

```
{ "error": "API key is missing!" }
```

{% endtab %}

{% tab title="User not found for API key" %}

```
{ "error": "User not found!" }
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Get Campaign

<mark style="color:blue;">`GET`</mark> `https://api.sparkloop.app/v2/campaigns/:identifier`

Returns a campaign.

#### Path Parameters

| Name                                         | Type   | Description                               |
| -------------------------------------------- | ------ | ----------------------------------------- |
| identifier<mark style="color:red;">\*</mark> | string | Campaign's UUID, for example MF9a78983d1c |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| X-Api-Key<mark style="color:red;">\*</mark> | string | API key     |

{% tabs %}
{% tab title="200 " %}

```json
{ 
  "campaign": <Campaign Object>
}
```

{% endtab %}

{% tab title="401 " %}
{% tabs %}
{% tab title="Missing API key" %}

```
{ "error": "API key is missing!" }
```

{% endtab %}

{% tab title="User not found for API key" %}

```
{ "error": "User not found!" }
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="404 " %}

```
{ "error": "Campaign MF9a78983d1c not found!"}
```

{% endtab %}
{% endtabs %}

## Update Campaign

<mark style="color:orange;">`PUT`</mark> `https://api.sparkloop.app/v2/campaigns/:identifier`

Updates the campaign

#### Path Parameters

| Name                                         | Type   | Description                               |
| -------------------------------------------- | ------ | ----------------------------------------- |
| identifier<mark style="color:red;">\*</mark> | string | Campaign's UUID, for example MF9a78983d1c |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| X-Api-Key<mark style="color:red;">\*</mark> | string | API key     |

#### Request Body

| Name | Type   | Description     |
| ---- | ------ | --------------- |
| name | string | Campaign's name |

{% tabs %}
{% tab title="200 " %}

```json
{
  "campaign": <Campaign Object>
}
```

{% endtab %}

{% tab title="401 " %}
{% tabs %}
{% tab title="Missing API key" %}

```
{ "error": "API key is missing!" }
```

{% endtab %}

{% tab title="User not found for API key" %}

```
{ "error": "User not found!" }
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="404 " %}

```
{ "error": "Campaign MF9a78983d1c not found!"}
```

{% endtab %}
{% endtabs %}
