Tutorial5 min
Create an organization
- Endpoint
POST /organizations- Auth
X-API-Key- Body
{ name, email }- Returns
201 { id }
Before you start
A Core API base URL
Pick the environment you are building against. Base URLs has the details.
- ProductionProvided at onboardingMutual TLS required
- Sandbox
https://staging-api.emergentriskinternational.com/api/v1Same contract as production - Local
http://127.0.0.1:3001/api/v1apps/backend on your machine
An API Key
Organization-scoped, sent in the
X-API-Keyheader and issued by ERI support. See Authentication.Running the backend locally
Bootstrap the first key from
apps/backend. The script prints the raw key once, so store it outside the repository.pnpm migrations:uppnpm api-keys:bootstrapThe organization's details
A name of 2 to 200 characters and a corporate email address. The email must not belong to another organization.
Step 1: Prepare the payload
Save the organization's details as
create-org.json.The body is strict: exactly
nameandemail. Any other field fails validation, so there is nothing optional to leave out.create-org.json{"name": "Acme Fintech Corp","email": "operations@acmefintech.example"}Step 2: Send the request
Export the base URL for your environment and your API Key, then post the payload to
/organizations.Send
Content-Type: application/jsonwith every request. The key goes inX-API-Key, never in the URL.Terminalexport CORE_API_BASE_URL="http://127.0.0.1:3001/api/v1"export ERI_API_KEY="<raw API Key from bootstrap or ERI support>"- cURL
- Python
- Node.js
curl -X POST "$CORE_API_BASE_URL/organizations" \-H "Content-Type: application/json" \-H "X-API-Key: $ERI_API_KEY" \-d @create-org.jsonimport os, requestsresponse = requests.post(f"{os.environ['CORE_API_BASE_URL']}/organizations",headers={"X-API-Key": os.environ["ERI_API_KEY"]},json={"name": "Acme Fintech Corp", "email": "operations@acmefintech.example"},)organization_id = response.json()["id"]const response = await fetch(`${process.env.CORE_API_BASE_URL}/organizations`, {method: "POST",headers: {"Content-Type": "application/json","X-API-Key": process.env.ERI_API_KEY,},body: JSON.stringify({"name": "Acme Fintech Corp","email": "operations@acmefintech.example",}),});const { id } = await response.json();Step 3: Handle the response
A successful call returns
201 Createdwith the generatedidand nothing else. No status, contact details or credential links come back, so persist theidnow.Errors share one JSON envelope with a stable
codeto branch on. Pick a status to see the exact body.201Created- When
- The organization was created.
- What to do
- Persist the returned id. It is the only field in the response.
Response body{"id": "019f1240-0000-7000-8000-000000000001"}Step 4: Read it back
Confirm the organization with
GET /organizations/{id}, using the same key.- cURL
- Python
- Node.js
curl "$CORE_API_BASE_URL/organizations/019f1240-0000-7000-8000-000000000001" \-H "X-API-Key: $ERI_API_KEY"response = requests.get(f"{os.environ['CORE_API_BASE_URL']}/organizations/{organization_id}",headers={"X-API-Key": os.environ["ERI_API_KEY"]},)organization = response.json()const response = await fetch(`${process.env.CORE_API_BASE_URL}/organizations/${id}`, {headers: { "X-API-Key": process.env.ERI_API_KEY },});const organization = await response.json();200 OK{"id": "019f1240-0000-7000-8000-000000000001","name": "Acme Fintech Corp","email": "operations@acmefintech.example"}
You have a Client Account
Every API key and request from here on is scoped to the organization you just created.
- Ingest the report feedPage through the intelligence your Client Account has access to, newest first.
GET /reports - Search the archiveFind reports by what they say instead of paging the whole feed.
GET /reports/search - Retrieve an organizationFull reference for the read call, including every error response.
GET /organizations/{id}