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
Resource properties
idtype: stringNot PII

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


urltype: string<URI>Not PII

The URL of this resource.


linkstype: object<URI MAP>Not PII

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


latest_version_date_createdtype: string<DATE TIME>Not PII

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


latest_versiontype: integerNot PII

The latest version published of this schema.


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

Parameters

fetch-parameters page anchor
URI parameters
Idtype: stringNot PII
Path Parameter

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

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.events.v1.schemas('Messaging.MessageStatus')
_10
.fetch()
_10
.then(schema => console.log(schema.id));

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: