NetSuite API

By Abhishek Kumar
10 min read
Explore NetSuite's API documentation for alternatives, SDKs, authentication methods, and more. Learn how to integrate NetSuite into your applications seamlessly

Table of Contents

NetSuite provides robust APIs that facilitate the seamless integration of various business applications. These APIs let developers construct customized solutions improving company productivity and automating tasks. These APIs let builders create tailored solutions via access to NetSuite's strong capabilities—

NetSuite's ability to offer both REST and SOAP APIs gives developers the freedom to select what best fits their particular project. Learning these APIs will help you fully utilize the features of NetSuite if you intend to use its capabilities.


End Points

NetSuite's API endpoints interact with various aspects of its platform, such as business logic, metadata, and records. APIs that are most often used include:

  1. REST API: The REST API makes standard and custom records available, enabling CRUD (Create, Read, Update, Delete) activities. The easy integration of the endpoints into different applications results from their simplicity and RESTful standards. For example, you could easily pull customer data into a CRM or update inventory in real-time across multiple platforms, thanks to its RESTful design.
  2. SOAP API: The SOAP API is more feature-rich and supports advanced operations like executing saved searches, working with complex data types, and batch processing. The SOAP API endpoints are made to interact with responses and requests derived from XML. For instance, the SOAP API is ideal for operations involving customized objects or pulling thorough financial reports since it easily manages XML-based queries and responses.
  3. SuiteTalk: NetSuite's web services platform, SuiteTalk, provides a SOAP-based API, enabling developers to engage with almost every facet of NetSuite. SuiteTalk typically facilitates the integration of NetSuite with external apps.
  4. SuiteScript API: This JavaScript-based API is used for extending and customizing NetSuite applications. Developers using SuiteScript can run custom business logic on the client-side or server-side, providing flexibility in NetSuite use.

Request & Response Format

The request and response formats differ based on the API being used:

REST API

Request Format: With the REST API, everything is kept lightweight and simple, using JSON for both the body and parameters. For example, let’s say you want to create a new customer record. Your request might look like this:

{
  "customer": {
    "entityId": "ABCD",
    "email": "contact@abcd.com"
  }
}

JSON is popular for a reason—it’s easy to read, and it integrates smoothly into modern applications.

Response Format: The responses are also in JSON format, providing a clear and concise structure that’s easy to parse and work with in modern applications.

SOAP API

Request Format: Conversely, SOAP makes requests using XML, which can be more exact and a little more wordy. For a customer record, for example, the request might appear like this:

<ns1:Customer xmlns:ns1="urn:customers_2024_1.platform.webservices.netsuite.com">
  <ns1:entityId>ABC Corp</ns1:entityId>
  <ns1:email>contact@abccorp.com</ns1:email>
</ns1:Customer>

Although XML might not be as simplified as JSON, it provides outstanding flexibility and accuracy, which makes it perfect when handling vast amounts of data or handling complicated tasks.

Response Format: The responses are returned in XML, which can be more challenging to parse compared to JSON but offers robust data structuring capabilities.


Error Handling

Error handling is an essential aspect of working with NetSuite APIs. Both the REST and SOAP APIs provide detailed error messages that help developers diagnose and resolve issues.

REST API

Errors are typically returned in JSON format with an HTTP status code and a message explaining the error. For instance:

{
  "error": {
    "code": "INVALID_RECORD_TYPE",
    "message": "The record type provided is invalid."
  }
}

Common HTTP status codes include 400 (Bad Request), 401 (Unauthorized), and 404 (Not Found).

SOAP API

Errors are returned in XML format and often include a fault code and a detailed message. For example:

<soapenv:Fault>
  <faultcode>soapenv:Client</faultcode>
  <faultstring>INVALID_RECORD_TYPE: The record type provided is invalid.</faultstring>
</soapenv:Fault>

Developers should implement error handling to gracefully manage these errors, ensuring that applications remain stable and user-friendly.


Rate Limiting

