SuitePortal
Developer GuideAPI Reference

Transaction Endpoints

API endpoints for reading synced transaction data

Transaction Endpoints

Access synced transaction data from NetSuite via the SuitePortal API.

Endpoints

EndpointRecord TypeDescription
GET /api/v1/invoicesinvoiceInvoice transactions
GET /api/v1/salessaleSales orders
GET /api/v1/purchasespurchasePurchase orders
GET /api/v1/fulfillmentsfulfillmentItem fulfillments

GET /api/v1/invoices

Retrieve invoice transaction data.

Request

curl -X GET "https://suiteportal.io/api/v1/invoices?page=1&pageSize=50" \
  -H "Authorization: Bearer sp-1703123456789-abc123def456"

Query Parameters

ParameterTypeDefaultDescription
pagenumber1Page number
pageSizenumber50Records per page
searchstringSearch tranId, entity, memo
sortBystringtranDateSort field
sortDirectionstringascasc or desc
filters[]stringFilter as key:value

Response

{
  "data": [
    {
      "_id": "tenant-123:transaction:invoice:456",
      "nsId": "456",
      "recordType": "invoice",
      "syncedAt": "2024-01-15T10:30:00.000Z",
      "data": {
        "tranId": "INV-001",
        "entity": "12345",
        "tranDate": "2024-01-15",
        "dueDate": "2024-02-15",
        "total": 1000.00,
        "status": "open",
        "memo": "Invoice for services"
      }
    }
  ],
  "total": 100,
  "page": 1,
  "pageSize": 50,
  "totalPages": 2
}

GET /api/v1/sales

Retrieve sales order transaction data.

Request

curl -X GET "https://suiteportal.io/api/v1/sales?page=1&pageSize=50" \
  -H "Authorization: Bearer sp-1703123456789-abc123def456"

Response

{
  "data": [
    {
      "_id": "tenant-123:transaction:sale:789",
      "nsId": "789",
      "recordType": "sale",
      "syncedAt": "2024-01-15T10:30:00.000Z",
      "data": {
        "tranId": "SO-001",
        "entity": "12345",
        "tranDate": "2024-01-15",
        "total": 2500.00,
        "status": "pendingFulfillment"
      }
    }
  ],
  "total": 50,
  "page": 1,
  "pageSize": 50,
  "totalPages": 1
}

GET /api/v1/purchases

Retrieve purchase order transaction data.

Request

curl -X GET "https://suiteportal.io/api/v1/purchases?page=1&pageSize=50" \
  -H "Authorization: Bearer sp-1703123456789-abc123def456"

Response

{
  "data": [
    {
      "_id": "tenant-123:transaction:purchase:321",
      "nsId": "321",
      "recordType": "purchase",
      "syncedAt": "2024-01-15T10:30:00.000Z",
      "data": {
        "tranId": "PO-001",
        "entity": "67890",
        "tranDate": "2024-01-10",
        "total": 5000.00,
        "status": "pendingReceipt"
      }
    }
  ],
  "total": 25,
  "page": 1,
  "pageSize": 50,
  "totalPages": 1
}

GET /api/v1/fulfillments

Retrieve item fulfillment transaction data.

Request

curl -X GET "https://suiteportal.io/api/v1/fulfillments?page=1&pageSize=50" \
  -H "Authorization: Bearer sp-1703123456789-abc123def456"

Response

{
  "data": [
    {
      "_id": "tenant-123:transaction:fulfillment:555",
      "nsId": "555",
      "recordType": "fulfillment",
      "syncedAt": "2024-01-15T10:30:00.000Z",
      "data": {
        "tranId": "IF-001",
        "entity": "12345",
        "tranDate": "2024-01-14",
        "status": "shipped"
      }
    }
  ],
  "total": 75,
  "page": 1,
  "pageSize": 50,
  "totalPages": 2
}

Filtering Examples

Filter by Status

curl -X GET "https://suiteportal.io/api/v1/invoices?filters[]=status:open" \
  -H "Authorization: Bearer sp-1703123456789-abc123def456"

Multiple Filters

curl -X GET "https://suiteportal.io/api/v1/invoices?filters[]=status:open&filters[]=entity:12345" \
  -H "Authorization: Bearer sp-1703123456789-abc123def456"

Search with Pagination

curl -X GET "https://suiteportal.io/api/v1/sales?search=ACME&page=2&pageSize=25" \
  -H "Authorization: Bearer sp-1703123456789-abc123def456"

Sort Descending by Date

curl -X GET "https://suiteportal.io/api/v1/invoices?sortBy=tranDate&sortDirection=desc" \
  -H "Authorization: Bearer sp-1703123456789-abc123def456"

Code Examples

JavaScript/TypeScript

async function getInvoices(
  apiKey: string,
  page: number = 1,
  pageSize: number = 50
) {
  const response = await fetch(
    `https://suiteportal.io/api/v1/invoices?page=${page}&pageSize=${pageSize}`,
    {
      method: 'GET',
      headers: {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json',
      },
    }
  );

  if (!response.ok) {
    const error = await response.json();
    throw new Error(error.error || 'Failed to fetch invoices');
  }

  return await response.json();
}

// Usage
const result = await getInvoices('sp-1703123456789-abc123def456');
console.log(`Found ${result.total} invoices`);

Python

import requests

def get_invoices(api_key: str, page: int = 1, page_size: int = 50):
    url = "https://suiteportal.io/api/v1/invoices"
    headers = {
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    }
    params = {
        "page": page,
        "pageSize": page_size,
    }
    
    response = requests.get(url, headers=headers, params=params)
    response.raise_for_status()
    return response.json()

# Usage
result = get_invoices("sp-1703123456789-abc123def456")
print(f"Found {result['total']} invoices")

Notes

  • The rawData field is excluded from responses
  • All timestamps are ISO 8601 format
  • Pagination is 1-indexed
  • Search is case-insensitive
  • Filters use exact matching