# Operations (/docs/sdks/csharp/operations)



## Overview [#overview]

This guide covers the operations available through the Insion SDK, including moderating and ingesting records, managing users, retrieving stored resources, pagination, and appeals.

Every method accepts optional `RequestOptions` and `CancellationToken`.

## Shared models [#shared-models]

### Record [#record]

| Property      | Required        | Purpose                                            |
| ------------- | --------------- | -------------------------------------------------- |
| `ClientId`    | Yes             | Your stable record identifier.                     |
| `Name`        | Yes             | A human-readable record title.                     |
| `Entity`      | Yes             | The record kind, such as `post` or `comment`.      |
| `Content`     | Yes             | Text, or structured content with text and URLs.    |
| `ClientUrl`   | No              | A link to the record in your application.          |
| `Metadata`    | No              | Serializable application context.                  |
| `User`        | No              | The user associated with the record.               |
| `Passthrough` | Moderation only | Moderate without retaining record or user content. |

### User [#user]

| Property          | Required | Purpose                                                   |
| ----------------- | -------- | --------------------------------------------------------- |
| `ClientId`        | Yes      | Your stable identifier for the user.                      |
| `ClientUrl`       | No       | A link to the user in your application.                   |
| `StripeAccountId` | No       | The user's connected Stripe account ID.                   |
| `Email`           | No       | The user's email address.                                 |
| `Name`            | No       | The user's display name.                                  |
| `Username`        | No       | The user's handle in your application.                    |
| `Protected`       | No       | Prevent automated moderation actions from affecting them. |
| `Metadata`        | No       | Serializable application context stored with the user.    |

### Identifiers and pagination [#identifiers-and-pagination]

<Callout type="info" title="Client IDs and Insion IDs">
  A client ID is supplied by your application, while an Insion ID is generated by Insion.
</Callout>

| Value                            | Source             | Used for                               |
| -------------------------------- | ------------------ | -------------------------------------- |
| `ClientId`                       | Your application   | Ingesting, moderating, and deleting.   |
| `RecordId`                       | Returned by Insion | Retrieving a record.                   |
| `UserId`                         | Returned by Insion | Retrieving users and creating appeals. |
| `StartingAfter` / `EndingBefore` | Returned by Insion | Moving through list results.           |

Use only one cursor direction in a list request.

## Ingest a record [#ingest-a-record]

```csharp
var queued = await client.IngestARecordAsync(new RecordInput
{
    ClientId = "post-123", Name = "A post", Entity = "post", Content = "Hello",
});
```

Use `IngestARecordAsync` for asynchronous moderation. It returns a message, record ID, nullable moderation ID, and optional user ID.

<Callout type="info">
  The final moderation outcome arrives through webhooks.
</Callout>

## Moderate a record [#moderate-a-record]

```csharp
var result = await client.ModerateARecordAsync(new ModerateRequest
{
    ClientId = "post-123", Name = "A post", Entity = "post", Content = "Hello world",
    Metadata = new Dictionary<string, object> { ["source"] = "community" },
});
```

Use `ModerateARecordAsync` when the caller needs a decision before continuing. It creates or updates the record and returns record ID, status, moderation ID, optional user ID, message, deprecated flagged value, and category IDs.

<Callout type="warn">
  Setting `Passthrough = true` evaluates the content without retaining record or user content.
</Callout>

## Delete a record [#delete-a-record]

```csharp
var deleted = await client.DeleteARecordAsync(new DeleteApiV1IngestRequest { ClientId = "post-123" });
```

Use `DeleteARecordAsync` when content no longer exists in your application. It expects your client ID and returns a success response.

## List records [#list-records]

```csharp
var page = await client.ListRecordsAsync(new GetApiV1RecordsRequest { Limit = 100, Entity = "post" });
```

Use `ListRecordsAsync` for review queues, audits, and filtered searches by client ID, Insion user ID, entity, or status. Use only one cursor direction; pages contain `Data` and `HasMore`.

## Retrieve a record [#retrieve-a-record]

```csharp
var record = (await client.RetrieveARecordAsync(
    new GetApiV1RecordsRecordIdRequest { RecordId = "rec_123" }
)).Data;
```

Use `RetrieveARecordAsync` for one known Insion record ID. The record contains identifiers, URL, name/entity, protection/moderation state, metadata, timestamps, and user ID.

## Ingest a user [#ingest-a-user]

```csharp
var created = await client.IngestAUserAsync(new UserInput { ClientId = "user-42", Email = "person@example.com" });
```

Use `IngestAUserAsync` to create or update a user independently of a record. It returns the Insion user ID used by later filters, retrieval, and appeals.

## List users [#list-users]

```csharp
var users = await client.ListUsersAsync(new GetApiV1UsersRequest { Limit = 50 });
```

Use `ListUsersAsync` for review queues and filtered searches by client ID, email, action status, or Insion user ID.

## Retrieve a user [#retrieve-a-user]

```csharp
var user = (await client.RetrieveAUserAsync(
    new GetApiV1UsersUserIdRequest { UserId = "usr_123" }
)).Data;
```

Use `RetrieveAUserAsync` for one known Insion user ID. User data includes profile/protection fields, metadata, timestamps, action state, and appeal URL.

## Create an appeal [#create-an-appeal]

```csharp
var appeal = await client.CreateAnAppealAsync(new PostApiV1UsersUserIdCreateAppealRequest
{
    UserId = "usr_123", Text = "Please review this decision.",
});
```

Use `CreateAnAppealAsync` after an eligible suspended user requests a review. The request contains an Insion user ID, and appeals must be enabled. The response includes appeal/action state, timestamps, and nullable appeal URL.
