Skip to main content

API - Getting Started

API Reference: Setting up an all-in-one API development environment for building and testing with the N3XT API

Tom Curley avatar
Written by Tom Curley
Updated this week

This guide will walk you through the essential steps to begin integrating N3XT's powerful instant and programmable payment technology directly into your application. Our API is designed to be completely language-agnostic, meaning you can leverage our services regardless of your preferred programming language or development environment. Whether you're building with Python, JavaScript, Java, Ruby, or any other language, the core principles of authentication and API interaction remain consistent.

Authentication

To securely access and utilize the N3XT API, you'll need to authenticate your application. This process involves obtaining unique credentials and then using them to acquire an access token for your API calls.

1. Obtain Your Client ID and Client Secret

Your journey with the N3XT API begins with a unique client_id and client_secret specifically generated for your business. These credentials are vital for authenticating your API requests. You can typically find these during your initial business account setup. If you're unable to locate them, please reach out to your account administrator for assistance.

2. Retrieve Your Access Token

Once you have your client_id and client_secret, you'll use them to obtain an access_token. This token serves as your application's key to making authenticated calls to the N3XT API. The following example demonstrates how to request an access token using cURL, a common command-line tool for making HTTP requests:

Bash

curl --request POST --url https://authn.alpha.n3xt.io/v1/public/project-test-84ff27dd-0cbe-423d-964c-d89b01324c61/oauth2/token \ -H 'Content-Type: application/json' \ -d '{ "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET", "grant_type": "client_credentials" }'

To adapt this request for your environment:

  1. Replace YOUR_CLIENT_ID with your unique client_id.

  2. Replace YOUR_CLIENT_SECRET with your client_secret.

Sample Response:

A successful request will return a JSON object containing your access_token and its expiration details:

JSON

{ "status_code": 200, "expires_in": 3600, "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141", "access_token": "eyJ...", "token_type": "bearer" }

3. Authenticate API Calls with Your Access Token

With your access_token in hand, you're ready to make authenticated requests to the N3XT API. When making API calls, you'll include this token in the Authorization header of your request.

Simply update the ${TOKEN} placeholder in the Authorization header with the access_token you generated in the previous step. Crucially, only insert the token itself; the "Bearer" prefix will be automatically handled.

Please note that access tokens are temporary and expire after 1 hour. To ensure continuous access to the API, you'll need to request a new access token by repeating the process described above.

Always prioritize the secure storage of your API credentials. Never embed your client_id, client_secret, or access_token directly within your application's source code. Instead, utilize secure methods such as environment variables, dedicated configuration management systems, or secure databases to protect your sensitive information.

Did this answer your question?