Rate restrictions help NetSuite guarantee that everyone has fair access to resources while preserving platform performance. Keeping these restrictions in mind is critical if your operations or integrations involve a high volume of API calls.

  1. REST API: REST runs on a stateless design; hence, the rate restrictions for REST API calls are often tighter than those for SOAP. For instance, you can run across these restrictions sooner than anticipated if you are creating an app that syncs inventory data across several channels. Developers can use exponential backoff, in which case the system waits progressively longer between retries when approaching rate constraints, helping to prevent overload.
  2. SOAP API: Even if SOAP allows more breathing room with higher rate limitations, it's still important to monitor usage—especially in batch processing or handling significant data transfers. Imagine you are importing hundreds of sales records concurrently; it is easy to forget how rapidly those API requests accumulate. Tracking your usage and timing your requests will help you stay under the roof.

Effective handling of rate restrictions entails looking for rate limit information in response headers and reacting accordingly as limits draw near.


Pagination

Pagination is essential when dealing with large datasets, ensuring that API responses remain manageable and performant.

REST API

Pagination in REST is typically handled using parameters such as limit and offset. For example:

GET /records/v1/customer?limit=20&offset=40

This would return the 20 records starting from the 40th record.

SOAP API

Pagination in SOAP is managed through the search and searchMoreWithId operations. The search operation returns a search ID that can be used with searchMoreWithId to retrieve subsequent pages of results. This method is effective for handling large volumes of data but requires careful management of search IDs and result sets.


Versioning

NetSuite routinely updates its API versions to add fresh features, bug fixes, and enhancements. Developers should be aware of the versioning system so that they can ensure compatibility in their interactions.

REST API

Versioning is managed through the URL, with the version number specified as part of the endpoint path. For example:

GET /rest/v1/customers

Developers should regularly review their code to ensure compatibility with the latest API versions.

SOAP API

Versioning in SOAP is handled through the namespace and the WSDL file. The namespace includes the version number, so developers must update their WSDL files when a new version is released. This ensures that the integration remains compatible with the latest features and fixes.


Security

Working with NetSuite APIs calls for a tremendous deal of security, especially considering the private financial and client data involved.

  1. Authentication: Among various authentication techniques, NetSuite supports OAuth 2.0, token-based authentication, and SSO. The most recommended OAuth 2.0 is based on security and adaptability; it allows safe access without revealing credentials.
  2. Encryption: To ensure data encryption, all API contacts should occur over HTTPS. While NetSuite uses HTTPS, developers should additionally take extra security precautions, including encrypting private data prior to API transmission.
  3. Access Control: Utilizing NetSuite's Role-Based Access Control, developers can restrict API access to just the required data and activities. This lessens the possibility of illegal access and data leaks.

Alternatives

While NetSuite’s APIs are powerful, some businesses may require additional tools or alternatives to meet specific needs. Alternatives include:

  1. Sage Intacct API: A robust alternative offering similar functionalities, particularly for financial management. Sage Intacct is well-suited for businesses looking for specialized accounting features.
  2. QuickBooks API: Ideal for small to medium-sized businesses, QuickBooks offers a simpler API that’s easier to integrate for basic financial management needs.
  3. Cobalt: A platform that provides a unified API to connect with multiple SaaS applications, including NetSuite. Cobalt can simplify integration processes, especially for businesses using multiple tools.

Technologies

NetSuite APIs are built on several key technologies:

  1. RESTful Services: The REST API leverages RESTful principles, providing a lightweight and stateless communication method ideal for modern web applications.
  2. SOAP: The SOAP API is built on the Simple Object Access Protocol, offering a more complex but feature-rich integration option. SOAP is particularly valuable in scenarios requiring strict contract-based interactions.
  3. JavaScript: SuiteScript, a JavaScript-based API, allows developers to create unique business logic that runs inside NetSuite, providing numerous customization possibilities.
  4. OAuth 2.0: Secure authentication with OAuth 2.0 lets third-party programs access NetSuite data without revealing user credentials.

SDKs and Libraries

NetSuite provides many SDKs and libraries to simplify integration:

  1. SuiteTalk SDK: Sample code, documentation, and debugging tools, among other things, help developers create with SuiteTalk.
  2. SuiteScript: SuiteScript, designed as a JavaScript-based API, creates custom scripts that run within the NetSuite environment. Developers wishing to expand NetSuite's capabilities will find this SDK perfect.
  3. Community Libraries: Open-source libraries such as netsuite-rest for Node.js and NetSuite-SDK for Python offer further tools and examples for handling NetSuite APIs.
  4. Integration Platforms: Tools like Cobalt and MuleSoft provide pre-built connectors for NetSuite, streamlining the integration process for companies running several SaaS apps.

