# Create task-worker pairing config


Create a new task-worker pairing config.
Changes here will not take effect until synchronization is run. See:
<a href="/api-docs/api-public/task-worker-pairing-configs/peach.twilio.taskrouter.handlers_task_worker_pairing_configs.task_worker_pairing_config_sync">Sync task-worker pairing configs to Twilio</a>

Endpoint: POST /companies/{companyId}/task-worker-pairing-configs
Version: 2025-03-26
Security: oauth2, bearerAuth, apiKeyHeader

## Path parameters:

  - `companyId` (string, required)
    The unique company identifier.

## Request fields (application/json):

  - `externalId` (string)

  - `name` (string)
    A human-readable name for this pairing config.

  - `overrideTwilioTaskWorkflowExpression` (string)
    If the characteristics of the tasks you wish to match cannot be fully described by the
`taskMatch` object, you can override the Twilio "TaskRouter expression" used
to match the workers by settings this field. (In which case you will see the
value set here in the field `twilioTaskWorkflowExpression` as well.)
This field's syntax must conform to the Twilio "TaskRouter Expression" syntax[1].
Since this syntax is not validated here, it may be difficult to debug invalid
expressions; as such, it is recommended you use the `taskMatch` object when possible.
Some useful expression examples for TaskRouter task attributes:
- Matching a task with an email interaction which was sent to the email
address `support@loans.acme.com`.
`interaction.channel = "email" AND "support@loans.acme.com" IN interactionMeta.recipients.emails`
- Matching an inbound phone call to a particular support phone number `+15555555555`:
`interaction.channel = "voice" AND interactionMeta.to.phone = "+15555555555"`

[1] https://www.twilio.com/docs/taskrouter/expression-syntax

  - `overrideTwilioWorkerQueueExpression` (string)
    If the characteristics of the workers you wish to match cannot be fully described by the
`workerMatch` object, you can override the Twilio "TaskRouter expression" used
to match the workers by settings this field. (In which case you will see the
value set here in the field `twilioWorkerQueueExpression` as well.)
This field's syntax must conform to the Twilio "TaskRouter Expression" syntax[1].
Since this syntax is not validated here, it may be difficult to debug invalid
expressions; as such, it is recommended you use the `workerMatch` object when possible.
[1] https://www.twilio.com/docs/taskrouter/expression-syntax

  - `priority` (integer)
    The order in which this pairing config should be evaluated. Higher numbers are evaluated first.
