Skip to content

Aiwyn API (1.0.0)

Welcome to Aiwyn API

The Aiwyn API provides programmatic access to our comprehensive suite of financial automation tools. Build powerful integrations and automate your accounting workflows with our RESTful APIs.

Key Features

  • 🔐 Secure Authentication - Industry-standard OAuth 2.0 and API key authentication
  • 📊 Real-time Data - Access up-to-date financial information
  • 🚀 High Performance - Low latency, high throughput API infrastructure
  • 📚 Comprehensive Coverage - Full access to clients, engagements, expenses, and more
  • 🛠️ Developer-Friendly - Extensive documentation, SDKs, and code examples

API Versioning

We use URL versioning for our APIs. The current version is v1. All endpoints are prefixed with the version number.

Download OpenAPI description
Overview
Languages
Servers
Mock server
https://api.doc.aiwyn.ai/_mock/bundle/
Staging Environment (Test Data)
https://demo.api.aiwyn.ai/

🔐 Authentication

Authentication endpoints for obtaining access tokens and managing API keys.

Operations

👤 Client

Manage client records, profiles, and related operations.

Operations

📇 Contact

Manage contact information and relationships for clients.

Operations

🧑‍💼 Staff

Manage staff accounts, roles, and permissions.

Operations

💳 Payments

Handle incoming and outgoing payments.

Operations

🧾 Billing

Manage billing cycles, statements, and billing configurations.

Operations

List draft invoice histories

Request

Retrieve draft invoice histories with basic pagination support

Provides paginated access to draft invoice history records.

Real Example:

curl --location 'https://{{host}}/v1/draft_invoice_histories' \
--header 'Authorization: bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
  "pageSize": 25,
  "page": 0
}'
Security
BearerAuth
Bodyapplication/json
pageSizeinteger[ 1 .. 1000 ]

Maximum number of records to return

Default 50
pageinteger>= 0

Number of records to skip for pagination

Default 0
curl -i -X POST \
  https://api.doc.aiwyn.ai/_mock/bundle/gql/v1/draft_invoice_histories \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "pageSize": 25,
    "page": 0
  }'

Responses

Successfully retrieved draft invoice histories

Bodyapplication/json
draftInvoicesArray of objects(DraftInvoiceHistory)
totalobject
Response
application/json
{ "draftInvoices": [ {} ], "total": { "aggregate": {} } }

Search draft invoice histories

Request

Advanced draft invoice history filtering with custom GraphQL where clauses and dynamic ordering

Supports client, invoice, job filtering and draftInvoice approvedAt date range.

Real Example:

curl --location 'https://{{host}}/v1/draft_invoice_histories/search' \
--header 'Authorization: bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
  "pageSize": 1,
  "where": {
    "_and": [
      {
        "_or": [
          {
            "clientId": {
              "_in": [1001, 1002]
            }
          },
          {
            "jobId": {
              "_in": [2001, 2002]
            }
          }
        ]
      },
      {
        "active": {
          "_eq": true
        }
      },
      {
        "createdAt": {
          "_gte": "1900-01-01T00:00:00Z"
        }
      },
      {
        "activityType": {
          "_in": [
            "DRAFT_INVOICE_CREATED",
            "DRAFT_INVOICE_RECONCILED"
          ]
        }
      }
    ]
  },
  "orderBy": [
    {
      "clientId": "asc"
    },
    {
      "createdAt": "desc"
    }
  ]
}'
Security
BearerAuth
Bodyapplication/json
pageSizeinteger[ 1 .. 1000 ]
Default 1
whereobject

GraphQL-style where clause for complex filtering

Example: {"_and":[{"_or":[{"clientId":{"_in":[1001,1002]}},{"jobId":{"_in":[2001,2002]}}]},{"active":{"_eq":true}},{"createdAt":{"_gte":"1900-01-01T00:00:00Z"}},{"activityType":{"_in":["DRAFT_INVOICE_CREATED","DRAFT_INVOICE_RECONCILED"]}}]}
orderByArray of objects

