Schedule an outbound job
Resolves and snapshots contact hours, retry policy, deployed agent version, destination, and caller-ID route in one transaction. Exactly one of number_pool_id or phone_number_id is required; exactly one of contact_id or to_number is sufficient. Use Idempotency-Key for safe retries. On acceptance, wait for Retry-After and poll Location until the status is terminal.
bearerAuthAuthorizationBearer <token>Use a Voice API key or connected-app OAuth access token. Authentication.
Idempotency-Key*stringRequired. Reuse the same key to retry this write safely. Retries and idempotency.
^[A-Za-z0-9!#$%&'*+.^_`|~-]+$1 <= length <= 255application/json- body
Maximum encoded body size is 262144 bytes. max_attempts is a compatibility shorthand for policy_overrides.max_attempts; supplying both with different values is rejected.
agent_id*stringuuidagent_version?stringWhich of the agent's versions the call runs. production (the default) dials the deployed version; staging dials the version last promoted to staging so a change can be heard on a real call before it is deployed, and fails 409 no_staging_version when the agent has none. The resolved version id is stored on the job, so a later promote or deploy does not change what it dials. staging is only accepted with agent_id.
"production""production""staging"flow_id?stringSchedule the job against a flow instead of a single agent. The flow's start agent is resolved at create time and stored as the job's agent_id, with flow_id kept alongside as the annotation the dialer forwards at placement. Exactly one of agent_id and flow_id is required. Requires the flows entitlement, and the flow must be dispatchable now or the create fails 422 on flow_id.
uuidgroup_id?stringSchedule the job against a group of agents. One member is picked at create time for the destination number (the contact's stored number when contact_id is given) using the group's routing strategy. It is stored as the job's agent_id, with group_id and group_member_id alongside; placement and every retry dial that member, always on its production version (agent_version staging is rejected with 422 unsupported_with_group). Exactly one of agent_id, flow_id and group_id is required (422 exactly_one_required on group_id). Requires the groups entitlement, and the group must have a member that can take calls now or the create fails 422 on group_id (not_found, archived, no_members).
uuidcontact_id*stringuuidto_number?OutboundE164A dial target: an E.164 number, a bare internal number/extension of 1 to 20 [0-9*#] characters (e.g. 103, 2770124), or a sip:/sips: URI (e.g. sip:103@pbx.example.com).
^(\+[1-9][0-9]{7,14}|[0-9*#]{1,20}|sips?:[^@\s]+@[A-Za-z0-9._-]+(:[0-9]{1,5})?(;\S*)?)$number_pool_id*stringuuidphone_number_id?stringuuidtrunk_id?stringOptional route constraint. A forced phone number must belong to this trunk; a pool must have an eligible member on it.
uuidtransport?OutboundTransport"livekit_sip""twilio_media_streams"scheduled_at?stringRequested schedule instant. Past values are accepted and evaluated from the current instant for contact hours.
date-timecontact_timezone?stringLegacy per-call IANA timezone override. Prefer policy_overrides for new clients.
expires_at?stringExplicit expiry must be after scheduled_at and the next permitted contact-hours instant, and no more than 90 days after scheduled_at. When omitted, the policy TTL is added to the current evaluation instant for a past schedule, or to scheduled_at for a future schedule.
date-timemax_attempts?integer1 <= value <= 10policy_overrides?Per-job overrides. The organization policy may disable all overrides, and overridden windows must fit inside organization guardrails. timezone is accepted only with timezone_mode=custom; custom mode requires it.
priority?integerHigher values are claimed first among otherwise-due jobs.
-100 <= value <= 1000variables?properties <= 50metadata?dncr?Outbound job durably accepted. Poll the Location resource for state changes.
application/json- response
id*stringuuidstatus*OutboundJobStatus"scheduled""queued""claimed""reserving""dialing""ringing""active""retry_wait""completed""failed""canceled""expired""provider_unknown"scheduled_at*stringdate-timenot_before*stringEarliest instant after applying contact hours. Capacity may delay execution further.
date-timeexpires_at*stringdate-timecontact_timezone*stringpolicy_context*Immutable contact-hours decision stored on a job at creation time.
retry_policy*Immutable retry decision stored on a job at creation time. Capacity waits never consume a call attempt. A carrier or route failure (a SIP 5xx, or a call that could not be placed on the route) first gets a few retries that do not consume an attempt, with growing waits; we redial at once only when another trunk that has not yet failed this job is available. After that, each route failure consumes an attempt, so the job ends at max_attempts. A carrier's Retry-After is honored as the minimum wait, up to one hour.
max_attempts*integer1 <= value <= 10dncr?|curl -X POST 'https://api.kejue.co/v1/outbound-jobs' \ -H 'Idempotency-Key: string' \ -H 'Content-Type: application/json' \ -d '{}'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "status": "scheduled", "scheduled_at": "2019-08-24T14:15:22Z", "not_before": "2019-08-24T14:15:22Z", "expires_at": "2019-08-24T14:15:22Z", "contact_timezone": "string", "policy_context": { "schema_version": 1, "source": "organization", "org_policy_version": 0, "timezone": "string", "windows": [ { "weekdays": [ 1 ], "start": "09:00", "end": "17:00" } ] }, "retry_policy": { "version": 1, "source": "organization", "org_policy_version": 0, "destination_busy_backoff_seconds": [ 1 ], "destination_unavailable_backoff_seconds": [ 1 ], "destination_declined_backoff_seconds": [ 1 ], "retry_declined": true, "capacity_retry": { "minimum_seconds": 1, "maximum_seconds": 1, "jitter": true }, "ambiguous_provider_result": "reconcile_before_retry" }, "max_attempts": 1, "dncr": { "schema_version": 1, "requested": { "mode": "inherit", "connection_id": "d3547de1-d1f2-4344-b4c2-17169b7526f9" }, "enabled": true, "enforced": true, "connection_id": "d3547de1-d1f2-4344-b4c2-17169b7526f9", "policy_version": 0, "source": "organization" }}