Back to Home

Documentation

Everything you need to know to get the most out of DiscountFlow. Find guides, tutorials, and API references.

Quick Start
API References
FAQs

API References

API References
/
API Endpoints
/
Create approval leavel

Create approval leavel

Create new approval level

createApprovalLevel

Creates a new approval level. Returns the created ApprovalLevel object.

Method

POST

Path

/graphql

Authentication

Bearer Token

Request Body Schema

Content-type: application/json

Variables

NameTypeRequiredDescription
input.nameStringRequiredDisplay name of the approval level
input.codeStringRequiredShort code identifier (e.g. "MGR")
input.rankIntRequiredNumeric rank; lower values indicate lower authority
input.threshold_price_requestedFloatOptionalMaximum requested price this level can handle
input.threshold_price_approvedFloatOptionalMaximum price this level can approve
input.descriptionStringOptionalDescription of the approval level

Example Payload

{
  "query": "mutation ($input: CreateApprovalLevelInput!) { createApprovalLevel(input: $input) { id name code rank threshold_price_requested threshold_price_approved } }",
  "variables": {
    "input": {
      "name": "Manager",
      "code": "MGR",
      "rank": 2,
      "threshold_price_requested": 10000.0,
      "threshold_price_approved": 8000.0,
      "description": "Manager-level approvals"
    }
  }
}

Response

Returns the newly created ApprovalLevel object.

Example Response

{
  "data": {
    "createApprovalLevel": {
      "id": "01JNQX4KZB7WNVR3MPXT6A0002",
      "name": "Manager",
      "code": "MGR",
      "rank": 2,
      "threshold_price_requested": 10000.0,
      "threshold_price_approved": 8000.0
    }
  }
}

Errors

Validation errors are returned when required fields are missing.

Example Response

{
  "errors": [
    {
      "message": "Validation failed for the field [createApprovalLevel].",
      "extensions": {
        "validation": {
          "input.name": ["The input.name field is required."],
          "input.code": ["The input.code field is required."],
          "input.rank": ["The input.rank field is required."]
        }
      }
    }
  ]
}