Dynamic ordering specifications

Example: [{"clientId":"asc"},{"createdAt":"desc"}]
curl -i -X POST \
  https://api.doc.aiwyn.ai/_mock/bundle/gql/v1/draft_invoice_histories/search \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "pageSize": 1,
    "where": {
      "_and": [
        {
          "_or": [
            {
              "clientId": {
                "_in": [
                  1001,
                  1002
                ]
              }
            },
            {
              "jobId": {
                "_in": [
                  2001,
                  2002
                ]
              }
            }
          ]
        },
        {
          "active": {
            "_eq": true
          }
        },
        {
          "createdAt": {
            "_gte": "1900-01-01T00:00:00Z"
          }
        },
        {
          "activityType": {
            "_in": [
              "DRAFT_INVOICE_CREATED",
              "DRAFT_INVOICE_RECONCILED"
            ]
          }
        }
      ]
    },
    "orderBy": [
      {
        "clientId": "asc"
      },
      {
        "createdAt": "desc"
      }
    ]
  }'

Responses

Successfully retrieved filtered draft invoice histories

Bodyapplication/json
draftInvoicesArray of objects(DraftInvoiceHistory)
totalobject
Response
application/json
{ "draftInvoices": [ {} ], "total": { "aggregate": {} } }

Get draft invoice by ID

Request

Retrieve a specific draft invoice by its unique identifier

This endpoint provides detailed draft invoice information including:

  • Complete draft invoice details and line items
  • Draft status and review information
  • Client and project relationships
  • Tax calculations and compliance data
  • Review history and approval workflow
  • Document generation and delivery preparation

Draft Invoice Management Features:

  • Draft invoice lifecycle tracking
  • Review and approval workflow
  • Tax calculation and compliance
  • Client relationship integration
  • Document preparation and delivery setup

Draft Invoice Details Include:

  • Draft invoice number and reference
  • Draft status and review status
  • Client and project information
  • Line items and amounts
  • Tax calculations
  • Review history

Business Applications:

  • Draft invoice review and approval
  • Tax compliance verification
  • Client billing preparation
  • Revenue recognition planning
  • Document generation preparation

Real Example:

curl --location 'https://{{host}}/v1/draft_invoice/56789' \
--header 'Authorization: bearer {{token}}' \
--header 'Content-Type: application/json'

Response Example:

{
  "id": 56789,
  "draftNumber": "DRAFT-2024-001",
  "reference": "Q4-AUDIT-DRAFT-2024",
  "status": "UNDER_REVIEW",
  "reviewStatus": "PENDING_APPROVAL",
  "clientId": 789,
  "clientName": "Acme Corporation",
  "clientEmail": "billing@acme.com",
  "projectId": 67890,
  "projectName": "Q4 Financial Audit",
  "preparedDate": "2024-12-01T00:00:00Z",
  "proposedIssueDate": "2024-12-15T00:00:00Z",
  "proposedDueDate": "2025-01-15T23:59:59Z",
  "subtotal": 20000.00,
  "taxAmount": 2000.00,
  "totalAmount": 22000.00,
  "currency": "USD",
  "lineItems": [
    {
      "id": 1,
      "description": "Financial Statement Audit",
      "quantity": 80,
      "unitPrice": 250.00,
      "amount": 20000.00,
      "taxRate": 0.10,
      "notes": "Includes fieldwork and report preparation"
    }
  ],
  "reviewHistory": [
    {
      "id": 1,
      "reviewerId": 123,
      "reviewerName": "John Smith",
      "reviewDate": "2024-12-05T10:30:00Z",
      "status": "APPROVED",
      "comments": "All calculations verified and approved"
    },
    {
      "id": 2,
      "reviewerId": 124,
      "reviewerName": "Jane Doe",
      "reviewDate": "2024-12-06T14:15:00Z",
      "status": "PENDING_APPROVAL",
      "comments": "Pending final review"
    }
  ],
  "notes": "Draft invoice for Q4 audit services - pending final review",
  "createdAt": "2024-12-01T09:00:00Z",
  "updatedAt": "2024-12-06T14:15:00Z"
}
Security
BearerAuth
Path
idinteger>= 1required

