> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://virtuous.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://virtuous.ferndocs.com/_mcp/server.

# Create a new campaign.

POST https://prod-api.raisedonors.com/api/Campaign
Content-Type: application/json

Reference: https://virtuous.ferndocs.com/reference/raise/campaign/createcampaign

## Authentication

- `Authorization` header (required) — JWT Authorization header using the Bearer scheme. Example: "Authorization: Bearer \{token}"

## Request

### Body (application/json)

This endpoint expects a CampaignRequest.

- `name` (string, required)
- `startDate` (datetime, required)
- `endDate` (datetime, required)
- `description` (string, optional, nullable)
- `startDateTimeUtc` (datetime, optional)
- `endDateTimeUtc` (datetime, optional)
- `givingGoal` (double, optional)
- `hasGivingGoal` (boolean, optional)
- `totalGiftGoal` (integer, optional)
- `hasTotalGiftGoal` (boolean, optional)
- `averageGiftGoal` (double, optional)
- `hasAverageGiftGoal` (boolean, optional)
- `crmKey` (string, optional, nullable)
- `crmKeys` (map from string to string, optional, nullable)
- `applySegmentToRecurringGifts` (boolean, optional)
- `canSync` (boolean, optional)
- `segments` (list of SegmentRequest, optional, nullable)

## Response

### 200

OK

- `id` (long, optional) — Gets or sets the identifier.
- `name` (string, optional, nullable) — Gets or sets the name.
- `description` (string, optional, nullable) — Gets or sets the description.
- `startDate` (string, optional, nullable) — Gets or sets the start date.
- `endDate` (string, optional, nullable) — Gets or sets the end date.
- `duration` (string, optional, nullable) — Gets or sets the duration.
- `canSync` (boolean, optional) — Gets or sets the can sync.
- `crmKey` (string, optional, nullable) — Gets or sets the crmkey.
- `crmKeyUrls` (map from string to CrmUrlInfo, optional, nullable) — CRM URLs for this campaign grouped by integration type.
- `applySegmentToRecurringGifts` (boolean, optional) — Gets or sets the apply segment to recurring gifts.
- `givingGoal` (double, optional) — The giving goal for the campaign in the organization base currency.
- `givingGoalFormatted` (string, optional, nullable) — The giving goal formatted for display in the organization currency (for example "$10,000.00").
- `hasGivingGoal` (boolean, optional) — Gets or sets the has giving goal.
- `raisedAmount` (string, optional, nullable) — Gets or sets the raised amount.
- `raisedPercentage` (double, optional) — Percentage of the giving goal that has been raised (0–100).
- `totalGiftGoal` (integer, optional) — Gets or sets the total gift goal.
- `hasTotalGiftGoal` (boolean, optional) — Gets or sets the has total gift goal.
- `totalGifts` (integer, optional) — Gets or sets the total gifts.
- `totalGiftsPercentage` (double, optional) — Percentage of the gift count goal that has been reached (0–100).
- `totalDonors` (integer, optional) — Gets or sets the total donors.
- `averageGiftGoal` (double, optional) — The target average gift amount in the organization base currency.
- `averageGiftGoalFormatted` (string, optional, nullable) — The target average gift amount formatted for display (for example "$100.00").
- `averageGiftAmount` (string, optional, nullable) — The actual average gift amount formatted for display.
- `hasAverageGiftGoal` (boolean, optional) — Gets or sets the has average gift goal.
- `totalVisitors` (integer, optional) — Gets or sets the total visitors.
- `conversionRate` (string, optional, nullable) — The conversion rate for the campaign formatted as a percentage string (for example "12.3%").
- `createdDateTime` (string, optional, nullable) — Gets or sets the created date time.
- `modifiedDateTime` (string, optional, nullable) — Gets or sets the modified date time.

## Errors

### 400 Bad Request Error

Bad Request

- `Campaign_CreateCampaignRequestBadRequestError`
  - ProblemDetails: ProblemDetails
  - HttpValidationProblemDetails: HttpValidationProblemDetails

## Types

### SegmentRequest

