Actions

For instructions on how to authenticate to use this endpoint, see API overview.

List all actions

Required API key scopes

action:read

Path parameters

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Query parameters

  • format
    string
    One of: "csv""json"
  • limit
    integer

    Number of results to return per page.

  • offset
    integer

    The initial index from which to return the results.

Response


Request

GET /api/projects/:project_id/actions
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/actions/

Response

Status 200
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": 0,
"name": "string",
"description": "string",
"tags": [
null
],
"post_to_slack": true,
"slack_message_format": "string",
"steps": [
{
"event": "string",
"properties": [
{
"property1": null,
"property2": null
}
],
"selector": "string",
"tag_name": "string",
"text": "string",
"text_matching": "contains",
"href": "string",
"href_matching": "contains",
"url": "string",
"url_matching": "contains"
}
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {
"property1": null,
"property2": null
}
},
"deleted": true,
"is_calculating": true,
"last_calculated_at": "2019-08-24T14:15:22Z",
"team_id": 0,
"is_action": true,
"bytecode_error": "string",
"pinned_at": "2019-08-24T14:15:22Z",
"creation_context": "string"
}
]
}

Create actions

Required API key scopes

action:write

Path parameters

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • name
    string
  • description
    string
  • tags
    array
  • post_to_slack
    boolean
  • slack_message_format
    string
  • steps
    Click to open
    array
  • deleted
    boolean
  • last_calculated_at
    string
  • pinned_at
    string

Response


Request

POST /api/projects/:project_id/actions
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/actions/\
-d name="string"

Response

Status 201
RESPONSE
{
"id": 0,
"name": "string",
"description": "string",
"tags": [
null
],
"post_to_slack": true,
"slack_message_format": "string",
"steps": [
{
"event": "string",
"properties": [
{
"property1": null,
"property2": null
}
],
"selector": "string",
"tag_name": "string",
"text": "string",
"text_matching": "contains",
"href": "string",
"href_matching": "contains",
"url": "string",
"url_matching": "contains"
}
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {
"property1": null,
"property2": null
}
},
"deleted": true,
"is_calculating": true,
"last_calculated_at": "2019-08-24T14:15:22Z",
"team_id": 0,
"is_action": true,
"bytecode_error": "string",
"pinned_at": "2019-08-24T14:15:22Z",
"creation_context": "string"
}

Retrieve actions

Required API key scopes

action:read

Path parameters

  • id
    integer

    A unique integer value identifying this action.

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Query parameters

  • format
    string
    One of: "csv""json"

Response


Request

GET /api/projects/:project_id/actions/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/actions/:id/

Response

Status 200
RESPONSE
{
"id": 0,
"name": "string",
"description": "string",
"tags": [
null
],
"post_to_slack": true,
"slack_message_format": "string",
"steps": [
{
"event": "string",
"properties": [
{
"property1": null,
"property2": null
}
],
"selector": "string",
"tag_name": "string",
"text": "string",
"text_matching": "contains",
"href": "string",
"href_matching": "contains",
"url": "string",
"url_matching": "contains"
}
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {
"property1": null,
"property2": null
}
},
"deleted": true,
"is_calculating": true,
"last_calculated_at": "2019-08-24T14:15:22Z",
"team_id": 0,
"is_action": true,
"bytecode_error": "string",
"pinned_at": "2019-08-24T14:15:22Z",
"creation_context": "string"
}

Update actions

Required API key scopes

action:write

Path parameters

  • id
    integer

    A unique integer value identifying this action.

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • name
    string
  • description
    string
  • tags
    array
  • post_to_slack
    boolean
  • slack_message_format
    string
  • steps
    Click to open
    array
  • deleted
    boolean
  • last_calculated_at
    string
  • pinned_at
    string

Response


Request

PATCH /api/projects/:project_id/actions/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/actions/:id/\
-d name="string"

Response

Status 200
RESPONSE
{
"id": 0,
"name": "string",
"description": "string",
"tags": [
null
],
"post_to_slack": true,
"slack_message_format": "string",
"steps": [
{
"event": "string",
"properties": [
{
"property1": null,
"property2": null
}
],
"selector": "string",
"tag_name": "string",
"text": "string",
"text_matching": "contains",
"href": "string",
"href_matching": "contains",
"url": "string",
"url_matching": "contains"
}
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {
"property1": null,
"property2": null
}
},
"deleted": true,
"is_calculating": true,
"last_calculated_at": "2019-08-24T14:15:22Z",
"team_id": 0,
"is_action": true,
"bytecode_error": "string",
"pinned_at": "2019-08-24T14:15:22Z",
"creation_context": "string"
}

Delete actions

Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true

Required API key scopes

action:write

Path parameters

  • id
    integer

    A unique integer value identifying this action.

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Query parameters

  • format
    string
    One of: "csv""json"

Request

DELETE /api/projects/:project_id/actions/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/actions/:id/

Response

Status 405 No response body

Create actions migrate

Path parameters

  • id
    integer

    A unique integer value identifying this action.

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • name
    string
  • description
    string
  • tags
    array
  • post_to_slack
    boolean
  • slack_message_format
    string
  • steps
    Click to open
    array
  • deleted
    boolean
  • last_calculated_at
    string
  • pinned_at
    string

Response


Request

POST /api/projects/:project_id/actions/:id/migrate
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/actions/:id/migrate/\
-d name="string"

Response

Status 200
RESPONSE
{
"id": 0,
"name": "string",
"description": "string",
"tags": [
null
],
"post_to_slack": true,
"slack_message_format": "string",
"steps": [
{
"event": "string",
"properties": [
{
"property1": null,
"property2": null
}
],
"selector": "string",
"tag_name": "string",
"text": "string",
"text_matching": "contains",
"href": "string",
"href_matching": "contains",
"url": "string",
"url_matching": "contains"
}
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {
"property1": null,
"property2": null
}
},
"deleted": true,
"is_calculating": true,
"last_calculated_at": "2019-08-24T14:15:22Z",
"team_id": 0,
"is_action": true,
"bytecode_error": "string",
"pinned_at": "2019-08-24T14:15:22Z",
"creation_context": "string"
}

Questions?

Was this page useful?