Unique identifier of the draft invoice

Example: 56789
curl -i -X GET \
  https://api.doc.aiwyn.ai/_mock/bundle/gql/v1/draft_invoice/56789 \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>'

Responses

Draft invoice details retrieved successfully

Bodyapplication/json
idinteger

Unique draft invoice identifier

Example: 56789
draftNumberstring

Draft invoice number

Example: "DRAFT-2024-001"
referencestring

Draft invoice reference or description

Example: "Q4-AUDIT-DRAFT-2024"
statusstring

Draft invoice status

Enum"DRAFT""UNDER_REVIEW""APPROVED""REJECTED""CONVERTED"
Example: "UNDER_REVIEW"
reviewStatusstring

Review status

Enum"NOT_STARTED""IN_REVIEW""PENDING_APPROVAL""APPROVED""REJECTED"
Example: "PENDING_APPROVAL"
clientIdinteger

Associated client identifier

Example: 789
clientNamestring

Client name

Example: "Acme Corporation"
clientEmailstring

Client billing email

Example: "billing@acme.com"
projectIdinteger

Associated project identifier

Example: 67890
projectNamestring

Project name

Example: "Q4 Financial Audit"
preparedDatestring(date-time)

Date when draft was prepared

Example: "2024-12-01T00:00:00Z"
proposedIssueDatestring(date-time)

Proposed invoice issue date

Example: "2024-12-15T00:00:00Z"
proposedDueDatestring(date-time)

Proposed invoice due date

Example: "2025-01-15T23:59:59Z"
subtotalnumber(decimal)

Draft subtotal before tax

Example: 20000
taxAmountnumber(decimal)

Total tax amount

Example: 2000
totalAmountnumber(decimal)

Total draft amount including tax

Example: 22000
currencystring

Draft currency code

Example: "USD"
lineItemsArray of objects

Draft invoice line items

reviewHistoryArray of objects

Review history for this draft invoice

notesstring

Additional notes or terms

Example: "Draft invoice for Q4 audit services - pending final review"
createdAtstring(date-time)

Draft invoice creation timestamp

Example: "2024-12-01T09:00:00Z"
updatedAtstring(date-time)

Last update timestamp

Example: "2024-12-06T14:15:00Z"
Response
application/json
{ "id": 56789, "draftNumber": "DRAFT-2024-001", "reference": "Q4-AUDIT-DRAFT-2024", "status": "UNDER_REVIEW", "reviewStatus": "PENDING_APPROVAL", "clientId": 789, "clientName": "Acme Corporation", "clientEmail": "billing@acme.com", "projectId": 67890, "projectName": "Q4 Financial Audit", "preparedDate": "2024-12-01T00:00:00Z", "proposedIssueDate": "2024-12-15T00:00:00Z", "proposedDueDate": "2025-01-15T23:59:59Z", "subtotal": 20000, "taxAmount": 2000, "totalAmount": 22000, "currency": "USD", "lineItems": [ {} ], "reviewHistory": [ {} ], "notes": "Draft invoice for Q4 audit services - pending final review", "createdAt": "2024-12-01T09:00:00Z", "updatedAt": "2024-12-06T14:15:00Z" }

📄 Invoices

Create, send, and manage invoices.

Operations

📋 Projects

Handle engagements, projects, and workflow tracking.

Operations

⏱ Time

Track and manage billable and non-billable time entries.

Operations

✉️ Engagement

Create, send, and track engagement.

Operations

🛤 Last Mile

Handle the final delivery stage and client closing processes.