Ingest a record
Create or update a record for asynchronous moderation.
Use ingestARecord to store a record and queue moderation instead of waiting for an immediate decision. Moderation results are delivered through the webhook events configured for your organization; do not interpret the ingest response itself as a final moderation decision.
let response = try await client.ingestARecord(request: .init(
clientId: "post-123",
clientUrl: "https://example.com/posts/123",
name: "Product update",
entity: "post",
content: .contentExternalUrls(.init(
text: "Read the full update.",
imageUrls: ["https://cdn.example.com/launch.png"]
)),
metadata: ["source": .string("ios")],
user: .init(clientId: "author-7", username: "alex")
))
print(response.id)
print(response.message)Signature and input
func ingestARecord(
request: IngestRecordRequest,
requestOptions: RequestOptions? = nil
) async throws -> IngestRecordResponseIngestRecordRequest requires clientId, name, entity, and content. It also accepts optional clientUrl, metadata, and user. The fields have the same meanings as the synchronous moderation request, except this model has no passthrough field. Reuse a clientId intentionally to update the same record; generate a new one for a distinct record.
Result and follow-up
The response contains a confirmation message, Insion record id, moderation, and optional user. moderation is Nullable<String> because it can be null when moderation was not queued. Preserve the record ID for retrieval and use webhook events as the authoritative asynchronous result.
An accepted ingest call can still have no queued moderation ID, so do not build a workflow that assumes moderation always contains a string. If your product must make a decision before continuing, use Moderate a record instead.