Note that the default pairing config is always evaluated LAST (and it's `priority` is always `null`.)

  - `taskMatch` (object)

  - `taskMatch.case` (object)

  - `taskMatch.case.autocreated` (boolean)
    If `true` only match tasks with autocreated cases. If `false` match not-autocreated cases. If `null` match any.

  - `taskMatch.case.caseTypeEnums` (array)
    List of `caseType`; match any task with a case with a case type matching in the list.
Note this field is different from `caseTypeIds`, which matches on specific case type instance rather than the case type enum. If `null` match any case.

  - `taskMatch.case.caseTypeIds` (array)
    List of case type IDs; match any task with a case with a case type present in the list.
Note this field is different from `caseTypeEnums`, which matches on case type enum rather than a specific case type instance. If `null` match any.

  - `taskMatch.interaction` (object)

  - `taskMatch.interaction.channels` (array)
    List of `interactionChannel`. Match any task with an `interaction` which has an `channel` present in the list. If `null` match any.

  - `taskMatch.interaction.directions` (array)
    List of `interactionDirections`. Match any task with an `interaction` which has an `direction` present in the list. If `null` match any.

  - `taskMatch.interaction.subjects` (array)
    List of `interactionSubject`. Match any task with an `interaction` which has an `subject` present in the list. If `null` match any.

  - `taskMatch.interaction.themes` (array)
    List of `interactionTheme`. Match any task with an `interaction` which has an `theme` present in the list. If `null` match any.

  - `taskMatch.not` (boolean)
    If `true` then match tasks NOT matching those specified in this `taskMatch` object.
(Look in the `twilioWorkerQueueExpression` to see each individual expression clause
`NOT`-ed when this is set.)

  - `taskMatch.supercase` (object)

  - `taskMatch.supercase.supercaseTypeEnums` (array)
    List of `supercaseType`; match any task with a supercase with a supercase type matching in the list.
If `null` match any task.

  - `taskMatch.taskTypes` (array)

  - `workerMatch` (object)
    An object describing the characteristics of the workers to match to the tasks
matched in `taskMatch`.
The settings here are translated into Twilio "expression syntax"[1] and matched against
the workers' attributes. You can see the generated expression in the field
`twilioWorkerQueueExpression`.
[1] https://www.twilio.com/docs/taskrouter/expression-syntax

  - `workerMatch.isManager` (boolean)
    If `true` match only manager employees. If `false` match only non-manager employees. If `null`
match any.

  - `workerMatch.roleIds` (array)
    List of role IDs; match any employee which belongs to at least one of these roles. If `null` match any.

  - `workerMatch.teamIds` (array)
    List of team IDs; match any employee which belongs to at least one of these teams. If `null` match any.

## Response 200 fields (application/json):

  - `message` (string)
    Description of the server action or error.

  - `status` (integer)
    HTTP status code.

  - `data` (object)

  - `data.companyId` (string)

  - `data.createdAt` (string)

  - `data.deletedAt` (string)

  - `data.externalId` (string)

  - `data.id` (string)

  - `data.isDefault` (boolean)
    If `true` this pairing config is the default for the company. Only one pairing config
can be the default at a time.

  - `data.name` (string)
    A human-readable name for this pairing config.

  - `data.object` (string)

  - `data.overrideTwilioTaskWorkflowExpression` (string)
    If the characteristics of the tasks you wish to match cannot be fully described by the
`taskMatch` object, you can override the Twilio "TaskRouter expression" used
to match the workers by settings this field. (In which case you will see the
value set here in the field `twilioTaskWorkflowExpression` as well.)
This field's syntax must conform to the Twilio "TaskRouter Expression" syntax[1].
Since this syntax is not validated here, it may be difficult to debug invalid
expressions; as such, it is recommended you use the `taskMatch` object when possible.
Some useful expression examples for TaskRouter task attributes:
- Matching a task with an email interaction which was sent to the email
address `support@loans.acme.com`.
`interaction.channel = "email" AND "support@loans.acme.com" IN interactionMeta.recipients.emails`
- Matching an inbound phone call to a particular support phone number `+15555555555`:
`interaction.channel = "voice" AND interactionMeta.to.phone = "+15555555555"`

[1] https://www.twilio.com/docs/taskrouter/expression-syntax

  - `data.overrideTwilioWorkerQueueExpression` (string)
    If the characteristics of the workers you wish to match cannot be fully described by the
`workerMatch` object, you can override the Twilio "TaskRouter expression" used
to match the workers by settings this field. (In which case you will see the
value set here in the field `twilioWorkerQueueExpression` as well.)
This field's syntax must conform to the Twilio "TaskRouter Expression" syntax[1].
Since this syntax is not validated here, it may be difficult to debug invalid
expressions; as such, it is recommended you use the `workerMatch` object when possible.
[1] https://www.twilio.com/docs/taskrouter/expression-syntax

  - `data.priority` (integer)
    The order in which this pairing config should be evaluated. Higher numbers are evaluated first.
Note that the default pairing config is always evaluated LAST (and it's `priority` is always `null`.)

  - `data.taskMatch` (object)

  - `data.taskMatch.case` (object)

  - `data.taskMatch.case.autocreated` (boolean)
    If `true` only match tasks with autocreated cases. If `false` match not-autocreated cases. If `null` match any.

  - `data.taskMatch.case.caseTypeEnums` (array)
    List of `caseType`; match any task with a case with a case type matching in the list.
Note this field is different from `caseTypeIds`, which matches on specific case type instance rather than the case type enum. If `null` match any case.

  - `data.taskMatch.case.caseTypeIds` (array)
    List of case type IDs; match any task with a case with a case type present in the list.
Note this field is different from `caseTypeEnums`, which matches on case type enum rather than a specific case type instance. If `null` match any.

  - `data.taskMatch.interaction` (object)

  - `data.taskMatch.interaction.channels` (array)
    List of `interactionChannel`. Match any task with an `interaction` which has an `channel` present in the list. If `null` match any.

  - `data.taskMatch.interaction.directions` (array)
    List of `interactionDirections`. Match any task with an `interaction` which has an `direction` present in the list. If `null` match any.

  - `data.taskMatch.interaction.subjects` (array)
    List of `interactionSubject`. Match any task with an `interaction` which has an `subject` present in the list. If `null` match any.

  - `data.taskMatch.interaction.themes` (array)
    List of `interactionTheme`. Match any task with an `interaction` which has an `theme` present in the list. If `null` match any.

  - `data.taskMatch.not` (boolean)
    If `true` then match tasks NOT matching those specified in this `taskMatch` object.
(Look in the `twilioWorkerQueueExpression` to see each individual expression clause
`NOT`-ed when this is set.)

  - `data.taskMatch.supercase` (object)

  - `data.taskMatch.supercase.supercaseTypeEnums` (array)
    List of `supercaseType`; match any task with a supercase with a supercase type matching in the list.
If `null` match any task.

  - `data.taskMatch.taskTypes` (array)

  - `data.twilioTaskWorkflowExpression` (string)
    The Twilio "TaskRouter Expression" string used to match tasks.
This field is read-only because it's generated by configuring
the `taskMatch` object, or it's set via the `overrideTwilioTaskWorkflowExpression`
field.

  - `data.twilioWorkerQueueExpression` (string)
    The Twilio "TaskRouter expression" string used to match workers.
This field is read-only because it's generated by configuring
the `workerMatch` object, or it is set via the `overrideTwilioWorkerQueueExpression`
field.

  - `data.updatedAt` (string)

  - `data.workerMatch` (object)
    An object describing the characteristics of the workers to match to the tasks
matched in `taskMatch`.
The settings here are translated into Twilio "expression syntax"[1] and matched against
the workers' attributes. You can see the generated expression in the field
`twilioWorkerQueueExpression`.
[1] https://www.twilio.com/docs/taskrouter/expression-syntax

  - `data.workerMatch.isManager` (boolean)
    If `true` match only manager employees. If `false` match only non-manager employees. If `null`
match any.

  - `data.workerMatch.roleIds` (array)
    List of role IDs; match any employee which belongs to at least one of these roles. If `null` match any.

  - `data.workerMatch.teamIds` (array)
    List of team IDs; match any employee which belongs to at least one of these teams. If `null` match any.

