import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.events.create({
name: 'user.created',
schema: {
plan: 'string',
},
});
$resend = Resend::client('re_xxxxxxxxx');
$resend->events->create([
'name' => 'user.created',
'schema' => ['plan' => 'string'],
]);
import resend
resend.api_key = "re_xxxxxxxxx"
params: resend.Events.CreateParams = {
"name": "user.created",
"schema": {
"plan": "string",
},
}
resend.Events.create(params)
require "resend"
Resend.api_key = "re_xxxxxxxxx"
params = {
name: "user.created",
schema: {
plan: "string",
},
}
Resend::Events.create(params)
package main
import "github.com/resend/resend-go/v3"
func main() {
client := resend.NewClient("re_xxxxxxxxx")
params := &resend.CreateEventRequest{
Name: "user.created",
Schema: map[string]string{
"plan": resend.EventSchemaTypeString,
},
}
client.Events.Create(params)
}
use resend_rs::{json, types::CreateEventOptions, Resend, Result};
#[tokio::main]
async fn main() -> Result<()> {
let resend = Resend::new("re_xxxxxxxxx");
let opts = CreateEventOptions {
name: "user.created".to_owned(),
schema: json!({
"plan": "string",
}),
};
let _event = resend.events.create(opts).await?;
Ok(())
}
import com.resend.*;
public class Main {
public static void main(String[] args) {
Resend resend = new Resend("re_xxxxxxxxx");
CreateEventOptions params = CreateEventOptions.builder()
.name("user.created")
.addSchema("plan", "string")
.build();
CreateEventResponseSuccess data = resend.events().create(params);
}
}
using Resend;
using System.Text.Json;
IResend resend = ResendClient.Create( "re_xxxxxxxxx" );
var schema = JsonSerializer.SerializeToElement( new { plan = "string" } );
var resp = await resend.EventCreateAsync( new EventCreateData()
{
Name = "user.created",
Schema = schema,
} );
Console.WriteLine( "EventId={0}", resp.Content );
curl -X POST 'https://api.resend.com/events' \
-H 'Authorization: Bearer re_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"name": "user.created",
"schema": {
"plan": "string"
}
}'
resend events create --name user.created --schema '{"plan":"string"}'
{
"object": "event",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
Create Event
Create a new event that can be used to trigger automations.
POST
/
events
import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.events.create({
name: 'user.created',
schema: {
plan: 'string',
},
});
$resend = Resend::client('re_xxxxxxxxx');
$resend->events->create([
'name' => 'user.created',
'schema' => ['plan' => 'string'],
]);
import resend
resend.api_key = "re_xxxxxxxxx"
params: resend.Events.CreateParams = {
"name": "user.created",
"schema": {
"plan": "string",
},
}
resend.Events.create(params)
require "resend"
Resend.api_key = "re_xxxxxxxxx"
params = {
name: "user.created",
schema: {
plan: "string",
},
}
Resend::Events.create(params)
package main
import "github.com/resend/resend-go/v3"
func main() {
client := resend.NewClient("re_xxxxxxxxx")
params := &resend.CreateEventRequest{
Name: "user.created",
Schema: map[string]string{
"plan": resend.EventSchemaTypeString,
},
}
client.Events.Create(params)
}
use resend_rs::{json, types::CreateEventOptions, Resend, Result};
#[tokio::main]
async fn main() -> Result<()> {
let resend = Resend::new("re_xxxxxxxxx");
let opts = CreateEventOptions {
name: "user.created".to_owned(),
schema: json!({
"plan": "string",
}),
};
let _event = resend.events.create(opts).await?;
Ok(())
}
import com.resend.*;
public class Main {
public static void main(String[] args) {
Resend resend = new Resend("re_xxxxxxxxx");
CreateEventOptions params = CreateEventOptions.builder()
.name("user.created")
.addSchema("plan", "string")
.build();
CreateEventResponseSuccess data = resend.events().create(params);
}
}
using Resend;
using System.Text.Json;
IResend resend = ResendClient.Create( "re_xxxxxxxxx" );
var schema = JsonSerializer.SerializeToElement( new { plan = "string" } );
var resp = await resend.EventCreateAsync( new EventCreateData()
{
Name = "user.created",
Schema = schema,
} );
Console.WriteLine( "EventId={0}", resp.Content );
curl -X POST 'https://api.resend.com/events' \
-H 'Authorization: Bearer re_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"name": "user.created",
"schema": {
"plan": "string"
}
}'
resend events create --name user.created --schema '{"plan":"string"}'
{
"object": "event",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
Body Parameters
The name of the event. Used to match events to automation triggers.
The event name can be any string (e.g.,
user.created, welcome,
my-custom-event). Dot notation is a recommended convention but is not
required. If multiple enabled automations use the same event name, all of them
will be triggered. Use unique event names if you want to target a specific
automation.Event names cannot start with the
resend: prefix, which is reserved for system events.An optional schema definition for the event payload. Must be an object with
flat key/type pairs. Supported types:
string, number, boolean, date.import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.events.create({
name: 'user.created',
schema: {
plan: 'string',
},
});
$resend = Resend::client('re_xxxxxxxxx');
$resend->events->create([
'name' => 'user.created',
'schema' => ['plan' => 'string'],
]);
import resend
resend.api_key = "re_xxxxxxxxx"
params: resend.Events.CreateParams = {
"name": "user.created",
"schema": {
"plan": "string",
},
}
resend.Events.create(params)
require "resend"
Resend.api_key = "re_xxxxxxxxx"
params = {
name: "user.created",
schema: {
plan: "string",
},
}
Resend::Events.create(params)
package main
import "github.com/resend/resend-go/v3"
func main() {
client := resend.NewClient("re_xxxxxxxxx")
params := &resend.CreateEventRequest{
Name: "user.created",
Schema: map[string]string{
"plan": resend.EventSchemaTypeString,
},
}
client.Events.Create(params)
}
use resend_rs::{json, types::CreateEventOptions, Resend, Result};
#[tokio::main]
async fn main() -> Result<()> {
let resend = Resend::new("re_xxxxxxxxx");
let opts = CreateEventOptions {
name: "user.created".to_owned(),
schema: json!({
"plan": "string",
}),
};
let _event = resend.events.create(opts).await?;
Ok(())
}
import com.resend.*;
public class Main {
public static void main(String[] args) {
Resend resend = new Resend("re_xxxxxxxxx");
CreateEventOptions params = CreateEventOptions.builder()
.name("user.created")
.addSchema("plan", "string")
.build();
CreateEventResponseSuccess data = resend.events().create(params);
}
}
using Resend;
using System.Text.Json;
IResend resend = ResendClient.Create( "re_xxxxxxxxx" );
var schema = JsonSerializer.SerializeToElement( new { plan = "string" } );
var resp = await resend.EventCreateAsync( new EventCreateData()
{
Name = "user.created",
Schema = schema,
} );
Console.WriteLine( "EventId={0}", resp.Content );
curl -X POST 'https://api.resend.com/events' \
-H 'Authorization: Bearer re_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"name": "user.created",
"schema": {
"plan": "string"
}
}'
resend events create --name user.created --schema '{"plan":"string"}'
Successful creation returns 201 Created with the JSON body below.
{
"object": "event",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
Was this page helpful?
⌘I