# Create activity
You can create an activity. You can also set up any custom attribute of your choice. If a specified custom attribute doesn't exist yet it will be created.
POST
/activities/
Attributes | Type | Required | Description |
---|---|---|---|
custom_id | string | no | The unique identifier for the activity which is provided by the client. |
activity_type | integer | yes | A unique identifier of any activity type given by User.com automatically. |
assigned_to | integer | no | A unique identifier for the agent which is given by User.com automatically. |
company_id | integer | no | A unique identifier for the company which is given by User.com automatically. |
deal_id | integer | no | A unique identifier for the deal which is given by User.com automatically. |
description | string | no | A description of the activity. |
done | boolean | no | A flag informing if the activity is finished or not. |
due_date | string | yes | A date in the future by which the task should be completed. Compliance with ISO 8601 standard format. |
duration | integer | no | A time needed to complete the activity. |
name | string | yes | The main title of the activity. |
user_id | integer | no | A unique identifier for the user which is given by User.com automatically. |
# Request
- CURL
- JavaScript
- PHP
- Python
curl -X POST -H "Authorization: Token <your_64_char_api_key>"
-H "Accept: */*; version=2" -H "Content-Type: application/json" -d '{
"activity_type": 25946,
"name": "My new activity",
"datetime": "2017-07-25T14:14:08.612000Z"
}' "https://<your_app_subdomain>.user.com/api/public/activities/"
# Response
{
"id": 1200,
"activity_type": 1,
"name": "string",
"datetime": "2019-08-24T14:15:22Z",
"duration": 2147483648,
"description": "string",
"assigned_to": 1,
"deal": 0,
"person": 0,
"company": 0,
"done": true,
"done_date": "2019-08-24T14:15:22Z",
"created_by": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"custom_id": "my_custom_id"
}