> 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.

# Updatemotivationcode

PUT https://prod-api.raisedonors.com/api/MotivationCode/{id}
Content-Type: application/json

Reference: https://virtuous.ferndocs.com/reference/raise/motivation-code/updatemotivationcode

## Authentication

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

## Request

### Path parameters

- `id` (long, required)

### Body (application/json)

This endpoint expects a MotivationCodeRequest.

- `name` (string, required)
- `code` (string, required)
- `mediaType` (enum, optional, nullable)
  - Allowed values: `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`
- `siteUrl` (string, optional, nullable)
- `description` (string, optional, nullable)
- `zipCodes` (string, optional, nullable)
- `price` (double, optional, nullable)
- `cost` (double, optional, nullable)
- `sortOrder` (integer, optional, nullable)
- `pin` (boolean, optional)
- `groups` (list of MotivationCodeGroupRequest, optional, nullable)

## Response

### 200

OK

- `id` (long, optional, nullable)
- `name` (string, optional, nullable)
- `code` (string, optional, nullable)
- `mediaType` (enum, optional, nullable)
  - Allowed values: `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`
- `siteUrl` (string, optional, nullable)
- `description` (string, optional, nullable)
- `zipCodes` (string, optional, nullable)
- `price` (double, optional, nullable)
- `cost` (double, optional, nullable)
- `sortOrder` (integer, optional, nullable)
- `pin` (boolean, optional)
- `groups` (list of MotivationCodeGroupModel, optional, nullable)

## Errors

### 400 Bad Request Error

Bad Request

- `MotivationCode_UpdateMotivationCodeRequestBadRequestError`
  - ProblemDetails: ProblemDetails
  - HttpValidationProblemDetails: HttpValidationProblemDetails

## Types

### MotivationCodeGroupRequest

- `id` (long, optional)

### MotivationCodeGroupModel

- `id` (long, optional)
- `name` (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": "Holiday Donation Campaign",
  "code": "HOLIDAY2024"
}
```

**Response**

```json
{
  "id": 1,
  "name": "Holiday Donation Campaign",
  "code": "HOLIDAY2024",
  "mediaType": 3,
  "siteUrl": "https://www.raisedonors.com/holiday-campaign",
  "description": "Special motivation code for the 2024 holiday fundraising campaign.",
  "zipCodes": "10001,10002,10003",
  "price": 50,
  "cost": 30,
  "sortOrder": 10,
  "pin": true,
  "groups": [
    {
      "id": 101,
      "name": "Winter Fundraisers"
    }
  ]
}
```

**SDK Code**

```python
import requests

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

payload = {
    "name": "Holiday Donation Campaign",
    "code": "HOLIDAY2024"
}
headers = {
    "Authorization": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://prod-api.raisedonors.com/api/MotivationCode/1';
const options = {
  method: 'PUT',
  headers: {Authorization: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Holiday Donation Campaign","code":"HOLIDAY2024"}'
};

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/MotivationCode/1"

	payload := strings.NewReader("{\n  \"name\": \"Holiday Donation Campaign\",\n  \"code\": \"HOLIDAY2024\"\n}")

	req, _ := http.NewRequest("PUT", 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/MotivationCode/1")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Holiday Donation Campaign\",\n  \"code\": \"HOLIDAY2024\"\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.put("https://prod-api.raisedonors.com/api/MotivationCode/1")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Holiday Donation Campaign\",\n  \"code\": \"HOLIDAY2024\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://prod-api.raisedonors.com/api/MotivationCode/1', [
  'body' => '{
  "name": "Holiday Donation Campaign",
  "code": "HOLIDAY2024"
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://prod-api.raisedonors.com/api/MotivationCode/1");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Holiday Donation Campaign\",\n  \"code\": \"HOLIDAY2024\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Holiday Donation Campaign",
  "code": "HOLIDAY2024"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://prod-api.raisedonors.com/api/MotivationCode/1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```