Skip to main content

Quick Start

You need a Noon Partner account to follow this guide. If you don't have one yet, check Noon's Partner onboarding process.

1. Get your credentials

  1. Open the Access App
  2. Click Add Service Account, fill in a display name, username, and role, then click Add
  3. A .json key file will download — this is your credential file:
Keep this file secure

Never commit your .json credential file to source control. It contains your private key.

For the full walkthrough see Getting Your Credentials.

2. Authenticate

Use your .json file to generate a JWT and exchange it for a session cookie. All subsequent API requests use that cookie.

Required header

All API requests must include a User-Agent header identifying your application. Requests without it may be rejected.

import json
import time
import uuid
import jwt
import requests

BASE_URL = "https://noon-api-gateway.noon.partners"
USER_AGENT = "NoonApiClient/1.0"

with open("noon_credentials_sensitive.json", "r", encoding="utf-8") as file:
credentials = json.load(file)

# Create a signed RS256 JWT for the login request.
def create_jwt():
return jwt.encode(
{
"sub": credentials["key_id"],
"iat": int(time.time()),
"jti": str(uuid.uuid4()),
},
credentials["private_key"],
algorithm="RS256",
)

# Log in and return a requests session that keeps auth cookies.
def get_authenticated_session():
session = requests.Session()
session.headers.update({"User-Agent": USER_AGENT})

response = session.post(
f"{BASE_URL}/identity/public/v1/api/login",
json={
"token": create_jwt(),
"default_project_code": credentials["project_code"],
},
)
if response.status_code != 200:
raise Exception(f"Login failed with HTTP {response.status_code}: {response.text}")

return session

# Example authenticated request.
session = get_authenticated_session()

response = session.get(f"{BASE_URL}/identity/v1/whoami")

if response.status_code != 200:
raise Exception(f"Whoami failed with HTTP {response.status_code}: {response.text}")

print("Logged in as:", response.json())

You're authenticated. Visit the API Reference for the full list of available endpoints.