Best Practices

To make the most of NetSuite APIs, follow these best practices:

  • Optimize API Calls: By batching activities and applying effective searches, you can reduce API calls.
  • Implement Robust Error Handling: Use strong error handling to capture and manage mistakes, ensuring the best possible user experience.
  • Monitor Usage: Track API usage to avoid running into rate restrictions and maximize performance.
  • Stay Updated on API Versions: Update your integration often to match the most recent API releases.
  • Secure Your Integration: Use OAuth 2.0, encrypt private information, and apply rigorous access restrictions to safeguard your integration.

Conclusion

NetSuite APIs provide developers with a strong toolkit to extend and personalize the platform to particular corporate needs. However, to truly optimize it, developers must be familiar with the various API endpoints, the processing of responses and requests, and the optimal methods for error management.

Knowing how to control error codes or unexpected replies, for instance, can help create a bespoke integration that syncs consumer data from an e-commerce site using either flawless integration or continuous debugging. Following the best practices ensures that the resulting solutions are scalable and safe, enabling the full use of NetSuite's features for higher efficiency and performance.


API Request Limits

Basic

100 requests per minute

Business

500 requests per minute

Enterprise

1,000 requests per minute

SDKs

APIs

Account

Method: GET

Description: Retrieves a single account..

Endpoint: /v1/account/{id}

Parameters: id

Account

Method: POST

Description: Creates a new account..

Endpoint: /v1/account

Parameters: id, name, accttype, currencysymbol, custrecord_account_payment_terms, custrecord_netsuite_account_integration_system

Account

Method: PUT

Description: Updates an existing account..

Endpoint: /v1/account/{id}

Parameters: id, name, accttype, currencysymbol, custrecord_account_payment_terms, custrecord_netsuite_account_integration_system

Account

Method: DELETE

Description: Deletes an existing account..

Endpoint: /v1/account/{id}

Parameters: id

Contact

Method: GET

Description: Retrieves a single contact..

Endpoint: /v1/contact/{id}

Parameters: id

Contact

Method: POST

Description: Creates a new contact..

Endpoint: /v1/contact

Parameters: id, firstname, lastname, email, phone, fax

Contact

Method: PUT

Description: Updates an existing contact..

Endpoint: /v1/contact/{id}

Parameters: id, firstname, lastname, email, phone, fax

Contact

Method: DELETE

Description: Deletes an existing contact..

Endpoint: /v1/contact/{id}

Parameters: id

Customer

Method: GET

Description: Retrieves a single customer..

Endpoint: /v1/customer/{id}

Parameters: id

Customer

Method: POST

Description: Creates a new customer..

Endpoint: /v1/customer

Parameters: id, companyname, email, phone, fax, creditlimit, currency, terms, custrecord_customer_integration_system, custrecord_netsuite_customer_integration_source

Customer

Method: PUT

Description: Updates an existing customer..

Endpoint: /v1/customer/{id}

Parameters: id, companyname, email, phone, fax, creditlimit, currency, terms, custrecord_customer_integration_system, custrecord_netsuite_customer_integration_source

Customer

Method: DELETE

Description: Deletes an existing customer..

Endpoint: /v1/customer/{id}

Parameters: id

Item

Method: GET

Description: Retrieves a single item..

Endpoint: /v1/item/{id}

Parameters: id

Item

Method: POST

Description: Creates a new item..

Endpoint: /v1/item

Parameters: id, type, name, description, rate, upccode, currency

Item

Method: PUT

Description: Updates an existing item..

Endpoint: /v1/item/{id}

Parameters: id, type, name, description, rate, upccode, currency

Item

Method: DELETE

Description: Deletes an existing item..

Endpoint: /v1/item/{id}

Parameters: id

Invoice

Method: GET

Description: Retrieves a single invoice..

Endpoint: /v1/invoice/{id}

Parameters: id

Invoice

Method: POST

Description: Creates a new invoice..

Endpoint: /v1/invoice

Parameters: id, customer, currency, trandate, duedate, terms, custbody_invoice_additional_charges

Invoice

Method: PUT

