Skip to content
Markets open

Switch API reference

Switch: team and audit

Roles, team members, approvals and the audit history.

11 operationsBase URL https://packetexchange.io/api/v1Postman collection

Get your role and permissions on the switch

GET/api/v1/switch/me

Access
API key. Scoped keys need switch:manage.
Rate limit
100 requests per second (the default)

Response 200

FieldTypeDescription
datarequiredobject-
operatorIdrequireddata.operatorIdstring (uuid)-
isAccountHolderrequireddata.isAccountHolderboolean-
rolerequireddata.rolestring | null-
roleLabelrequireddata.roleLabelstring | null-
permissionsrequireddata.permissionsstring[]-
sensitivePermissionsrequireddata.sensitivePermissionsstring[]-
scoperequireddata.scopeobject-
customerIdsrequireddata.scope.customerIdsstring (uuid)[] | nullnull = all customers
trunkIdsrequireddata.scope.trunkIdsstring (uuid)[] | nullnull = all trunks

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 402SWITCH_SUBSCRIPTION_REQUIRED: the account has no active Switch plan or trial.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.

List team members and the available roles

GET/api/v1/switch/team

Access
API key. Scoped keys need switch:manage.
Rate limit
100 requests per second (the default)

Response 200

FieldTypeDescription
datarequiredobject-
membersrequireddata.membersobject[]-
idrequireddata.members[].idstring (uuid)-
userIdrequireddata.members[].userIdstring (uuid)-
emailrequireddata.members[].emailstring-
contactNamerequireddata.members[].contactNamestring | null-
rolerequireddata.members[].rolestring-
roleLabelrequireddata.members[].roleLabelstring-
statusrequireddata.members[].statusstring-
customerIdsrequireddata.members[].customerIdsstring (uuid)[] | null-
trunkIdsrequireddata.members[].trunkIdsstring (uuid)[] | null-
noterequireddata.members[].notestring | null-
permissionsrequireddata.members[].permissionsstring[]-
scopeSummaryrequireddata.members[].scopeSummaryobject-
customersrequireddata.members[].scopeSummary.customersstring-
trunksrequireddata.members[].scopeSummary.trunksstring-
createdAtrequireddata.members[].createdAtstring (date-time)ISO-8601 timestamp (UTC)
updatedAtrequireddata.members[].updatedAtstring (date-time)ISO-8601 timestamp (UTC)
rolesrequireddata.rolesobject[]-

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 402SWITCH_SUBSCRIPTION_REQUIRED: the account has no active Switch plan or trial.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.

Add a team member

POST/api/v1/switch/team

Access
API key. Scoped keys need switch:manage.
Rate limit
100 requests per second (the default)

Gives an email address a role on your switch, optionally limited to some customers and trunks (null = all).

Test keys: refused with 403 TEST_KEY_NOT_ALLOWED. The Switch has no test mode, so a change always applies to your live configuration. Test keys can still read Switch data.

Request body (application/json)

FieldTypeDescription
emailrequiredstring (email)-max 255 chars
rolerequiredstring-One of viewer, noc, routing, billing, account_manager, administrator
customerIdsstring (uuid)[] | null-
trunkIdsstring (uuid)[] | null-
notestring | null-max 500 chars

Response 201

FieldTypeDescription
datarequiredobjectSame fields as SwitchTeamMember, shown earlier on this page.

Response 202

FieldTypeDescription
datarequiredobject-
approvalRequireddata.approvalRequiredboolean-One of true
approvalRequestIddata.approvalRequestIdstring (uuid) | null-
permissiondata.permissionstring-
expiresAtdata.expiresAtstring (date-time)-
messagedata.messagestring-

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 402SWITCH_SUBSCRIPTION_REQUIRED: the account has no active Switch plan or trial.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 409CONFLICT (or a code-specific 409): the change clashes with existing state.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.

Change a team member's role, scope or status

