NAME
Twilio::Rest::Knowledge::V2::KnowledgeBasis - The KnowledgeBasis resource
SYNOPSIS
my $client = Twilio::Rest::Client->new($account_sid, $auth_token);
my $knowledge_basis = $client->knowledge->v2->knowledge_bases->create(\%body);
for my $knowledge_basis ($client->knowledge->v2->knowledge_bases->read({}, 20)) {
...
}
my $knowledge_basis = $client->knowledge->v2->knowledge_bases($kb_id)->fetch;
$client->knowledge->v2->knowledge_bases($kb_id)->update(\%body, \%options);
$client->knowledge->v2->knowledge_bases($kb_id)->delete;
DESCRIPTION
This file holds KnowledgeBasisList, KnowledgeBasisPage, KnowledgeBasisContext, KnowledgeBasisInstance, CreateKnowledgeBase202ResponseInstance, UpdateKnowledgeBase202ResponseInstance and DeleteKnowledgeBase202ResponseInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.
KnowledgeBasisList
Returned by $client->knowledge->v2->knowledge_bases. See also Twilio::ListResource.
create
my $knowledge_basis = $client->knowledge->v2->knowledge_bases->create(\%body);
Create a new Knowledge Base for the Twilio account. Accounts can have multiple knowledge bases. Each knowledge base can contain multiple knowledge resources such as documents, websites, or text content that can be used for context and information retrieval. Returns a CreateKnowledgeBase202ResponseInstance.
%body is sent as JSON. It takes the names Twilio's API documentation uses.
Its fields are:
description-
A human readable description of this resource, up to 128 characters.
displayName-
Required. Provides a unique and addressable name to be assigned to this Knowledge Base. This name is assigned by the developer and can be used in addition to the ID. It is intended to be human-readable and unique within the account.
read
my @records = $client->knowledge->v2->knowledge_bases->read(\%options, $limit, $page_size);
Get a list of knowledge bases for the Twilio account. Returns the records as a list, fetching as many pages as it needs.
The options are:
order_by-
Either 'ASC' or 'DESC' to sort results ascending or descending respectively. One of
ASCorDESC.
stream
my $stream = $client->knowledge->v2->knowledge_bases->stream(\%options, $limit, $page_size);
Takes the same arguments as "read", and returns a Twilio::Stream.
page
my $page = $client->knowledge->v2->knowledge_bases->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->knowledge->v2->knowledge_bases->get_page($url);
Fetches the page at a URL given by Twilio.
get_context
my $context = $client->knowledge->v2->knowledge_bases->get_context($kb_id);
Returns a KnowledgeBasisContext, and makes no request.
KnowledgeBasisPage
A Twilio::Page of KnowledgeBasisInstance objects.
records_key
build_instance
Used by Twilio::Page.
KnowledgeBasisContext
Returned by $client->knowledge->v2->knowledge_bases($kb_id). It makes no request until one of these methods is called.
fetch
my $knowledge_basis = $client->knowledge->v2->knowledge_bases($kb_id)->fetch;
Retrieve the details of a specific Knowledge Base by its unique ID. Returns a KnowledgeBasisInstance.
update
my $knowledge_basis = $client->knowledge->v2->knowledge_bases($kb_id)->update(\%body, \%options);
Partially update a Knowledge Base. Only the fields provided in the request body will be updated. Returns a UpdateKnowledgeBase202ResponseInstance.
%body is sent as JSON. It takes the names Twilio's API documentation uses.
Its fields are:
description-
A human readable description of this resource, up to 128 characters.
displayName-
Provides a unique and addressable name to be assigned to this Knowledge Base. This name is assigned by the developer and can be used in addition to the ID. It is intended to be human-readable and unique within the account.
The options are:
if_match-
Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches the one provided, preventing accidental overwrites.
delete
$client->knowledge->v2->knowledge_bases($kb_id)->delete;
Delete a Knowledge Base and all associated knowledge resources. This action cannot be undone. Returns a DeleteKnowledgeBase202ResponseInstance.
KnowledgeBasisInstance
See also Twilio::InstanceResource.
It has fetch, update and delete, which work as they do on the context.
Its fields are:
- created_at
-
The ISO 8601 timestamp when the Knowledge Base was created. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
- description
-
A human readable description of this resource, up to 128 characters.
- display_name
-
Provides a unique and addressable name to be assigned to this Knowledge Base. This name is assigned by the developer and can be used in addition to the ID. It is intended to be human-readable and unique within the account.
- id
-
The unique identifier for the Knowledge Base
- status
-
The provisioning status of the Knowledge Base One of
QUEUED,PROVISIONING,ACTIVE,FAILEDorDELETING. - updated_at
-
The ISO 8601 timestamp when the Knowledge Base was last updated. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
- version
-
The current version number of the Knowledge Base. Incremented on each successful mutable update.
CreateKnowledgeBase202ResponseInstance
Returned by create, for an answer that is not a KnowledgeBasis. See also Twilio::InstanceResource.
Its fields are:
- message
-
No description in the specification.
- status_url
-
URI to check operation status.
UpdateKnowledgeBase202ResponseInstance
Returned by update, for an answer that is not a KnowledgeBasis. See also Twilio::InstanceResource.
Its fields are:
- message
-
No description in the specification.
- status_url
-
URI to check operation status.
DeleteKnowledgeBase202ResponseInstance
Returned by delete, for an answer that is not a KnowledgeBasis. See also Twilio::InstanceResource.
Its fields are:
- message
-
No description in the specification.
- status_url
-
URI to check 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.