Quick start¶
In this quick start you register your Organization Account, get an access token, and create and read a product. All you need is a Google account and curl.
1. Choose your region¶
Your Organization Account and all its data live in one region, which you choose now and cannot change later:
EU: the European UnionUS: the United States
Every request sends the region in the X-ObjectsGrid-AccessPoint header. The examples below use EU.
2. Register your Organization Account¶
No Google account at hand, or an AI agent?
Create an Organization Account with one request and no sign-in, and get three API keys at once: see
Start without signing in. Use its user API key as $TOKEN below.
The easiest way is the Admin site: sign in with Google and fill in the form.
To do it with the API instead:
- Open the test token page, sign in with Google and copy the ID token it shows. ID tokens expire after about an hour.
-
Create the account with that ID token as the bearer token:
The response is 201 Created, with your new Organization Account in the body. Note its id, such as org-123-4567: you need it to sign in later.
Registering also does three things for you:
- It creates your User Account and makes you the account's administrator.
- It creates a default ABAC policy, which gives everyone except administrators no access until you add rules.
- It signs you in: the response's
Authorizationheader holds an ObjectsGrid access token,Bearer <access token>.
Not ready to use real data?
You don't need a real company. Register an Organization Account for trying things out, and a separate one for production later.
Keep the access token in a shell variable for the next steps:
3. Create a product¶
curl https://apis.objectsgrid.com/graphql \
-H 'Content-Type: application/json' \
-H 'X-ObjectsGrid-AccessPoint: EU' \
-H "Authorization: Bearer $TOKEN" \
-d '{"query": "mutation { createProduct(input: { sku: \"TRS-42\", name: [{ at_language: \"en\", at_value: \"Trail Running Shoe\" }] }) { id sku meta { objectVersion createdAt } } }"}'
ObjectsGrid assigns the product's id and returns it, with read-only metadata in meta. Text fields such as name are localized: a list with one entry per language.
4. Read it back¶
You can also explore the GraphQL API in the browser with the GraphQL playground. Set the X-ObjectsGrid-AccessPoint and Authorization headers in its Headers panel.
5. Sign in again later¶
Your access token lasts one hour. To get a new one, exchange a fresh Google ID token, with your Organization Account id as client_id:
curl -X POST https://apis.objectsgrid.com/oauth2/token \
-H 'X-ObjectsGrid-AccessPoint: EU' \
-d grant_type=urn:ietf:params:oauth:grant-type:token-exchange \
--data-urlencode 'subject_token=<Google ID token>' \
-d subject_token_type=urn:ietf:params:oauth:token-type:id_token \
-d 'client_id=<organization account id>'
The response also holds a refresh token, which gets you new access tokens for three months without signing in again. See Authentication.
Next steps¶
- Your own app's users: register your app with Google and add its client id to your Organization Account. See Sign in with Google.
- Servers and scripts: create a service account and sign in with its id and secret. See Authentication.
- Who may do what: add rules to your ABAC policy. See Access control.
- Your data model: browse the object reference.