# Add or Update Activity Purpose

## Add or Update Activity Purpose

<mark style="color:green;">`POST`</mark> `[PlatformAddress]/api/1.0/crm?action=addOrUpdateActivityPurpose`

#### Path Parameters

| Name | Type    | Description                                                                          |
| ---- | ------- | ------------------------------------------------------------------------------------ |
| id   | integer | The unique id of the activity purpose (Leave empty if adding a new activity purpose) |
| name | string  | The name of the event activity purpose (Required when the ID parameter is missing)   |
| type | integer | The type of the event activity purpose (Required when the ID parameter is missing)   |

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

```
{
  "success": true,
  "id": 755
}
```

{% endtab %}
{% endtabs %}

## Activity Purpose Type

| Id | Name      |
| -- | --------- |
| 1  | Account   |
| 2  | Function  |
| 3  | Corporate |
| 4  | Group     |

## Example Request

### Add Activity Purpose

```javascript
{
  "name": "Purpose 1",
  "type": "1",
}
```

### Update Activity Purpose

```javascript
{
  "id": 755,
  "name": "Updated Purpose"
}
```

## Returns

| Property | Description                                   |
| -------- | --------------------------------------------- |
| success  | Whether or not the activity purpose was added |
| id       | The unique id of the activity purpose         |

## Throws

| Code                 | Description                               |
| -------------------- | ----------------------------------------- |
| Specific Code: 24300 | The event activity purpose does not exist |
| Specific Code: 24301 | An error has occurred                     |
| Specific Code: 24302 | The request contains invalid data         |
| Specific Code: 24303 | The request contains invalid data         |

This call takes values for a activity purpose, and either

1. Updates the values for that activity purpose (after you have provided an id in the parameters), or
2. Adds the activity purpose to the system (if the id parameter is missing) 1. The result of this call will contain the status of the result (either

   true or false) and the activity purpose identifier of the updated or newly

   created activity purpose.


---

# 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://developer.ivvy.com/crm/add-or-update-activity-purpose.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.
