Skip to main content
POST
/
v1
/
treatments
Create a treatment
curl --request POST \
  --url https://dev.flextell.ai/api/v1/treatments \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Tenant: <x-tenant>' \
  --data '
{
  "name": "<string>",
  "price": 1,
  "session": 2,
  "is_active": true,
  "group_id": 123,
  "description": "<string>",
  "extra_info": {
    "control_min_days": "7",
    "minimum_cc": "2"
  },
  "keywords": [
    "<string>"
  ],
  "sessions": [
    {
      "session_order": 2,
      "next_gap_days": 2,
      "offset_days": 1,
      "products": [
        {
          "product_id": 123,
          "min_quantity": 1
        }
      ]
    }
  ]
}
'
{
  "success": "<string>",
  "data": {
    "id": 123,
    "group_id": 123,
    "name": "<string>",
    "keywords": [
      "<unknown>"
    ],
    "price": "<string>",
    "tax_rate": 123,
    "description": "<string>",
    "session": 123,
    "is_active": "<string>",
    "extra_info": {},
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "deleted_at": "2023-11-07T05:31:56Z",
    "group": {
      "id": 123,
      "name": "<string>",
      "is_active": true
    },
    "users": [
      {
        "id": 123,
        "name": "<string>"
      }
    ],
    "sessions": [
      {
        "id": 123,
        "session_order": 123,
        "next_gap_days": 123,
        "offset_days": 123,
        "products": [
          {
            "id": 123,
            "product_id": 123,
            "min_quantity": 123,
            "product": {
              "id": 123,
              "name": "<string>",
              "full_name": "<string>",
              "brand": {
                "id": 123,
                "name": "<string>"
              },
              "unit_code": {
                "id": "<string>",
                "name": "<string>",
                "code": "<string>"
              }
            }
          }
        ]
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Headers

X-Tenant
number
required

Tenant identifier. Send the Tenant ID in the X-Tenant header to scope API requests to a specific tenant.

Body

application/json
name
string
required

Treatment name.

Maximum string length: 255
price
number
required

Treatment price.

Required range: x >= 0
tax_rate
enum<integer>
required

Tax rate (KDV).

Available options:
0,
1,
10,
20
session
integer
required

Number of sessions.

Required range: x >= 1
is_active
boolean
required

Active status.

group_id
integer | null

Treatment group identifier (must belong to current tenant).

description
string | null

Treatment description.

Maximum string length: 65535
extra_info
object

Extra information as associative key-value pairs.

Example:
{
"control_min_days": "7",
"minimum_cc": "2"
}
keywords
string[] | null

Search keywords for the treatment.

A keyword string.

Maximum string length: 100
sessions
object[] | null

Treatment sessions plan.

Response

success
string
required
data
TreatmentResource · object
required