Create Schema
curl --request POST \
--url https://api.vela.dev/v1/apps/{appId}/schemas \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"eventName": "order.placed",
"description": "Emitted when a checkout completes",
"fields": [
{
"id": "fld-order-id",
"name": "orderId",
"type": "string",
"required": true
},
{
"id": "fld-amount",
"name": "amountCents",
"type": "number",
"required": true
}
],
"metadataFields": [
{
"id": "meta-env",
"name": "environment",
"type": "string"
}
]
}
'import requests
url = "https://api.vela.dev/v1/apps/{appId}/schemas"
payload = {
"eventName": "order.placed",
"description": "Emitted when a checkout completes",
"fields": [
{
"id": "fld-order-id",
"name": "orderId",
"type": "string",
"required": True
},
{
"id": "fld-amount",
"name": "amountCents",
"type": "number",
"required": True
}
],
"metadataFields": [
{
"id": "meta-env",
"name": "environment",
"type": "string"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
eventName: 'order.placed',
description: 'Emitted when a checkout completes',
fields: [
{id: 'fld-order-id', name: 'orderId', type: 'string', required: true},
{id: 'fld-amount', name: 'amountCents', type: 'number', required: true}
],
metadataFields: [{id: 'meta-env', name: 'environment', type: 'string'}]
})
};
fetch('https://api.vela.dev/v1/apps/{appId}/schemas', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vela.dev/v1/apps/{appId}/schemas",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'eventName' => 'order.placed',
'description' => 'Emitted when a checkout completes',
'fields' => [
[
'id' => 'fld-order-id',
'name' => 'orderId',
'type' => 'string',
'required' => true
],
[
'id' => 'fld-amount',
'name' => 'amountCents',
'type' => 'number',
'required' => true
]
],
'metadataFields' => [
[
'id' => 'meta-env',
'name' => 'environment',
'type' => 'string'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.vela.dev/v1/apps/{appId}/schemas"
payload := strings.NewReader("{\n \"eventName\": \"order.placed\",\n \"description\": \"Emitted when a checkout completes\",\n \"fields\": [\n {\n \"id\": \"fld-order-id\",\n \"name\": \"orderId\",\n \"type\": \"string\",\n \"required\": true\n },\n {\n \"id\": \"fld-amount\",\n \"name\": \"amountCents\",\n \"type\": \"number\",\n \"required\": true\n }\n ],\n \"metadataFields\": [\n {\n \"id\": \"meta-env\",\n \"name\": \"environment\",\n \"type\": \"string\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.vela.dev/v1/apps/{appId}/schemas")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"eventName\": \"order.placed\",\n \"description\": \"Emitted when a checkout completes\",\n \"fields\": [\n {\n \"id\": \"fld-order-id\",\n \"name\": \"orderId\",\n \"type\": \"string\",\n \"required\": true\n },\n {\n \"id\": \"fld-amount\",\n \"name\": \"amountCents\",\n \"type\": \"number\",\n \"required\": true\n }\n ],\n \"metadataFields\": [\n {\n \"id\": \"meta-env\",\n \"name\": \"environment\",\n \"type\": \"string\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vela.dev/v1/apps/{appId}/schemas")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"eventName\": \"order.placed\",\n \"description\": \"Emitted when a checkout completes\",\n \"fields\": [\n {\n \"id\": \"fld-order-id\",\n \"name\": \"orderId\",\n \"type\": \"string\",\n \"required\": true\n },\n {\n \"id\": \"fld-amount\",\n \"name\": \"amountCents\",\n \"type\": \"number\",\n \"required\": true\n }\n ],\n \"metadataFields\": [\n {\n \"id\": \"meta-env\",\n \"name\": \"environment\",\n \"type\": \"string\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"appId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"eventName": "<string>",
"description": "<string>",
"fields": [
{
"id": "<string>",
"name": "<string>",
"required": false,
"enumValues": [
"<string>"
]
}
],
"metadataFields": [
{
"id": "<string>",
"name": "<string>",
"required": false,
"enumValues": [
"<string>"
]
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Schemas
Create Schema
Registers a new event schema for the app.
POST
/
apps
/
{appId}
/
schemas
Create Schema
curl --request POST \
--url https://api.vela.dev/v1/apps/{appId}/schemas \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"eventName": "order.placed",
"description": "Emitted when a checkout completes",
"fields": [
{
"id": "fld-order-id",
"name": "orderId",
"type": "string",
"required": true
},
{
"id": "fld-amount",
"name": "amountCents",
"type": "number",
"required": true
}
],
"metadataFields": [
{
"id": "meta-env",
"name": "environment",
"type": "string"
}
]
}
'import requests
url = "https://api.vela.dev/v1/apps/{appId}/schemas"
payload = {
"eventName": "order.placed",
"description": "Emitted when a checkout completes",
"fields": [
{
"id": "fld-order-id",
"name": "orderId",
"type": "string",
"required": True
},
{
"id": "fld-amount",
"name": "amountCents",
"type": "number",
"required": True
}
],
"metadataFields": [
{
"id": "meta-env",
"name": "environment",
"type": "string"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
eventName: 'order.placed',
description: 'Emitted when a checkout completes',
fields: [
{id: 'fld-order-id', name: 'orderId', type: 'string', required: true},
{id: 'fld-amount', name: 'amountCents', type: 'number', required: true}
],
metadataFields: [{id: 'meta-env', name: 'environment', type: 'string'}]
})
};
fetch('https://api.vela.dev/v1/apps/{appId}/schemas', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vela.dev/v1/apps/{appId}/schemas",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'eventName' => 'order.placed',
'description' => 'Emitted when a checkout completes',
'fields' => [
[
'id' => 'fld-order-id',
'name' => 'orderId',
'type' => 'string',
'required' => true
],
[
'id' => 'fld-amount',
'name' => 'amountCents',
'type' => 'number',
'required' => true
]
],
'metadataFields' => [
[
'id' => 'meta-env',
'name' => 'environment',
'type' => 'string'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.vela.dev/v1/apps/{appId}/schemas"
payload := strings.NewReader("{\n \"eventName\": \"order.placed\",\n \"description\": \"Emitted when a checkout completes\",\n \"fields\": [\n {\n \"id\": \"fld-order-id\",\n \"name\": \"orderId\",\n \"type\": \"string\",\n \"required\": true\n },\n {\n \"id\": \"fld-amount\",\n \"name\": \"amountCents\",\n \"type\": \"number\",\n \"required\": true\n }\n ],\n \"metadataFields\": [\n {\n \"id\": \"meta-env\",\n \"name\": \"environment\",\n \"type\": \"string\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.vela.dev/v1/apps/{appId}/schemas")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"eventName\": \"order.placed\",\n \"description\": \"Emitted when a checkout completes\",\n \"fields\": [\n {\n \"id\": \"fld-order-id\",\n \"name\": \"orderId\",\n \"type\": \"string\",\n \"required\": true\n },\n {\n \"id\": \"fld-amount\",\n \"name\": \"amountCents\",\n \"type\": \"number\",\n \"required\": true\n }\n ],\n \"metadataFields\": [\n {\n \"id\": \"meta-env\",\n \"name\": \"environment\",\n \"type\": \"string\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vela.dev/v1/apps/{appId}/schemas")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"eventName\": \"order.placed\",\n \"description\": \"Emitted when a checkout completes\",\n \"fields\": [\n {\n \"id\": \"fld-order-id\",\n \"name\": \"orderId\",\n \"type\": \"string\",\n \"required\": true\n },\n {\n \"id\": \"fld-amount\",\n \"name\": \"amountCents\",\n \"type\": \"number\",\n \"required\": true\n }\n ],\n \"metadataFields\": [\n {\n \"id\": \"meta-env\",\n \"name\": \"environment\",\n \"type\": \"string\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"appId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"eventName": "<string>",
"description": "<string>",
"fields": [
{
"id": "<string>",
"name": "<string>",
"required": false,
"enumValues": [
"<string>"
]
}
],
"metadataFields": [
{
"id": "<string>",
"name": "<string>",
"required": false,
"enumValues": [
"<string>"
]
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Authorizations
Client secret for management API access. Format: vela_cs_...
Path Parameters
App UUID or slug
Body
application/json
Response
201 - application/json
Schema created
Schema identifier
Associated app
Event name (unique per app)
Human-readable description
Event data field definitions
Show child attributes
Show child attributes
Metadata field definitions
Show child attributes
Show child attributes
⌘I