> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/tposs/6.15/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/tposs/6.15/api-reference/events_api.md).

# Events API

TPOSS Events API allows you to delete a set of [first visit events](https://docs.cennso.com/components/tposs/6.15/configuration/hooks.md#first-network-attachment-event) from the TPOSS database using this RPC method:

- [Event.Delete](#eventdelete) - to delete an event by the given identifier

## API methods

### Event.Delete

The method allows you to delete a set of `First visit` events from the TPOSS database.

You can pass the following parameters in the request:

| Name | Type | Required / Optional | Description |
|---|---|---|---|
| AuthKey | string | required | Pre-shared authentication key. |
| FeId | string | required | Static frontend identifier which must be unique to the system. |
| FeSId | string | optional | Dynamic frontend session identifier which must be reset upon system startup. |
| Events | list | required | List of IMSIs associated with the events to be deleted from TPOSS. |
| EventType | string | required | Type of events to delete. |

Example of the request:

```bash
curl -H "Accept: application/json" -H "Content-Type: application/json" -X POST http://127.0.0.1:12000 --data-binary @- <<EOF
{
  "id": "1",
  "jsonrpc": "2.0",
  "method":"Event.Delete",
  "params": {
    "AuthKey": "secret",
    "FeId":"TPUIBrowser",
    "FeSId": "TPUIBrowser",
    "Events": ["012345678901207", "012345678901217"],
    "EventType": "tposs/network/attachment/first"
  }
}
EOF
```

The API returns the total number of events that arrived in the request and the number of successfully deleted events from the database.

Example of the successful response:

```json
{
  "id": "101",
  "jsonrpc": "2.0",
  "result": {
    "Deleted": 2,
    "Total": 2
  }
}
```

In the case of an error, the response contains the `error` object with an error code and message:

```json
{
  "id": "1",
  "jsonrpc": "2.0",
  "error": {
    "code": "-33333",
    "message": "Not authenticated"
  }
}
```

The following error codes may be returned:

- `-30000` - Required field is missing.
- `-32700` - Can't decode JSON request body.
- `-33333` - Not authenticated.