Description: Updates an existing invoice..

Endpoint: /v1/invoice/{id}

Parameters: id, customer, currency, trandate, duedate, terms, custbody_invoice_additional_charges

Invoice

Method: DELETE

Description: Deletes an existing invoice..

Endpoint: /v1/invoice/{id}

Parameters: id

JournalEntry

Method: GET

Description: Retrieves a single journal entry..

Endpoint: /v1/journalentry/{id}

Parameters: id

JournalEntry

Method: POST

Description: Creates a new journal entry..

Endpoint: /v1/journalentry

Parameters: id, tranid, trandate, currency, memo

JournalEntry

Method: PUT

Description: Updates an existing journal entry..

Endpoint: /v1/journalentry/{id}

Parameters: id, tranid, trandate, currency, memo

JournalEntry

Method: DELETE

Description: Deletes an existing journal entry..

Endpoint: /v1/journalentry/{id}

Parameters: id

PurchaseOrder

Method: GET

Description: Retrieves a single purchase order..

Endpoint: /v1/purchaseorder/{id}

Parameters: id

PurchaseOrder

Method: POST

Description: Creates a new purchase order..

Endpoint: /v1/purchaseorder

Parameters: id, entity, location, trandate, duedate, memo

PurchaseOrder

Method: PUT

Description: Updates an existing purchase order..

Endpoint: /v1/purchaseorder/{id}

Parameters: id, entity, location, trandate, duedate, memo

PurchaseOrder

Method: DELETE

Description: Deletes an existing purchase order..

Endpoint: /v1/purchaseorder/{id}

Parameters: id

SalesOrder

Method: GET

Description: Retrieves a single sales order..

Endpoint: /v1/salesorder/{id}

Parameters: id

SalesOrder

Method: POST

Description: Creates a new sales order..

Endpoint: /v1/salesorder

Parameters: id, entity, location, trandate, duedate, memo

SalesOrder

Method: PUT

Description: Updates an existing sales order..

Endpoint: /v1/salesorder/{id}

Parameters: id, entity, location, trandate, duedate, memo

SalesOrder

Method: DELETE

Description: Deletes an existing sales order..

Endpoint: /v1/salesorder/{id}

Parameters: id

Task

Method: GET

Description: Retrieves a single task..

Endpoint: /v1/task/{id}

Parameters: id

Task

Method: POST

Description: Creates a new task..

Endpoint: /v1/task

Parameters: id, title, description, priority, assignee, datecreated, duedate

Task

Method: PUT

Description: Updates an existing task..

Endpoint: /v1/task/{id}

Parameters: id, title, description, priority, assignee, datecreated, duedate

Task

Method: DELETE

Description: Deletes an existing task..

Endpoint: /v1/task/{id}

Parameters: id

Vendor

Method: GET

Description: Retrieves a single vendor..

Endpoint: /v1/vendor/{id}

Parameters: id

Vendor

Method: POST

Description: Creates a new vendor..

Endpoint: /v1/vendor

Parameters: id, companyname, email, phone, fax, creditlimit, currency, terms, custrecord_vendor_integration_system, custrecord_netsuite_vendor_integration_source

Vendor

Method: PUT

Description: Updates an existing vendor..

Endpoint: /v1/vendor/{id}

Parameters: id, companyname, email, phone, fax, creditlimit, currency, terms, custrecord_vendor_integration_system, custrecord_netsuite_vendor_integration_source

Vendor

Method: DELETE

Description: Deletes an existing vendor..

Endpoint: /v1/vendor/{id}

Parameters: id

FAQ

What is the best way to authenticate to NetSuite?

The preferred authentication method is OAuth 2.0, which provides secure and flexible access to NetSuite data and services.

Are there rate limits for API calls?

Yes, there are rate limits in place to prevent excessive usage and ensure optimal performance for all users. The specific limits vary depending on the type of API call.

How can I set up a sandbox account for development?

You can request a sandbox account from NetSuite to test and develop integrations before deploying them to a production environment.

What is the difference between a developer account and a production account?

A developer account is intended for testing and development purposes, while a production account is used for live business operations.

How do I get support for API development?

NetSuite offers a range of support options for API developers, including documentation, community forums, and paid support plans.

Last Update: September 05, 2024