---
updatedAt: 2026-07-07T07:30:13.000Z
agentTools:
  projectIndex: https://docs.getembed.ai/llms.txt
---

# Track item interactions

Track user interactions with content items

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Datasources",
    "description": "APIs for managing datasources and ingesting structured data from web3 and social media protocols and apps",
    "version": "3.0.0",
    "contact": {
      "name": "embed Support",
      "email": "support@mbd.xyz"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://mbd.xyz/terms"
    },
    "termsOfService": "https://mbd.xyz/terms"
  },
  "servers": [
    {
      "url": "https://api.mbd.xyz/v3",
      "description": "Production API"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/datasources/{datasource_id}/items/interactions": {
      "post": {
        "summary": "Track item interactions",
        "description": "Track user interactions with content items",
        "operationId": "trackItemInteractions",
        "tags": [
          "Data Ingestion"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/DatasourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Interaction"
                },
                "description": "Array of interactions to track. A single interaction object is also accepted."
              },
              "examples": {
                "user_interaction": {
                  "summary": "User interaction",
                  "value": [
                    {
                      "item_id": "farcaster.0xabc123",
                      "timestamp": 1705312200,
                      "event_type": "like",
                      "user_id": "farcaster.alice123"
                    }
                  ]
                },
                "anonymous_interaction": {
                  "summary": "Anonymous interaction",
                  "value": [
                    {
                      "item_id": "lens.post456",
                      "timestamp": 1705312800,
                      "event_type": "view",
                      "session_id": "sess_anonymous_xyz789"
                    }
                  ]
                },
                "bulk_interactions": {
                  "summary": "Multiple interactions",
                  "value": [
                    {
                      "item_id": "farcaster.0x111",
                      "timestamp": 1705312200,
                      "event_type": "view",
                      "user_id": "farcaster.user1"
                    },
                    {
                      "item_id": "lens.post222",
                      "timestamp": 1705312300,
                      "event_type": "like",
                      "session_id": "sess_web_789"
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Interactions tracked successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestionResponse"
                },
                "example": {
                  "message": "Data ingested successfully",
                  "stream_name": "datasource-example.items"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The number of allowed requests in the current period",
                "schema": {
                  "type": "integer",
                  "example": 1000
                }
              },
              "X-RateLimit-Remaining": {
                "description": "The number of remaining requests in the current period",
                "schema": {
                  "type": "integer",
                  "example": 999
                }
              },
              "X-RateLimit-Reset": {
                "description": "The time at which the current rate limit window resets (Unix timestamp)",
                "schema": {
                  "type": "integer",
                  "example": 1609459200
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Console API key. Use `Bearer mbd-{your-api-key}`."
      }
    },
    "parameters": {
      "DatasourceId": {
        "name": "datasource_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^datasource-[a-zA-Z0-9]+-[a-zA-Z0-9]+$",
          "example": "datasource-e07d2ec0-643a"
        },
        "description": "Unique datasource identifier"
      }
    },
    "schemas": {
      "Interaction": {
        "type": "object",
        "description": "An interaction event. Requires `item_id`, `timestamp`, `event_type`, and either `user_id` or `session_id` (at least one must be provided).",
        "required": [
          "item_id",
          "timestamp",
          "event_type"
        ],
        "properties": {
          "item_id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$",
            "example": "farcaster.0xabc123",
            "description": "Format: protocol.protocol_item_id"
          },
          "timestamp": {
            "type": "integer",
            "format": "int64",
            "example": 1705312200,
            "description": "Unix epoch timestamp"
          },
          "event_type": {
            "type": "string",
            "enum": [
              "view",
              "like",
              "comment",
              "share",
              "bookmark"
            ],
            "example": "like",
            "description": "Type of interaction"
          },
          "user_id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$",
            "example": "farcaster.alice123",
            "description": "Format: protocol.protocol_user_id (required if session_id not provided)"
          },
          "session_id": {
            "type": "string",
            "example": "sess_anonymous_xyz789",
            "description": "Session identifier for anonymous users (required if user_id not provided)"
          }
        }
      },
      "IngestionResponse": {
        "type": "object",
        "required": [
          "message",
          "stream_name"
        ],
        "properties": {
          "message": {
            "type": "string",
            "example": "Data ingested successfully",
            "description": "Success message"
          },
          "stream_name": {
            "type": "string",
            "example": "datasource-e07d2ec0-643a.items",
            "description": "Target Kinesis stream name"
          },
          "sequence_number": {
            "type": "string",
            "example": "49610918017569739920569266808940816015796745953697128450",
            "description": "Kinesis sequence number (for single records)"
          },
          "total_records": {
            "type": "integer",
            "example": 3,
            "description": "Total number of records (for bulk operations)"
          },
          "successful_records": {
            "type": "integer",
            "example": 3,
            "description": "Number of successfully processed records (for bulk operations)"
          },
          "failed_records": {
            "type": "integer",
            "example": 0,
            "description": "Number of failed records (for bulk operations)"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Error message"
          },
          "details": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Detailed error information (for validation errors)"
          },
          "debug_info": {
            "type": "object",
            "description": "Debug information (for development)"
          }
        }
      },
      "ValidationErrorResponse": {
        "type": "object",
        "required": [
          "error",
          "details"
        ],
        "properties": {
          "error": {
            "type": "string",
            "example": "Validation failed",
            "description": "Error type"
          },
          "details": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "Missing required field: item_id",
              "Field timestamp should be int, got str"
            ],
            "description": "List of validation errors"
          }
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Unauthorized - invalid or missing API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "missing_auth": {
                "summary": "Missing Authorization header",
                "value": {
                  "error": "Authorization header required"
                }
              },
              "invalid_key": {
                "summary": "Invalid API key",
                "value": {
                  "error": "Invalid API key"
                }
              }
            }
          }
        }
      },
      "ValidationError": {
        "description": "Validation failed",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ValidationErrorResponse"
            },
            "example": {
              "error": "Validation failed",
              "details": [
                "Missing required field: item_id",
                "Field timestamp should be int, got str",
                "Field item_id has invalid format. Expected format: ^[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$"
              ]
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Internal server error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "error": "Internal server error"
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Data Ingestion",
      "description": "Data ingestion operations for items, users, and interactions"
    }
  ],
  "externalDocs": {
    "description": "Complete API Documentation",
    "url": "https://github.com/mbdxyz/data-ingestion-api/blob/main/README.md"
  }
}
```