Skip to main content
Use SuiteTalk REST, SuiteQL or the MCP Standard Tools to work with one account’s books. Your agent can move from sales order to invoice, payment and credit memo, or from purchase order to receipt, vendor bill and bill payment. Transactions update balances, inventory and the general ledger inside the world. The NetSuite API mock page has a scene and checks you can copy. Select this tool with twins: [netsuite] in a scene or --tools netsuite when creating a world. Inspect its API coverage and connection code:

Connect

You can authenticate with Token-based Authentication (OAuth 1.0a) or a bearer token. For TBA, use the four consumer and token variables above with HMAC-SHA256 and set realm to NETSUITE_ACCOUNT_ID. Sign the HTTP method and the full URL your client calls, including query parameters. Send the OAuth parameters in the Authorization header with a fresh nonce and a Unix timestamp in seconds. The snippets use the bearer token:
These are the snippets ancha connect netsuite --lang ts and --lang py print. An agent that reads NetSuite under its own names, such as NS_ACCOUNT_ID or NETSUITE_BASE_URL, gets them in agent.env: ancha init maps each one to its value, such as NS_ACCOUNT_ID: "{{netsuite.account_id}}".

Through Composio

An agent that uses NetSuite through Composio keeps its client code in cloud runs. ancha init detects the client and NetSuite toolkit names or tool slugs, writes the route and adds COMPOSIO_API_KEY to agent.pass_env, keeping your existing settings:
ancha.yaml
The secret’s value comes from your shell. Signed out, run ancha login first. Configure your Composio client to read its API URL from COMPOSIO_BASE_URL. Call NETSUITE_RUN_SUITEQL_QUERY through session.execute or tools.execute, with the query in q and optional paging arguments. Each attempt runs it against the world’s NetSuite and answers in Composio’s response format, with the SuiteQL REST body in data. An agent that reaches its tools through the session’s MCP URL (session.mcp.url), as Claude Code, the OpenAI Agents SDK and LangGraph’s MCP adapters do, runs the same query through COMPOSIO_MULTI_EXECUTE_TOOL, or calls NETSUITE_RUN_SUITEQL_QUERY directly when the session preloads it. initialize, tools/list, COMPOSIO_SEARCH_TOOLS and COMPOSIO_GET_TOOL_SCHEMAS answer as Composio’s MCP server does, tools/list following the session’s search, execute.enable_multi_execute and tools settings, and each query counts as one tool call in the report. The MCP client sends Accept: application/json, text/event-stream, as Composio requires. One session can name both quickbooks and netsuite. In a world with both, that session answers for both: tools/list, COMPOSIO_SEARCH_TOOLS and COMPOSIO_GET_TOOL_SCHEMAS cover both tools, and one COMPOSIO_MULTI_EXECUTE_TOOL call can mix QuickBooks and NetSuite tools, with the results in the order you sent them. Declare both under agent.routes to use them in the same agent configuration; QuickBooks-only and NetSuite-only tests can share that configuration. The upload check shows the executions that reached the world. Composio route errors lists each refusal reason with its fix.

OAuth 2.0

Use the world’s OAuth endpoints to exercise your client’s token flow. Set redirect URIs, publicClient and refreshTokenHours in seed.netsuite.integration. For REST calls, request rest_webservices. Access tokens last 60 minutes. Refresh tokens default to 168 hours for confidential clients and 48 hours for public clients. refreshTokenHours accepts 1–720. For MCP, use the authorization code flow with the mcp scope alone and PKCE S256. The grant uses the AI Connector role. REST tokens carry rest_webservices; MCP tokens carry mcp.

MCP Standard Tools

Connect your MCP client to NETSUITE_API_URL plus either path: Both expose Oracle’s 25 MCP Standard Tools over streamable HTTP. Send Authorization: Bearer <token> with NETSUITE_ACCESS_TOKEN or an OAuth 2.0 token issued for mcp. Discover tool schemas with tools/list and call them with tools/call. Reports include trial balance, income statement, balance sheet, A/R and A/P aging, general ledger, sales by customer and item, and purchases by vendor. Record tools use the same validation and state as REST. Results contain JSON text and structuredContent; tool errors set isError. For a world started with ancha world up, generate the same catalog’s client configuration:
Use the world’s ID in place of <envId>. The generated entry is ancha-netsuite, at /e/<envId>/mcp/netsuite, with its own attempt token. Runs also supply ANCHA_MCP_NETSUITE_URL and ANCHA_MCP_NETSUITE_TOKEN. See ancha mcp for HTTP client configurations and the stdio bridge.

Endpoints

Records

Use these record type names in the record URL: Other record types, such as custom record types and project, are served as the seed gives them, through record URLs, SuiteQL tables named after the type and the metadata catalog. Fields beyond a modeled record’s own go in its extra and come back with the record. Each transaction is in its own subsidiary and currency and posts to the general ledger in the base currency at its exchange rate. A new transaction without exchangeRate takes its currency’s rate in effect on its date. Sublist writes use an object with an items array. PATCH merges by line, or by doc for applications. Add replace=<sublist> to replace a whole sublist. Record collections accept q filters on top-level fields and return count, hasMore, offset and totalResults with paging links.

External IDs and upsert

