API reference › Schedule › Assign and availability

Assign service providers to assignment(s) or shift(s)

POST /v1/schedule/assign-provider

Scope
schedule:read
Roles
admin, scheduler

Assign one or more service providers to one or more assignments or shifts. Supports multiple service types and location types per provider.

Parameters

None of its own.

Every call also sends Authorization and X-Tenant-ID; see Getting started.

Request body required

Assignment or shift provider assignment payload

FieldTypeDescription
typestring

Type of entity to assign providers to

One of: assignment, shift. Example assignment.

assignmentIdarray of string

Array of assignment IDs (required if type=assignment)

shiftIdarray of string

Array of shift IDs (required if type=shift)

assignProvidersarray of object

List of providers to assign

assignProviders[].idstring

Service provider ID

Example SPR-M8F6NP.

methodstring

How providers should be assigned: direct assigns immediately, accept/express-interest place the provider in pending status

One of: direct, accept, express-interest. Example direct.

locationTypearray of string

Location type(s) to assign the provider under (also accepts a single string). Each service type is assigned under whichever of these locations offers it. When omitted, all assignment/shift locations are considered

serviceTypearray of integer

Service type IDs to assign providers under for this request

serviceProviderTypearray of integer

Service provider type ID(s), e.g. Hearing Interpreter (also accepts a single integer). Each is only applied to the serviceType it actually belongs to, and at most one provider type is assigned per service type

Example

JSON
{
  "type": "assignment",
  "assignmentId": [
    "ASG-XDMSDH"
  ],
  "shiftId": [
    "SFT-8Z13C5"
  ],
  "assignProviders": [
    {
      "id": "SPR-M8F6NP"
    }
  ],
  "method": "direct",
  "locationType": [
    "onsite"
  ],
  "serviceType": [
    1
  ],
  "serviceProviderType": [
    2
  ]
}

Example request

Shell
curl -X POST "https://api.fetchfido.ai/v1/schedule/assign-provider" \
  -H "Authorization: Bearer $FIDO_API_KEY" \
  -H "X-Tenant-ID: $FIDO_TENANT_ID" \
  -H "Content-Type: application/json" \
  -d '{"type":"assignment","assignmentId":["ASG-XDMSDH"],"shiftId":["SFT-8Z13C5"],"assignProviders":[{"id":"SPR-M8F6NP"}],"method":"direct","locationType":["onsite"],"serviceType":[1],"serviceProviderType":[2]}'

Try it

Responses

201 Providers assigned successfully

Providers assigned successfully

JSON
{
  "success": true,
  "message": "Providers assigned successfully.",
  "data": {
    "ids": [
      "ASG-XDMSDH"
    ]
  }
}
Response fields (4)
FieldTypeDescription
successboolean

Example true.

messagestring

Example Providers assigned successfully..

dataobject
data.idsarray of string

List of assignment or shift IDs that were processed

400 Bad request

Bad request or missing parameters

JSON
{
  "success": false,
  "message": "Missing assignment/shift ID(s) or providers data.",
  "errors": "Invalid Request"
}
Response fields (3)
FieldTypeDescription
successboolean

Example false.

messagestring

Example Missing assignment/shift ID(s) or providers data..

errorsstring

Example Invalid Request.

401 Not signed in

Missing, invalid or expired API key.

JSON
{
  "success": false,
  "message": "Invalid API key. Org and user tier keys must send an X-Tenant-ID header naming the organization the key was issued for.",
  "errors": null,
  "code": "API_KEY_MISSING"
}
Response fields (4)
FieldTypeDescription
successboolean

Example false.

messagestring

Example Invalid API key. Org and user tier keys must send an X-Tenant-ID header naming the organization the key was issued for..

errorsany or null

Null on this status.

codestring

Machine-readable reason, for branching on in client code.

One of: API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED. Example API_KEY_MISSING.

403 Not allowed

Scope, tenant, IP allow-list or RBAC check failed.

JSON
{
  "success": false,
  "message": "You don't have permission to access this endpoint. This API key is missing the 'schedule:read' scope.",
  "errors": null,
  "code": ""
}
Response fields (4)
FieldTypeDescription
successboolean

Example false.

messagestring

Example You don't have permission to access this endpoint. This API key is missing the 'schedule:read' scope..

errorsany or null

Null on this status.

codestring

Always empty on this status.

Example .

429 Too many requests

Rate limit exceeded. See Retry-After.

JSON
{
  "success": false,
  "message": "You've exceeded this API key's rate limit of 120 requests per minute. Try again in 37 seconds.",
  "errors": null,
  "code": "RATE_LIMITED"
}
Response fields (4)
FieldTypeDescription
successboolean

Example false.

messagestring

Example You've exceeded this API key's rate limit of 120 requests per minute. Try again in 37 seconds..

errorsany or null

Null on this status.

codestring

Machine-readable reason, for branching on in client code.

One of: RATE_LIMITED. Example RATE_LIMITED.

500 Server error

Internal server error

JSON
{
  "success": false,
  "message": "Something went wrong!",
  "errors": "Service provider assignment failed."
}
Response fields (3)
FieldTypeDescription
successboolean

Example false.

messagestring

Example Something went wrong!.

errorsstring or null

Null in production. The exception message only when the application runs with debug on.

Example Service provider assignment failed..