PATCH/api/v1/switch/team/{memberId}

Access
API key. Scoped keys need switch:manage.
Rate limit
100 requests per second (the default)

Test keys: refused with 403 TEST_KEY_NOT_ALLOWED. The Switch has no test mode, so a change always applies to your live configuration. Test keys can still read Switch data.

Parameters

NameInTypeDescription
memberIdrequiredpathstring-

Request body (application/json)

FieldTypeDescription
rolestring-One of viewer, noc, routing, billing, account_manager, administrator
statusstring-One of active, suspended
customerIdsstring (uuid)[] | null-
trunkIdsstring (uuid)[] | null-
notestring | null-max 500 chars

Response 200

FieldTypeDescription
datarequiredobjectSame fields as SwitchTeamMember, shown earlier on this page.

Response 202

FieldTypeDescription
datarequiredobject-
approvalRequireddata.approvalRequiredboolean-One of true
approvalRequestIddata.approvalRequestIdstring (uuid) | null-
permissiondata.permissionstring-
expiresAtdata.expiresAtstring (date-time)-
messagedata.messagestring-

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 402SWITCH_SUBSCRIPTION_REQUIRED: the account has no active Switch plan or trial.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 404NOT_FOUND: no such resource on your account.
  • 409CONFLICT (or a code-specific 409): the change clashes with existing state.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.

Suspend a team member

DELETE/api/v1/switch/team/{memberId}

Access
API key. Scoped keys need switch:manage.
Rate limit
100 requests per second (the default)

Suspends rather than deletes, so their history stays attributed.

Test keys: refused with 403 TEST_KEY_NOT_ALLOWED. The Switch has no test mode, so a change always applies to your live configuration. Test keys can still read Switch data.

Parameters

NameInTypeDescription
memberIdrequiredpathstring-

Response 200

FieldTypeDescription
datarequiredobjectSame fields as SwitchTeamMember, shown earlier on this page.

Response 202

FieldTypeDescription
datarequiredobject-
approvalRequireddata.approvalRequiredboolean-One of true
approvalRequestIddata.approvalRequestIdstring (uuid) | null-
permissiondata.permissionstring-
expiresAtdata.expiresAtstring (date-time)-
messagedata.messagestring-

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 402SWITCH_SUBSCRIPTION_REQUIRED: the account has no active Switch plan or trial.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 404NOT_FOUND: no such resource on your account.
  • 409CONFLICT (or a code-specific 409): the change clashes with existing state.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.

Search the switch audit history

GET/api/v1/switch/audit

Access
API key. Scoped keys need switch:manage.
Rate limit
100 requests per second (the default)

Who changed what, when, and under which permission. Cursor-paginated with nextCursor.

Parameters

NameInTypeDescription
customerIdquerystring (uuid)-
trunkIdquerystring (uuid)-
actorUserIdquerystring (uuid)-
actionquerystring-
permissionquerystring-
sensitiveOnlyqueryboolean-
outcomequerystring-One of success, failure, denied
fromquerystring (date-time)-
toquerystring (date-time)-
searchquerystring-
limitqueryinteger-
cursorquerystring (uuid)-

Response 200

FieldTypeDescription
datarequiredobject-
entriesrequireddata.entriesobject[]-
nextCursorrequireddata.nextCursorstring | null-

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 402SWITCH_SUBSCRIPTION_REQUIRED: the account has no active Switch plan or trial.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.

Get the values available to filter the audit history by

GET/api/v1/switch/audit/filter-options

Access
API key. Scoped keys need switch:manage.
Rate limit
100 requests per second (the default)

Response 200

FieldTypeDescription
datarequiredobject-
actorsrequireddata.actorsobject[]-
permissionsrequireddata.permissionsstring[]-
sensitivePermissionsrequireddata.sensitivePermissionsstring[]-

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 402SWITCH_SUBSCRIPTION_REQUIRED: the account has no active Switch plan or trial.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.

