Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Schema Resource


Schemas define how information is organized within an event's data attribute. You can use the schema to explore the fields in an event type before subscribing to it. You can use also it in production to validate that the events you receive match their published schemas.

There are two ways to find the schema id of an Event-Type.

  1. You can fetch any event type resource through the Event Type API and find the schema_id in its properties.
  2. If you are already receiving events in your sink, the metadata of the event will contain the url of its schema in a field called dataschema . The schema id is part of the url. For example, if the url is https://events-schemas.twilio.com/VoiceInsights.CallSummary/1(link takes you to an external page) , the schema id is VoiceInsights.CallSummary.

Schema Properties

schema-properties page anchor
Property nameTypePIIDescription
idstring
Not PII

The unique identifier of the schema. Each schema can have multiple versions, that share the same id.


urlstring<uri>

The URL of this resource.


linksobject<uri-map>

Contains a dictionary of URL links to nested resources of this schema.


latest_version_date_createdstring<date-time>

The date that the latest schema version was created, given in ISO 8601 format.


latest_versioninteger

The latest version published of this schema.


GET https://events.twilio.com/v1/Schemas/{Id}

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
Idstringrequired

The unique identifier of the schema. Each schema can have multiple versions, that share the same id.

Fetch schema

fetch-schema page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function fetchSchema() {
_18
const schema = await client.events.v1
_18
.schemas("Messaging.MessageStatus")
_18
.fetch();
_18
_18
console.log(schema.id);
_18
}
_18
_18
fetchSchema();

Output

_10
{
_10
"id": "Messaging.MessageStatus",
_10
"url": "https://events.twilio.com/v1/Schemas/Messaging.MessageStatus",
_10
"latest_version_date_created": "2020-07-30T20:00:00Z",
_10
"latest_version": 1,
_10
"links": {
_10
"versions": "https://events.twilio.com/v1/Schemas/Messaging.MessageStatus/Versions"
_10
}
_10
}


Rate this page: