setOrgDefaultRingPolicy
Replace the org's default call routing.
Replace the org's default call routing (every line without its own): humanStage (targetKind, ringSeconds 5 to 60, its target, an optional schedule) then aiStage (AI employees whose calls are on, SINGLE or ROUND_ROBIN). It saves the WHOLE policy, so read it first with getPhoneRouting and send it back changed; an omitted schedule or area-code map keeps what is saved. policy null deletes the default. Say the new path in plain words; it changes who picks up the org's calls from the next call on.
curl https://server.goliathdata.com/api/v1/call \
-H "Authorization: Bearer $GOLIATH_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"operationId": "setOrgDefaultRingPolicy",
"variables": {}
}'import { GoliathClient } from '@goliath-data/sdk'
const goliath = new GoliathClient({
apiKey: process.env.GOLIATH_API_KEY!,
baseUrl: 'https://server.goliathdata.com',
})
const result = await goliath.phoneNumbers.setOrgDefaultRingPolicy(
{},
{ idempotencyKey: crypto.randomUUID() },
)const res = await fetch('https://server.goliathdata.com/api/v1/call', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.GOLIATH_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
operationId: 'setOrgDefaultRingPolicy',
variables: {}
}),
})
const { data, errors } = await res.json()Variables
The example sends only what the schema requires. Some operations also need one of several optional variables (one filter or another, say); the description above says which.
Every field, all the way down
[
{
"name": "policy",
"type": "RingPolicyInput",
"required": false,
"description": null,
"defaultValue": null,
"fields": [
{
"name": "humanStage",
"type": "RingPolicyHumanStageInput",
"required": false,
"description": null,
"defaultValue": null,
"fields": [
{
"name": "targetKind",
"type": "CallRoundRobinTargetKind!",
"required": true,
"description": null,
"defaultValue": null,
"enumValues": [
"EXTERNAL",
"ORG_USER_ROTATION",
"TEAM",
"AREA_CODE_MAP",
"LINE_OWNER",
"NONE",
"SPECIFIC_USER"
]
},
{
"name": "ringSeconds",
"type": "Int!",
"required": true,
"description": null,
"defaultValue": null
},
{
"name": "externalE164",
"type": "String",
"required": false,
"description": null,
"defaultValue": null
},
{
"name": "specificUserId",
"type": "ID",
"required": false,
"description": null,
"defaultValue": null
},
{
"name": "phoneLineIds",
"type": "[ID!]",
"required": false,
"description": null,
"defaultValue": null
},
{
"name": "userGroupId",
"type": "ID",
"required": false,
"description": null,
"defaultValue": null
},
{
"name": "ringAllTeamMembers",
"type": "Boolean",
"required": false,
"description": null,
"defaultValue": null
},
{
"name": "areaCodeForwardingMap",
"type": "JSON",
"required": false,
"description": null,
"defaultValue": null
},
{
"name": "schedule",
"type": "ContactAgentCallScheduleInput",
"required": false,
"description": null,
"defaultValue": null,
"fields": [
{
"name": "timezone",
"type": "String!",
"required": true,
"description": null,
"defaultValue": null
},
{
"name": "days",
"type": "[ContactAgentCallScheduleDayInput!]!",
"required": true,
"description": null,
"defaultValue": null,
"fields": [
{
"name": "day",
"type": "ContactAgentDayOfWeek!",
"required": true,
"description": null,
"defaultValue": null,
"enumValues": [
"MON",
"TUE",
"WED",
"THU",
"FRI",
"SAT",
"SUN"
]
},
{
"name": "open",
"type": "String!",
"required": true,
"description": null,
"defaultValue": null
},
{
"name": "close",
"type": "String!",
"required": true,
"description": null,
"defaultValue": null
},
{
"name": "enabled",
"type": "Boolean!",
"required": true,
"description": null,
"defaultValue": null
}
]
}
]
},
{
"name": "ownerlessStep",
"type": "RingPolicyOwnerlessStepInput",
"required": false,
"description": null,
"defaultValue": null,
"fields": [
{
"name": "targetKind",
"type": "CallRoundRobinTargetKind!",
"required": true,
"description": null,
"defaultValue": null,
"enumValues": [
"EXTERNAL",
"ORG_USER_ROTATION",
"TEAM",
"AREA_CODE_MAP",
"LINE_OWNER",
"NONE",
"SPECIFIC_USER"
]
},
{
"name": "externalE164",
"type": "String",
"required": false,
"description": null,
"defaultValue": null
},
{
"name": "specificUserId",
"type": "ID",
"required": false,
"description": null,
"defaultValue": null
},
{
"name": "phoneLineIds",
"type": "[ID!]",
"required": false,
"description": null,
"defaultValue": null
},
{
"name": "userGroupId",
"type": "ID",
"required": false,
"description": null,
"defaultValue": null
}
]
}
]
},
{
"name": "aiStage",
"type": "RingPolicyAiStageInput",
"required": false,
"description": null,
"defaultValue": null,
"fields": [
{
"name": "agentIds",
"type": "[ID!]!",
"required": true,
"description": null,
"defaultValue": null
},
{
"name": "rotation",
"type": "RingPolicyAiRotation!",
"required": true,
"description": null,
"defaultValue": null,
"enumValues": [
"SINGLE",
"ROUND_ROBIN"
]
}
]
}
]
}
]Response
What comes back under data: a list shows as one entry, and a value as its type.
{
"data": {
"ringPolicyMutation": {
"setOrgDefaultRingPolicy": {
"id": "<ID>"
}
}
}
}Errors
unknown_variableA variable the operation does not declare. A typo is refused rather than silently dropped.
unauthorizedNo bearer header, or the key is invalid or revoked.
insufficient_scopeThe key lacks the scope the operation requires.
forbiddenA referenced record does not exist, was deleted, or is outside your organization. The gateway cannot tell those apart.
idempotency_conflictA request with this Idempotency-Key is still in flight.
Idempotency
Send an Idempotency-Key of 1 to 255 characters. A finished request retried with the same key replays its stored response, marked Idempotency-Replayed: true; one still in flight returns 409 idempotency_conflict. Keys expire after 24 hours. Write without fear →