InsionInsion
PHP

Operations

Complete PHP guide to records, users, pagination, and appeals

Overview

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

All methods accept an optional final options array.

Shared models

Record

Array keyRequiredPurpose
clientIdYesYour stable record identifier.
nameYesA human-readable record title.
entityYesThe record kind, such as post or comment.
contentYesText, or ContentExternalUrls with text and URLs.
clientUrlNoA link to the record in your application.
metadataNoSerializable application context.
userNoThe user associated with the record.
passthroughModeration onlyModerate without retaining record or user content.

User

Array keyRequiredPurpose
clientIdYesYour stable identifier for the user.
clientUrlNoA link to the user in your application.
stripeAccountIdNoThe user's connected Stripe account ID.
emailNoThe user's email address.
nameNoThe user's display name.
usernameNoThe user's handle in your application.
protectedNoPrevent automated moderation actions from affecting them.
metadataNoSerializable application context stored with the user.

Identifiers and pagination

Client IDs and Insion IDs

A client ID is supplied by your application, while an Insion ID is generated by Insion.

ValueSourceUsed for
clientIdYour applicationIngesting, moderating, and deleting.
recordIdReturned by InsionRetrieving a record.
userIdReturned by InsionRetrieving users and creating appeals.
startingAfter / endingBeforeReturned by InsionMoving through list results.

Use only one cursor direction in a list request.

Ingest a record

$queued = $client->ingestARecord(new RecordInput([
    'clientId' => 'post-123', 'name' => 'A post', 'entity' => 'post', 'content' => 'Hello',
]));

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

The final moderation outcome arrives through webhooks.

Moderate a record

$result = $client->moderateARecord(new ModerateRequest([
    'clientId' => 'post-123', 'name' => 'A post', 'entity' => 'post',
    'content' => 'Hello world', 'metadata' => ['source' => 'community'],
]));

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

Setting passthrough in the request array evaluates the content without retaining record or user content.

Delete a record

$deleted = $client->deleteARecord(new DeleteApiV1IngestRequest(['clientId' => 'post-123']));

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

List records

$page = $client->listRecords(new GetApiV1RecordsRequest(['limit' => 100, 'entity' => 'post']));

Use listRecords 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

$record = $client->retrieveARecord('rec_123')?->data;

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

Ingest a user

$created = $client->ingestAUser(new UserInput(['clientId' => 'user-42', 'email' => 'person@example.com']));

Use ingestAUser 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

$users = $client->listUsers(new GetApiV1UsersRequest(['limit' => 50]));

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

Retrieve a user

$user = $client->retrieveAUser('usr_123')?->data;

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

Create an appeal

$appeal = $client->createAnAppeal(
    'usr_123',
    new PostApiV1UsersUserIdCreateAppealRequest(['text' => 'Please review this decision.']),
);

Use createAnAppeal after an eligible suspended user requests a review. The first argument is an Insion user ID, and appeals must be enabled. The response contains appeal/action state, timestamps, and nullable appeal URL.

How is this guide?

On this page

Latest Release

View the PHP SDK on PackagistPHP SDK versionPHP SDK license