MetorialDocs

Callbacks

A callback is what receives provider events for an integration provider. Creating one enables callbacks on the integration provider, and Metorial then registers the callback against every matching integration instance. Setting `callbacks.status` on the integration provider itself does the same thing.

The Callback object

callback.json
{
  "object": "callback",
  "id": "cbk_4dEfGhJkLmNpQrSt",
  "status": "active",
  "name": "Production GitHub Events",
  "description": "Repository events for the production workspace",
  "metadata": {},
  "integration_id": "int_2bCdEfGhJkLmNpQr",
  "integration_provider_id": "inp_3cDeFgHjKlMnPqRs",
  "provider": {
    "object": "provider#preview",
    "id": "pro_5gHjKlMnPqRsTuVw",
    "name": "GitHub",
    "description": "Connect to GitHub repositories, issues, and pull requests",
    "slug": "github",
    "created_at": "2025-09-15T10:30:00.000Z",
    "updated_at": "2026-01-10T14:45:00.000Z"
  },
  "trigger_group_selections": {
    "key1": {}
  },
  "trigger_groups": [
    {
      "object": "callback.trigger_group",
      "key": "folder_events",
      "name": "Folder events",
      "description": "Files added to or changed in the selected folders.",
      "selection_schema": {},
      "status": "active"
    },
    {
      "object": "callback.trigger_group",
      "key": "folder_events",
      "name": "Folder events",
      "description": "Files added to or changed in the selected folders.",
      "selection_schema": {},
      "status": "active"
    }
  ],
  "created_at": "2025-09-15T10:30:00.000Z",
  "updated_at": "2026-01-10T14:45:00.000Z"
}
object"callback"required
idstringrequired
status"active" | "archived" | "deleted"required
namestringrequired
descriptionstringrequirednullable
metadataRecord<string, any>requirednullable
integration_idstringrequired
integration_provider_idstringrequired
trigger_group_selectionsRecord<string, any>requirednullable
created_atdaterequired
updated_atdaterequired

Endpoints

List callbacks

GET/callbacks

Returns a paginated list of callbacks.

Query parameters

idstring or string[]optional

Only return callbacks with one of these IDs.

integration_idstring or string[]optional

Only return callbacks for one of these integrations.

integration_provider_idstring or string[]optional

Only return callbacks for one of these integration providers.

provider_idstring or string[]optional

Only return callbacks for one of these providers.

searchstringoptional

Search callbacks by name, description, integration, or provider.

status"active" | "archived" | "deleted" or "active" | "archived" | "deleted"[]optional

Only return callbacks with one of these statuses. `deleted` callbacks are never listed.

Example request

curl -X GET "https://api.metorial.com/callbacks" \
  -H "Authorization: Bearer metorial_sk_io2h4..."
import Metorial from 'metorial';

let metorial = new Metorial({ apiKey: 'metorial_sk_io2h4...' });

let result = await metorial.callbacks.list();

console.log(result.items);
from metorial import Metorial

metorial = Metorial(api_key='metorial_sk_io2h4...')

result = metorial.callbacks.list()
print(result.items)

Create callback

POST/callbacks

Enables callbacks for an integration provider and returns the callback it created. Only providers whose type reports `triggers.status` as `enabled` support this. Callback instances are then registered for every matching integration instance in the background.

Request body

integration_idstringrequired

Integration the integration provider belongs to

integration_provider_idstringrequired

Integration provider to enable callbacks for

namestringoptional

Display name for the callback. Defaults to the name of the integration provider.

descriptionstringoptionalnullable

Description for the callback. Defaults to the description of the integration provider.

trigger_group_selectionsRecord<string, any>optional

Resource selections keyed by trigger group key. Each value must match that group’s selection schema. Limited to 64 groups and 64 KiB of JSON.

Example request

curl -X POST "https://api.metorial.com/callbacks" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer metorial_sk_io2h4..." \
  -d '{
  "integration_id": "int_2bCdEfGhJkLmNpQr",
  "integration_provider_id": "inp_3cDeFgHjKlMnPqRs",
  "name": "Production GitHub Events",
  "description": "Repository events for the production workspace",
  "trigger_group_selections": {
    "key1": {}
  }
}'
import Metorial from 'metorial';

