App Key guide
Versions and scope
Service 1.8.0 · Engine 1.7.8 · API 1.0.0 · SDK 1.0.1. The SDK patch preserves the memory HTTP contract. These are the recorded contract versions; production compatibility must be checked before integration.
Identity and ownership
GIS authenticates users. SCMP controls original memory accounts; ERA supplies engine services. An App Key identifies the calling application and does not establish ownership of a user’s SCMP account. Personal keys belong to a GIS account. App keys belong to one ERA App; multiple keys and server SDK instances can share an App while using distinct authorized scopes.
Credentials and authorization
Management requests use Authorization: Bearer <GIS access_token>. Memory requests use Authorization: Bearer <Personal/App/Service Key>. Keys cannot create Apps, keys, Brains or grants through management endpoints. Keep all credentials on your server. Treat brain_id and user_id as identifiers, never proof of permission. Resolve scope from trusted authentication and server-side mappings.
Brain grants and service keys
The verified Brain owner must authorize personal cross-App access. An App owner cannot authorize someone else’s Brain. Existing managed business Brain creation records its owner and grant transactionally; this is not the end-user SCMP onboarding flow. Permissions intersect key operations, Brain grant operations, expiry and App/account state. Service keys also require an operator-approved account and never bypass grants.
Models, usage and secrets
Personal requests use the account’s BYOK configuration. App/Service requests use the developer account’s BYOK, never the target user’s model credentials. Usage belongs to the caller and App, including failed calls and rotation history. This guide does not activate billing. A secret is returned only on creation or rotation; store it in a server secret manager.
Request parameters
App: name (1–100), description (up to 1000), kind=app; kind=service requires operator approval. Key: name, key_type=personal|app|service, app_id for app/service keys, environment=development|test|production, future Unix expires_at or null, nonempty operations from read/write/context/manage. Brain: name and operations. Grant: brain_id, user_id, operations, expires_at. Rotation accepts optional name/expires_at, preserves scope and revokes the old key atomically. Null retains the old expiry on rotation.
Operations and lifecycle
read covers reads, pagination, history, trace and stats; write covers writes, batches, corrections, revocation and context-artifact storage; context covers Context/Search/Answer/Chat; manage covers index maintenance. These permissions do not imply physical E deletion. Revoke grants to stop access while preserving E. Disabling an App invalidates its keys; disabled keys have no re-enable endpoint.
Errors and retries
401: invalid credentials; 403: denied scope or operation; 404 NOT_FOUND: absent or inaccessible object; 409 APP_DISABLED / KEY_NOT_ACTIVE: inactive App/key; 422: invalid parameters; 503 GIS_UNAVAILABLE: identity cannot be verified. Management creation has no new idempotency guarantee: inspect existing objects before retrying. Memory writes retain Idempotency-Key; memory pagination retains pagination.next_cursor.
Registration and availability
Use the existing GIS/Console entry points and their verification protections. Automatic SCMP onboarding is not publicly available through these documented endpoints.
| HTTP | URI |
|---|---|
| GET | /service/apps |
| POST | /service/apps |
| GET | /service/apps/{app_id} |
| PATCH | /service/apps/{app_id} |
| POST | /service/apps/{app_id}/deactivate |
| GET | /service/brains |
| POST | /service/apps/{app_id}/brains |
| GET | /service/apps/{app_id}/grants |
| POST | /service/apps/{app_id}/grants |
| DELETE | /service/brain-grants/{grant_id} |
| GET | /service/keys |
| GET | /service/keys/{key_id} |
| POST | /service/keys |
| DELETE | /service/keys/{key_id} |
| POST | /service/keys/{key_id}/disable |
| POST | /service/keys/{key_id}/rotate |
| GET | /service/apps/{app_id}/usage?month=YYYY-MM |
Python
import os
from era_service_sdk import EraMemoryApiClient
with EraMemoryApiClient(os.environ['ERA_API_URL'],os.environ['ERA_BRAIN_ID'],os.environ['ERA_USER_ID'],
headers={'Authorization':'Bearer '+os.environ['ERA_API_KEY']},timeout=300) as client:
print(client.version())
event=client.add(C='SDK quickstart: Alice visited Paris.',P={'protocol':'sdk-demo'},idempotency_key='sdk-python-demo-v1')
print(client.get(event['event_id']))
print(client.history(event['event_id']))
TypeScript / Node.js
import {EraClient} from '@era-labs/client';
const client=new EraClient({baseUrl:process.env.ERA_API_URL,brainId:process.env.ERA_BRAIN_ID,userId:process.env.ERA_USER_ID,apiKey:process.env.ERA_API_KEY});
console.log(await client.version());
const event=await client.add({C:'SDK quickstart: Alice visited Paris.',P:{protocol:'sdk-demo'}},{idempotencyKey:'sdk-typescript-demo-v1'});
console.log(await client.get(event.event_id));
console.log(await client.history(event.event_id));
HTTP
import os,json
from urllib.request import Request,urlopen
from urllib.parse import quote
base=os.environ['ERA_API_URL'].rstrip('/')
scope='/v1/brains/'+quote(os.environ['ERA_BRAIN_ID'],safe='')+'/users/'+quote(os.environ['ERA_USER_ID'],safe='')
def call(method,path,body=None):
headers={'Authorization':'Bearer '+os.environ['ERA_API_KEY'],'Content-Type':'application/json'}
if method=='POST':headers['Idempotency-Key']='sdk-http-demo-v1'
data=json.dumps(body).encode() if body is not None else None
with urlopen(Request(base+path,data=data,headers=headers,method=method),timeout=300) as response:return json.load(response)
print(call('GET','/version'))
event=call('POST',scope+'/memories',{'C':'SDK HTTP quickstart: Alice visited Paris.','P':{'protocol':'sdk-demo'}})
print(call('GET',scope+'/memories/'+event['event_id']))
print(call('GET',scope+'/memories/'+event['event_id']+'/history'))