Skip to content

ServiceAccount

A ServiceAccount lets software use ObjectsGrid without a person signing in. There are two types, fixed when the account is created:

  • secret: for your servers, scripts and scheduled jobs. ObjectsGrid generates its secret and returns it in the create response. The account gets access tokens with its id and secret.
  • public: for the anonymous visitors of your app, such as people browsing your product catalog without signing in. It has no secret: your web page or app sends its API key, made with POST /serviceaccounts/{id}/apikey, which has no expiry and stops when the account is disabled or deleted. Its traffic is counted against your Organization Account; allowedOrigins and monthlyRequestLimit limit what a copied key can do, and GET /serviceaccounts/{id}/usage shows its requests this month. See Anonymous access.

Rotating a secret. POST /serviceaccounts/{id}/secret returns a new secret. The replaced secret keeps working for 24 hours (previousSecretExpiresAt), so your clients can move over without downtime. A second rotation ends the previous secret at once, so at most two secrets work at any time. The secret is read-only otherwise: a PUT keeps it whatever it sends, and lists don't include it.

JSON Schema

Example

Create one with POST /serviceaccounts:

{
  "type": "secret",
  "description": "Nightly product import",
  "tags": [
    {
      "name": "role",
      "val": "importer"
    }
  ]
}

Fields

Required: type.

Field Type Required Description
id string The object's id. Assigned by ObjectsGrid when the object is created.
secret string A secret service account's secret, generated by the platform: answered when the account is created or its secret rotated (POST /serviceaccounts/{id}/secret), and to readers the ABAC policy allows. Read-only: a replacement (PUT) keeps it, whatever it sends. Lists do not carry it. A public service account has none.
description string The ServiceAccount description
previousSecretExpiresAt date-time After a rotation, when the secret it replaced stops working (24 hours later); until then both secrets authenticate.
type one of public, secret Yes The ServiceAccount type, public or secret: set when it is created, read-only afterwards (a replacement keeps it).
disabled boolean Is the ServiceAccount disabled: a disabled account gets no access token, and its API keys and anonymous tokens stop within a minute
allowedOrigins list of string Public service accounts only: the web origins (scheme, host and port, such as https://shop.example.com) its browser requests may come from. A request whose Origin header is not listed is refused (403); one without the header, from a server or a script, is not, so this keeps other websites from using the key in their visitors' browsers, not scripts. None listed: any origin. Stored lower case, at most 50.
monthlyRequestLimit integer Public service accounts only: how many billable requests it may make a month, under the Organization Account's spending cap (monthlyQuota); once made, its requests get 429 until the month ends. 0 or absent: no limit of its own. Its usage is at GET /serviceaccounts/{id}/usage.
tags list of Tag Tags your ABAC policy decides on. Created empty when not sent, kept by a PUT that leaves them out, cleared by null or [].

REST API

Base URL https://apis.objectsgrid.com. Every request sends the X-ObjectsGrid-AccessPoint and Authorization: Bearer <access token> headers; see the REST API guide.

Operation Request
Create POST /serviceaccounts
List and search GET /serviceaccounts
Retrieve GET /serviceaccounts/{id}
Replace PUT /serviceaccounts/{id}
Delete DELETE /serviceaccounts/{id}
Rotate the secret POST /serviceaccounts/{id}/secret

The OpenAPI contract, with every parameter and response: ServiceAccounts (JSON).