- `campaignId` (long, required)
- `name` (string, required)
- `code` (string, required)
- `description` (string, optional, nullable)
- `externalIdentifier` (string, optional, nullable)

### CrmUrlInfo

- `crmKey` (string, optional, nullable)
- `url` (string, optional, nullable)

### ProblemDetails

- `type` (string, optional, nullable)
- `title` (string, optional, nullable)
- `status` (integer, optional, nullable)
- `detail` (string, optional, nullable)
- `instance` (string, optional, nullable)

### HttpValidationProblemDetails

- `detail` (string, optional, nullable)
- `errors` (map from string to list of string, optional, nullable)
- `instance` (string, optional, nullable)
- `status` (integer, optional, nullable)
- `title` (string, optional, nullable)
- `type` (string, optional, nullable)

## Examples

**Request**

```json
{
  "name": "Spring Fundraiser 2024",
  "startDate": "2024-04-01T08:00:00Z",
  "endDate": "2024-06-30T23:59:59Z"
}
```

**Response**

```json
{
  "id": 1024,
  "name": "Spring Fundraiser 2024",
  "description": "Annual spring campaign to support community outreach programs.",
  "startDate": "2024-04-01T08:00:00Z",
  "endDate": "2024-06-30T23:59:59Z",
  "duration": "3 months",
  "canSync": true,
  "crmKey": "SF2024-CAMPAIGN",
  "crmKeyUrls": {},
  "applySegmentToRecurringGifts": true,
  "givingGoal": 50000,
  "givingGoalFormatted": "$50,000.00",
  "hasGivingGoal": true,
  "raisedAmount": "$12,500.00",
  "raisedPercentage": 25,
  "totalGiftGoal": 200,
  "hasTotalGiftGoal": true,
  "totalGifts": 50,
  "totalGiftsPercentage": 25,
  "totalDonors": 45,
  "averageGiftGoal": 250,
  "averageGiftGoalFormatted": "$250.00",
  "averageGiftAmount": "$250.00",
  "hasAverageGiftGoal": true,
  "totalVisitors": 1200,
  "conversionRate": "3.8%",
  "createdDateTime": "2024-03-01T12:00:00Z",
  "modifiedDateTime": "2024-03-15T15:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://prod-api.raisedonors.com/api/Campaign"

payload = {
    "name": "Spring Fundraiser 2024",
    "startDate": "2024-04-01T08:00:00Z",
    "endDate": "2024-06-30T23:59:59Z"
}
headers = {
    "Authorization": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://prod-api.raisedonors.com/api/Campaign';
const options = {
  method: 'POST',
  headers: {Authorization: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Spring Fundraiser 2024","startDate":"2024-04-01T08:00:00Z","endDate":"2024-06-30T23:59:59Z"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://prod-api.raisedonors.com/api/Campaign"

	payload := strings.NewReader("{\n  \"name\": \"Spring Fundraiser 2024\",\n  \"startDate\": \"2024-04-01T08:00:00Z\",\n  \"endDate\": \"2024-06-30T23:59:59Z\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://prod-api.raisedonors.com/api/Campaign")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Spring Fundraiser 2024\",\n  \"startDate\": \"2024-04-01T08:00:00Z\",\n  \"endDate\": \"2024-06-30T23:59:59Z\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://prod-api.raisedonors.com/api/Campaign")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Spring Fundraiser 2024\",\n  \"startDate\": \"2024-04-01T08:00:00Z\",\n  \"endDate\": \"2024-06-30T23:59:59Z\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://prod-api.raisedonors.com/api/Campaign', [
  'body' => '{
  "name": "Spring Fundraiser 2024",
  "startDate": "2024-04-01T08:00:00Z",
  "endDate": "2024-06-30T23:59:59Z"
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://prod-api.raisedonors.com/api/Campaign");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Spring Fundraiser 2024\",\n  \"startDate\": \"2024-04-01T08:00:00Z\",\n  \"endDate\": \"2024-06-30T23:59:59Z\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Spring Fundraiser 2024",
  "startDate": "2024-04-01T08:00:00Z",
  "endDate": "2024-06-30T23:59:59Z"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://prod-api.raisedonors.com/api/Campaign")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```