NAME

Twilio::Rest::Insights::V3::QueryJob - The QueryJob resource

SYNOPSIS

my $client = Twilio::Rest::Client->new($account_sid, $auth_token);

my $query_job = $client->insights->v3->query_jobs->create(\%body, \%options);
for my $query_job ($client->insights->v3->query_jobs->read({}, 20)) {
  ...
}
my $query_job = $client->insights->v3->query_jobs($operation_id)->fetch;

DESCRIPTION

This file holds QueryJobList, QueryJobPage, QueryJobContext and QueryJobInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

QueryJobList

Returned by $client->insights->v3->query_jobs. See also Twilio::ListResource.

create

my $query_job = $client->insights->v3->query_jobs->create(\%body, \%options);

Submit a long-running semantic query against the Conversations domain. Returns 202 Accepted with an operationId and a Location header pointing to the QueryJobs status endpoint for polling. Returns a QueryJobInstance.

%body is sent as JSON. It takes the names Twilio's API documentation uses.

Its fields are:

domain

The business domain to execute the query against

query

Required. No description in the specification.

The options are:

idempotency_key

A client-generated UUIDv7 key that ensures idempotent behavior. Submitting the same key with an identical request returns the same operation without re-execution. Scoped to Account + Region. Retained for 24 hours.

read

my @records = $client->insights->v3->query_jobs->read(\%options, $limit, $page_size);

Returns a paginated list of asynchronous query operations for the authenticated account. Optionally filter by status. Returns the records as a list, fetching as many pages as it needs.

The options are:

status

The operation status to filter results by. One of PENDING, RUNNING, CANCELLED, COMPLETED or FAILED.

stream

my $stream = $client->insights->v3->query_jobs->stream(\%options, $limit, $page_size);

Takes the same arguments as "read", and returns a Twilio::Stream.

page

my $page = $client->insights->v3->query_jobs->page(\%options, $page_size, $page_token);

Fetches one page, and returns a Twilio::TokenPaginationPage. This API pages by token, so there is no page number.

get_page

my $page = $client->insights->v3->query_jobs->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->insights->v3->query_jobs->get_context($operation_id);

Returns a QueryJobContext, and makes no request.

QueryJobPage

A Twilio::Page of QueryJobInstance objects.

records_key

build_instance

Used by Twilio::Page.

QueryJobContext

Returned by $client->insights->v3->query_jobs($operation_id). It makes no request until one of these methods is called.

fetch

my $query_job = $client->insights->v3->query_jobs($operation_id)->fetch;

Poll the operation status. When status is COMPLETED, the response includes query results inline. When FAILED, the response includes error details conforming to the OperationError schema. Returns a QueryJobInstance.

QueryJobInstance

See also Twilio::InstanceResource.

It has fetch, which work as they do on the context.

Its fields are:

completed_at

The time when the operation reached a terminal state (CANCELLED, COMPLETED, or FAILED), in RFC 3339 UTC format. Null while the operation is still PENDING or RUNNING. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

created_at

The time when the operation was accepted, in RFC 3339 UTC format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

error

The error details, present only when status is FAILED.

operation_id

The unique identifier for the asynchronous query operation, in TTID format.

result_id

The identifier of the results resource, present only when status is COMPLETED. Equal to operationId, since results are keyed by the operation ID.

result_retention_period

The duration for how long results are retained, in ISO 8601 format.

result_url

The URL to retrieve query results, present only when status is COMPLETED. Supports pagination via the pageSize and pageToken query parameters.

status

One of PENDING, RUNNING, CANCELLED, COMPLETED or FAILED.

status_url

The URI to poll for operation status.

CONSTRUCTORS

new

Objects here come from the methods above, so there is no need to call new directly.

LICENSE

Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.