On-Call API › Import
Import from Opsgenie
Reads the Opsgenie account with api_key (a read-only key is enough; it is used
for this request only and not stored) in region (us or eu), matches its
users to EvoHub members by email, and works out what would be created.
team_map maps Opsgenie team ids to EvoHub teams the caller is in; unmapped
items go to the caller's first team. One import runs per organization at a
time, within 25 seconds.
Creates the schedules, escalation policies and integrations whose source ids
are listed in schedules, policies and integrations, in that order.
Importing an item again does not duplicate it; a schedule imported before only
gains the members who have joined EvoHub since. The answer lists what was
created, updated and skipped, with each new integration's webhook URL.
Permission (API-key scope): oncall:settings:write.
Authorization
bearerAuth(oncall:settings:write)apiKeyHeader(oncall:settings:write)
Request body required
Preview reads only api_key, region and team_map. Apply also takes the source ids to import.
api_keystring requiredThe source account's API key; read access is enough. Not stored.regionstring requiredschedulesarray of stringpoliciesarray of stringintegrationsarray of stringteam_mapobjectSource team id → EvoHub team id.
Responses
200
What was done.
dataImportResult requiredShow ImportResult properties
createdobjectschedulesarray of ImportedItemShow ImportedItem properties
idstringThe new EvoHub id.namestringsource_idstringopsgenie_idstring
policiesarray of ImportedItemShow ImportedItem properties
idstringThe new EvoHub id.namestringsource_idstringopsgenie_idstring
integrationsarray of objectidstringnamestringsource_idstringopsgenie_idstringevohub_typestringwebhook_urlstringWhere to point the source tool.
updatedobjectschedulesarray of objectidstringnamestringsource_idstringopsgenie_idstringadded_membersarray of string
skippedarray of objectkindstringnamestringreasonstring
warningsarray of string
successboolean required
400
The body is not JSON (INVALID_BODY); api_key, region or team_map is invalid (VALIDATION_FAILED); or Opsgenie refused the key (OPSGENIE_UNAUTHORIZED).
errorobject requiredcodestring requiredMachine-readable code. Branch on this.messagestring requiredHuman-readable explanation.
401
No API key was sent, or it is unknown, revoked or expired (UNAUTHORIZED).
errorobject requiredcodestring requiredMachine-readable code. Branch on this.messagestring requiredHuman-readable explanation.
403
The caller lacks the permission (FORBIDDEN), or team_map names a team the caller is not in (NOT_IN_TEAM).
errorobject requiredcodestring requiredMachine-readable code. Branch on this.messagestring requiredHuman-readable explanation.
409
Another import is running for the organization (IMPORT_IN_PROGRESS).
errorobject requiredcodestring requiredMachine-readable code. Branch on this.messagestring requiredHuman-readable explanation.
429
Too many requests (RATE_LIMITED). Wait Retry-After seconds.
Retry-AfterintegerSeconds to wait.
errorobject requiredcodestring requiredMachine-readable code. Branch on this.messagestring requiredHuman-readable explanation.
500
Something went wrong on EvoHub's side (INTERNAL_ERROR). Retry later.
errorobject requiredcodestring requiredMachine-readable code. Branch on this.messagestring requiredHuman-readable explanation.
502
Opsgenie could not be read (OPSGENIE_UNAVAILABLE).
errorobject requiredcodestring requiredMachine-readable code. Branch on this.messagestring requiredHuman-readable explanation.
503
Opsgenie is rate limiting the key (OPSGENIE_RATE_LIMITED), or EvoHub members could not be checked (MEMBER_CHECK_UNAVAILABLE). Retry shortly.
errorobject requiredcodestring requiredMachine-readable code. Branch on this.messagestring requiredHuman-readable explanation.
Example request
curl -X POST 'https://evohub.io/api/v1/import/opsgenie/apply' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"region": "eu",
"api_key": "YOUR_OPSGENIE_API_KEY",
"policies": [
"P4D5E6F"
],
"team_map": {
"PTEAM01": "a3f9c2e1-7b4d-4c8a-9e6f-2d1b0c9a8f7e"
},
"schedules": [
"P1A2B3C"
],
"integrations": [
"P7G8H9I"
]
}'