API reference › Service setup › Rate types

Create a new rate type

POST /v1/rates

Scope
settings_service_setup:write
Roles
admin, scheduler

Create a new rate type with a name and optional tenant ID.

Parameters

None of its own.

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

Request body required

FieldTypeDescription
name requiredstring

Example test.

billingMethodstring or null

Example timeBased.

startTimestring (time) or null

Example 11:15:00.

endTimestring (time) or null

Example 11:20:00.

requestTiminginteger or null

Example 1.

Example

JSON
{
  "name": "test",
  "billingMethod": "timeBased",
  "startTime": "11:15:00",
  "endTime": "11:20:00",
  "requestTiming": "1"
}

Example request

Shell
curl -X POST "https://api.fetchfido.ai/v1/rates" \
  -H "Authorization: Bearer $FIDO_API_KEY" \
  -H "X-Tenant-ID: $FIDO_TENANT_ID" \
  -H "Content-Type: application/json" \
  -d '{"name":"test","billingMethod":"timeBased","startTime":"11:15:00","endTime":"11:20:00","requestTiming":"1"}'

Try it

Responses

201 Rate type created successfully

Rate type created successfully.

JSON
{
  "success": true,
  "message": "Rate type created!",
  "data": {
    "id": 10,
    "name": "New rate type",
    "isCustom": true
  }
}
Response fields (6)
FieldTypeDescription
successboolean

Example true.

messagestring

Example Rate type created!.

dataobject
data.idinteger

Example 10.

data.namestring

Example New rate type.

data.isCustomboolean

Example true.

400 Bad request

Validation failed.

JSON
{
  "success": false,
  "message": "The name field is required."
}
Response fields (2)
FieldTypeDescription
successboolean

Example false.

messagestring

Example The name field is required..

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 'settings_service_setup:write' 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 'settings_service_setup:write' 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!"
}
Response fields (2)
FieldTypeDescription
successboolean

Example false.

messagestring

Example Something went wrong!.