List approval requests

GET/api/v1/switch/approvals

Access
API key. Scoped keys need switch:manage.
Rate limit
100 requests per second (the default)

Actions waiting for (or decided by) a second person. Defaults to pending and approved.

Parameters

NameInTypeDescription
statusquerystringComma-separated statuses
limitqueryinteger-

Response 200

FieldTypeDescription
datarequiredobject[]-
idrequireddata[].idstring (uuid)-
statusrequireddata[].statusstringpending, approved, rejected, expired...
permissiondata[].permissionstring-
requestedAtrequireddata[].requestedAtstring (date-time)ISO-8601 timestamp (UTC)

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 402SWITCH_SUBSCRIPTION_REQUIRED: the account has no active Switch plan or trial.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.

Approve or reject an approval request

POST/api/v1/switch/approvals/{id}/decide

Access
API key. Scoped keys need switch:manage.
Rate limit
100 requests per second (the default)

Test keys: refused with 403 TEST_KEY_NOT_ALLOWED. The Switch has no test mode, so a change always applies to your live configuration. Test keys can still read Switch data.

Parameters

NameInTypeDescription
idrequiredpathstring-

Request body (application/json)

FieldTypeDescription
decisionrequiredstring-One of approve, reject
notestring | null-max 2000 chars

Response 200

FieldTypeDescription
datarequiredobjectSame fields as SwitchApproval, shown earlier on this page.

Response 202

FieldTypeDescription
datarequiredobject-
approvalRequireddata.approvalRequiredboolean-One of true
approvalRequestIddata.approvalRequestIdstring (uuid) | null-
permissiondata.permissionstring-
expiresAtdata.expiresAtstring (date-time)-
messagedata.messagestring-

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 402SWITCH_SUBSCRIPTION_REQUIRED: the account has no active Switch plan or trial.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 404NOT_FOUND: no such resource on your account.
  • 409CONFLICT (or a code-specific 409): the change clashes with existing state.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.

List approval policies

GET/api/v1/switch/approval-policies

Access
API key. Scoped keys need switch:manage.
Rate limit
100 requests per second (the default)

Response 200

FieldTypeDescription
datarequiredobject-
policiesrequireddata.policiesobject[]-
eligiblerequireddata.eligiblestring[]Permissions that can be put behind an approval
pendingrequireddata.pendinginteger-

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 402SWITCH_SUBSCRIPTION_REQUIRED: the account has no active Switch plan or trial.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.

Set the approval policy for a permission

PUT/api/v1/switch/approval-policies

Access
API key. Scoped keys need switch:manage.
Rate limit
100 requests per second (the default)

Require a second person to approve actions under this permission, optionally only above an amount.

Test keys: refused with 403 TEST_KEY_NOT_ALLOWED. The Switch has no test mode, so a change always applies to your live configuration. Test keys can still read Switch data.

Request body (application/json)

FieldTypeDescription
permissionrequiredstring-One of customers.view, trunks.view, routing.view, rates.view, billing.view, noc.view, audit.view, team.view, customers.edit, trunks.edit, rates.edit, billing.edit and 12 more
enabledrequiredboolean-
minAmountUsdnumber | null-min 0
requireDifferentPersonboolean-
expiresAfterHoursinteger-1 to 2160
requireReasonboolean-

Response 200

FieldTypeDescription
datarequiredobject-

Response 202

FieldTypeDescription
datarequiredobject-
approvalRequireddata.approvalRequiredboolean-One of true
approvalRequestIddata.approvalRequestIdstring (uuid) | null-
permissiondata.permissionstring-
expiresAtdata.expiresAtstring (date-time)-
messagedata.messagestring-

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 402SWITCH_SUBSCRIPTION_REQUIRED: the account has no active Switch plan or trial.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 409CONFLICT (or a code-specific 409): the change clashes with existing state.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.