Set externalId when creating a record, then address it as eid:<externalId> in place of an internal ID. External ID values match without regard to case. Customers and vendors share one external ID space; transactions share another. Use PUT at a URL such as NETSUITE_RECORD_URL + '/customer/eid:ridgeway-billing' with a body such as {"companyName":"Ridgeway Robotics"}. It creates the customer if the external ID is new and updates the customer if it exists.

Transforms

Send POST to the source record’s !transform/<target> path with a JSON body. The response is 204 with the new record’s URL in Location. For example, send {"item":{"items":[{"orderLine":1,"quantity":1}]}} to /services/rest/record/v1/salesOrder/1001/!transform/invoice to bill one more week from the starter order.

Applying payments

Customer payments and credit memos apply to the customer’s open invoices. Bill payments apply to the vendor’s approved, open bills. Each apply.items entry names a document and an amount:
Send this body to POST /services/rest/record/v1/customerPayment. The application reduces the invoice’s remaining balance. Set apply: false or amount: 0 on an application to release it. replace=apply releases applications left out of the new list. Applied amounts must fit both the document’s amount due and the payment or credit total. New vendor bills in the starter world wait for approval. Set approvalStatus to 2 to approve a bill before paying it. The starter integration role can approve bills.

SuiteQL

Send POST to NETSUITE_SUITEQL_URL with Prefer: transient and a JSON body such as {"q":"SELECT id, tranid FROM transaction WHERE id = 1002"}. Query entities, items, accounts, organizational lists, accounting periods, transactions, transactionline, transactionaccountingline and the File Cabinet. These tables reflect the same records you write through REST. Use BUILTIN.DF to read display values for references and coded columns. Query systemnote for record changes. previoustransactionlinelink and nexttransactionlinelink connect purchase orders, item receipts and vendor bills at the line level. Entity records include dateCreated; set it in an entity seed to place creation before its first transaction. Write queries in Oracle’s dialect: joins, subqueries, WITH, CASE, set operations, aggregates and analytic functions such as ROW_NUMBER() OVER (...). Use NVL, DECODE, TO_DATE, TO_CHAR and REGEXP_LIKE for Oracle expressions. A params array binds the query’s ? markers in order. Set limit and offset as URL query parameters for SuiteQL and record collections. limit accepts 1–1000 and defaults to 1000; offset defaults to 0 and must be a multiple of limit. Follow the response’s next link while hasMore is true. SuiteQL returns values as strings, dates as M/D/YYYY and booleans as T or F. subsidiary.currency is the subsidiary’s base currency, and currency.isbasecurrency marks it with T.

General ledger and accounting periods

Transactions post debits and credits to the general ledger. Read them through SuiteQL’s transactionaccountingline table or the MCP reports. Posting transactions update the ledger when you save them; quotes, orders and return authorizations track the workflow before posting. Set a transaction’s postingPeriod to an open monthly accounting period. Posting into a closed period fails. Set seed.netsuite.policy.closedThrough to a month such as 2026-10, or -1m for the month before the scene starts, to test closing rules.

Asynchronous jobs and batches

Add Prefer: respond-async to a record or SuiteQL request. The response is 202 with the job URL in Location. Poll the job until completed is true, then follow its task links and each task’s result link. The world runs the job one second after submission on its clock. For a batch of 1–100 records, send POST, PATCH or PUT to the record collection with Content-Type: application/vnd.oracle.resource+json; type=collection and an items array. For GET or DELETE, supply ids in the query. Batches use Prefer: respond-async and create one task per record. Pass X-NetSuite-Idempotency-Key to identify an asynchronous submission. Reusing it returns 400 IDEMPOTENCY_ERROR with the first job’s URL in Location.

Starter data

Inspect the starter records and the fields you can use in a scene:
The first command prints the starter dataset. The second lists accepted seed fields and any built-in check examples. A scene uses the data you put in its seed field. The starter account is Acme, account ID 7654321, with one subsidiary, USD, Net 15, Net 30 and Due on receipt terms, and ten accounts.

Built-in dataset

netsuite-pe is the books of a private-equity portfolio company, Ostrander Industrial Holdings: four subsidiaries, US dollar and euro books, and 18 months of order to cash and procure to pay. It holds what an operator finds at close: overdue receivables, duplicate bills, unapplied payments and credits, three-way-match exceptions and journal entries waiting for approval. It comes with 25 tasks: 10 operator questions whose answers are computed from the books, and 15 workflows that change them, each graded on the records a correct agent leaves.
For an agent that calls NetSuite directly, in a project with no tests, ancha init writes it with a test for each task; for an agent that reaches NetSuite through Composio, with a test for each read task. See ancha world gen and Test a NetSuite agent.

Your own exports

The command writes a world from REST record JSON, SuiteQL results and saved search CSV, each record in its own subsidiary and currency, and names each record whose books do not add up. See ancha world import netsuite.

Errors

Errors use application/vnd.oracle.resource+json; type=error. The body contains type, title, status and an o:errorDetails array. Each detail has detail and o:errorCode, with o:errorPath when a field is at fault.

Checks

Use trace checks, for example { called: "POST /services/rest/record/v1/customerPayment" }, { not_called: "DELETE /services/rest/record/v1/*/*" } or, for the MCP tools, { called: "MCP ns_runCustomSuiteQL" }. State checks read the records: netsuite.record, netsuite.count, netsuite.unchanged and netsuite.preserved. The last compares a seeded record’s fields and sublists with its final state, except the top-level except_fields. A failure names changed fields with before and after values. An answer check reads the totals, names and document numbers in the agent’s final answer.