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 Endpoints
/
Create approval request

Create approval request

Delete approval request by ID

createApprovalRequest

Creates a new approval request. The authenticated user is automatically associated as the tenant owner. Returns the created ApprovalRequest object.

Method

POST

Path

/graphql

Authentication

Bearer Token

Request Body Schema

Content-type: application/json

Variables

NameTypeRequiredDescription
input.sales_contactStringOptionalName of the sales contact
input.request_typeStringOptionalType of request (e.g. "standard")
input.request_dateDateOptionalDate of the request (Y-m-d)
input.sales_regionStringOptionalSales region (e.g. "NA", "EMEA")
input.validity_periodStringOptionalHow long the approval remains valid
input.customer_nameStringOptionalCustomer name
input.project_nameStringOptionalProject name
input.account_numberStringOptionalCustomer account number
input.end_customer_nameStringOptionalEnd customer name (if different from customer)
input.rep_firmStringOptionalRepresentative firm name
input.expected_delivery_dateDateOptionalExpected delivery date (Y-m-d)
input.other_detailsJSONOptionalArbitrary additional data

Example Payload

{
  "query": "mutation ($input: CreateApprovalRequestInput!) { createApprovalRequest(input: $input) { id customer_name status created_at } }",
  "variables": {
    "input": {
      "sales_contact": "John Smith",
      "request_type": "standard",
      "request_date": "2026-06-03",
      "sales_region": "NA",
      "customer_name": "Acme Corp",
      "project_name": "Q2 Expansion",
      "account_number": "ACME-001",
      "end_customer_name": "Acme Industries",
      "expected_delivery_date": "2026-09-01"
    }
  }
}

Response

Returns the newly created ApprovalRequest object.

Example Response

{
  "data": {
    "createApprovalRequest": {
      "id": "01JNQX4KZB7WNVR3MPXT6A0010",
      "customer_name": "Acme Corp",
      "status": "pending",
      "created_at": "2026-06-03 08:00:00"
    }
  }
}

Errors

Example Response

{
  "errors": [
    {
      "message": "Unauthenticated."
    }
  ]
}