let metorial = new Metorial({ apiKey: 'metorial_sk_io2h4...' });

let result = await metorial.callbacks.create({
  "integrationId": "int_2bCdEfGhJkLmNpQr",
  "integrationProviderId": "inp_3cDeFgHjKlMnPqRs",
  "name": "Production GitHub Events",
  "description": "Repository events for the production workspace",
  "triggerGroupSelections": {
    "key1": {}
  }
});

console.log(result);
from metorial import Metorial

metorial = Metorial(api_key='metorial_sk_io2h4...')

result = metorial.callbacks.create(integration_id="int_2bCdEfGhJkLmNpQr", integration_provider_id="inp_3cDeFgHjKlMnPqRs", name="Production GitHub Events", description="Repository events for the production workspace", trigger_group_selections={
  "key1": {}
})
print(result)

Get callback

GET/callbacks/:callback_id

Retrieves a callback.

Path parameters

callback_idstringrequired

The unique identifier for the callback

Example request

curl -X GET "https://api.metorial.com/callbacks/cal_Rm4Mnheq2bfEPhBhP7SY" \
  -H "Authorization: Bearer metorial_sk_io2h4..."
import Metorial from 'metorial';

let metorial = new Metorial({ apiKey: 'metorial_sk_io2h4...' });

let result = await metorial.callbacks.get('cal_Rm4Mnheq2bfEPhBhP7SY');

console.log(result);
from metorial import Metorial

metorial = Metorial(api_key='metorial_sk_io2h4...')

result = metorial.callbacks.get("cal_Rm4Mnheq2bfEPhBhP7SY")
print(result)

Update callback

PATCH/callbacks/:callback_id

Updates a callback. Omitted fields keep their current value. Changing the selections re-registers the affected triggers. Only an active callback can be updated.

Path parameters

callback_idstringrequired

The unique identifier for the callback

Request body

namestringoptional

Updated display name

descriptionstringoptionalnullable

Updated free-text description. `null` clears it.

metadataRecord<string, any>optionalnullable

Custom data to identify or organize the callback. Replaces existing metadata. `null` clears it.

trigger_group_selectionsRecord<string, any>optionalnullable

Resource selections keyed by trigger group key. Each value must match that group’s selection schema. Limited to 64 groups and 64 KiB of JSON.

Example request

curl -X PATCH "https://api.metorial.com/callbacks/cal_Rm4Mnheq2bfEPhBhP7SY" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer metorial_sk_io2h4..." \
  -d '{
  "name": "Staging GitHub Events",
  "description": "Repository events for the staging workspace",
  "metadata": {},
  "trigger_group_selections": {
    "key1": {}
  }
}'
import Metorial from 'metorial';

let metorial = new Metorial({ apiKey: 'metorial_sk_io2h4...' });

let result = await metorial.callbacks.update('cal_Rm4Mnheq2bfEPhBhP7SY', {
  "name": "Staging GitHub Events",
  "description": "Repository events for the staging workspace",
  "metadata": {},
  "triggerGroupSelections": {
    "key1": {}
  }
});

console.log(result);
from metorial import Metorial

metorial = Metorial(api_key='metorial_sk_io2h4...')

result = metorial.callbacks.update("cal_Rm4Mnheq2bfEPhBhP7SY", name="Staging GitHub Events", description="Repository events for the staging workspace", metadata={}, trigger_group_selections={
  "key1": {}
})
print(result)

Archive callback

DELETE/callbacks/:callback_id

Archives a callback by disabling callbacks on its integration provider. Callback instances are torn down in the background. Only an active callback can be archived.

Path parameters

callback_idstringrequired

The unique identifier for the callback

Example request

curl -X DELETE "https://api.metorial.com/callbacks/cal_Rm4Mnheq2bfEPhBhP7SY" \
  -H "Authorization: Bearer metorial_sk_io2h4..."
import Metorial from 'metorial';

let metorial = new Metorial({ apiKey: 'metorial_sk_io2h4...' });

let result = await metorial.callbacks.delete('cal_Rm4Mnheq2bfEPhBhP7SY');

console.log(result);
from metorial import Metorial

metorial = Metorial(api_key='metorial_sk_io2h4...')

result = metorial.callbacks.delete("cal_Rm4Mnheq2bfEPhBhP7SY")
print("Deleted")