GoliathDevelopersGet an API key
Reference/Phone Numbersgenerated from the gateway manifest

setPhoneLineRingPolicy

Replace one line's own call routing, shaped as setOrgDefaultRingPolicy's.

POST/api/v1/callWRITEidempotent · 24 hruns as the key's owner
View as Markdown

Replace one line's own call routing, shaped as setOrgDefaultRingPolicy's (read it with getPhoneLineRingPolicy first). policy null deletes it and the line follows the org default. Say the new path in plain words.

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": "setPhoneLineRingPolicy",
    "variables": {
      "phoneLineId": "<phoneLineId>"
    }
  }'
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.setPhoneLineRingPolicy(
  {
    phoneLineId: '<phoneLineId>'
  },
  { 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: 'setPhoneLineRingPolicy',
    variables: {
      phoneLineId: '<phoneLineId>'
    }
  }),
})
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.

phoneLineIdID!required
policyRingPolicyInput
humanStageRingPolicyHumanStageInput
aiStageRingPolicyAiStageInput
Every field, all the way down
variables
[
  {
    "name": "phoneLineId",
    "type": "ID!",
    "required": true,
    "description": null,
    "defaultValue": null
  },
  {
    "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.

response shape
{
  "data": {
    "ringPolicyMutation": {
      "setPhoneLineRingPolicy": {
        "id": "<ID>"
      }
    }
  }
}

Errors

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 →