---
title: "Create an activity"
method: POST
path: "/activities"
tags: ["Activities"]
---

# Create an activity

`POST /activities`

Creates a record of a customer having performed a given action.

## Request body

- object
  - `activity` union, required
    - object
      - `token` string, required — A token identifying the activity that was performed.
      - `distinct_id` string — A unique identifier for the activity in the external system (e.g. the order number).
      - `created_on_origin_at` string, date-time — The date and time the activity was performed by the customer in the external system (e.g. when the action actually occurred, which is often earlier than when the activity is created in Smile).
      - `customer_id` integer, required — The ID of the customer who performed the activity. Required if `customer_email` is not provided.
    - object
      - `token` string, required — A token identifying the activity that was performed.
      - `distinct_id` string — A unique identifier for the activity in the external system (e.g. the order number).
      - `created_on_origin_at` string, date-time — The date and time the activity was performed by the customer in the external system (e.g. when the action actually occurred, which is often earlier than when the activity is created in Smile).
      - `customer_email` string, email, required — The email of the customer who performed the activity. Required if `customer_id` is not provided.

## Response `201`

The activity was successfully created.

- object
  - `activity` Activity
    - `id` integer — Unique identifier for the activity.
    - `customer_id` integer — The ID of the customer who performed the activity.
    - `token` string — A token identifying the activity that was performed.
    - `distinct_id` string, nullable — A unique identifier for the activity in the external system (e.g. the order number).
    - `created_on_origin_at` string, date-time, nullable — The date and time the activity was performed by the customer in the external system (e.g. when the action actually occurred, which is often earlier than when the activity is created in Smile).
    - `created_at` string, date-time — The date and time when the activity was created.
    - `updated_at` string, date-time — The date and time when the activity was last updated.

---

[API](https://skmtc.dev/smile/apis/smile-io-rest-api.md) · [All operations](https://skmtc.dev/smile/apis/smile-io-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/smile/smile-io-rest-api/revisions/081bc804c5df/schema)
