{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://spec.openapis.org/oas/3.1/dialect/base",
  "info": {
    "title": "Logs REST API",
    "description": "API for application logs, one LogEvent per logged event.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://apis.objectsgrid.com"
    }
  ],
  "paths": {
    "/log": {
      "post": {
        "summary": "Create log events",
        "operationId": "create",
        "description": "Creates 1 to 1000 LogEvents in one request, all or none: if any of them is not valid, or you may not create\nit, nothing is created, and the error's reasons name the event by its index, as in `/logEvents/3/message`.\nThe fields the events share, the app, session and device they come from, can be sent once in `sourceInfo`\ninstead of in every event; each event is then stored, searchable and retrieved whole, with those fields.\nEach event gets its own id and version. Nothing is returned: 201 has no body.\nEach event created counts as one request against the monthly spending cap; a batch that would pass the\ncap is refused (429). Rarely, some events cannot be stored once the batch was accepted: the response is\nthen 207 with their errors, by index, and the others stay created. Log events cannot be changed or deleted.\n",
        "security": [
          {
            "accessTokenAuth": [

            ]
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-ObjectsGrid-AccessPoint",
            "description": "EU or US depending on where your Organization Account is located",
            "schema": {
              "type": "string",
              "enum": [
                "EU",
                "US"
              ]
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-ObjectsGrid-RestApiVersion",
            "description": "This header allows targeting an API version.\nIf you want to target the latest API version set its value to 'latest'\nIf you want to target the latest stable API version set its value to 'stable'\n",
            "schema": {
              "type": "string"
            },
            "required": false
          },
          {
            "in": "header",
            "name": "X-ObjectsGrid-SessionID",
            "description": "This header allows you to provide a Session ID to be traced through the request stack and returned in the response.\n",
            "schema": {
              "type": "string"
            },
            "required": false
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "logEvents"
                ],
                "additionalProperties": false,
                "properties": {
                  "sourceInfo": {
                    "$ref": "#/components/schemas/LogSourceInfo"
                  },
                  "logEvents": {
                    "type": "array",
                    "description": "The events; with the sourceInfo fields, each must be a valid LogEvent",
                    "minItems": 1,
                    "maxItems": 1000,
                    "items": {
                      "$ref": "https://objectsgrid.com/.well-known/objects-catalog/LogEvent/v1/schema.json"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Every event was created; the response has no body",
            "headers": {
              "X-ObjectsGrid-CorrelationID": {
                "description": "The Correlation ID is a unique value generated by ObjectsGrid and used for troubleshooting issues",
                "schema": {
                  "type": "string"
                }
              },
              "X-ObjectsGrid-SessionID": {
                "description": "If your request contained this header, it will be included in the response",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "207": {
            "description": "Some events could not be stored; the response lists their errors, and the others were created",
            "headers": {
              "X-ObjectsGrid-CorrelationID": {
                "description": "The Correlation ID is a unique value generated by ObjectsGrid and used for troubleshooting issues",
                "schema": {
                  "type": "string"
                }
              },
              "X-ObjectsGrid-SessionID": {
                "description": "If your request contained this header, it will be included in the response",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogEventsErrors"
                }
              }
            }
          },
          "400": {
            "description": "Bad request; an object is not valid, or the batch has no objects or more than 1000. Nothing was created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized; you may not create one of the objects. Nothing was created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "413": {
            "description": "Payload Too Large; the body exceeds 10 MB, or one of its objects exceeds 1 MB. Nothing was created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - rate limited, or the batch would pass the monthly spending cap. Nothing was created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List objects",
        "operationId": "list",
        "description": "A page of the type's objects, filtered, ordered and paged with where, orderBy, first and after, or of their\ngroups with groupBy.\n",
        "security": [
          {
            "accessTokenAuth": [

            ]
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-ObjectsGrid-AccessPoint",
            "description": "EU or US depending on where your Organization Account is located",
            "schema": {
              "type": "string",
              "enum": [
                "EU",
                "US"
              ]
            },
            "required": true
          },
          {
            "in": "query",
            "name": "lang",
            "schema": {
              "type": "string"
            },
            "description": "BCP 47 language code\n",
            "example": "fr, de, de-AT, cy-GB"
          },
          {
            "in": "query",
            "name": "where",
            "schema": {
              "type": "string"
            },
            "description": "The objects to list, as JSON (Prisma style): conditions on fields (equals, in, notIn, lt, lte, gt, gte,\ncontains, startsWith, endsWith, not, mode insensitive), on lists of values (has, hasSome, hasEvery,\nisEmpty) and on lists of objects (some, every, none), combined with AND, OR and NOT. Every field of the\ntype can be filtered on. A field the caller may not read can't be used. See\nhttps://objectsgrid.com/docs/guides/lists/\n",
            "example": "{\"name\": {\"some\": {\"at_value\": {\"contains\": \"clean\", \"mode\": \"insensitive\"}}}}"
          },
          {
            "in": "query",
            "name": "orderBy",
            "schema": {
              "type": "string"
            },
            "description": "The order, as JSON: {\"<field>\": \"asc\" or \"desc\"}, or {\"<field>\": {\"sort\": \"asc\", \"nulls\": \"last\"}}, or a\nlist of up to 3 of them; an embedded object's fields nest ({\"meta\": {\"createdAt\": \"desc\"}}). Lists can't be\nsorted on. The id always ends the order, so pages are stable.\n",
            "example": "{\"meta\": {\"createdAt\": \"desc\"}}"
          },
          {
            "in": "query",
            "name": "first",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "description": "The number of objects in the page."
          },
          {
            "in": "query",
            "name": "after",
            "schema": {
              "type": "string"
            },
            "description": "The page after this cursor, a previous page's pageInfo.endCursor, with the same where and orderBy."
          },
          {
            "in": "query",
            "name": "count",
            "schema": {
              "type": "boolean"
            },
            "description": "true adds totalCount, the number of objects the where matches. It needs access to every object of the\ntype, since it counts those the caller may not see.\n"
          },
          {
            "in": "query",
            "name": "groupBy",
            "schema": {
              "type": "string"
            },
            "description": "Groups instead of objects, as JSON (Prisma style): by (1 to 3 fields), where, _count, _sum, _avg, _min,\n_max, having, orderBy, take (1 to 100) and cursor. Not with where, orderBy, first, after or count, which\nit holds itself. It needs access to every object of the type.\n",
            "example": "{\"by\": [\"providerMobility\"], \"_count\": true}"
          },
          {
            "in": "header",
            "name": "X-ObjectsGrid-RestApiVersion",
            "description": "This header allows targeting an API version.\nIf you want to target the latest API version set its value to 'latest'\nIf you want to target the latest stable API version set its value to 'stable'\n",
            "schema": {
              "type": "string"
            },
            "required": false
          },
          {
            "in": "header",
            "name": "X-ObjectsGrid-SessionID",
            "description": "This header allows you to provide a Session ID to be traced through the request stack and returned in the response.\n",
            "schema": {
              "type": "string"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully listed the objects",
            "headers": {
              "X-ObjectsGrid-CorrelationID": {
                "description": "The Correlation ID is a unique value generated by ObjectsGrid and used for troubleshooting issues",
                "schema": {
                  "type": "string"
                }
              },
              "X-ObjectsGrid-SessionID": {
                "description": "If your request contained this header, it will be included in the response",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "description": "A page of objects",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "https://objectsgrid.com/.well-known/objects-catalog/LogEvent/v1/schema.json"
                          }
                        },
                        "pageInfo": {
                          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/PageInfo/v1/schema.json"
                        },
                        "totalCount": {
                          "type": "integer",
                          "description": "The number of objects the where matches, with count=true"
                        }
                      },
                      "required": [
                        "items",
                        "pageInfo"
                      ]
                    },
                    {
                      "$ref": "https://objectsgrid.com/.well-known/objects-catalog/GroupPage/v1/schema.json"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          }
        }
      }
    },
    "/log/{id}": {
      "get": {
        "summary": "Retrieve Object",
        "operationId": "retrieve",
        "security": [
          {
            "accessTokenAuth": [

            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "ID of the object to retrieve"
          },
          {
            "in": "query",
            "name": "lang",
            "schema": {
              "type": "string"
            },
            "description": "BCP 47 language code\n",
            "example": "fr, de, de-AT, cy-GB"
          },
          {
            "in": "query",
            "name": "version",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "An object version, its meta.objectVersion: returns that version instead of the current one. Earlier versions stay readable after the object is deleted; an earlier version carries the object's current tags.\n",
            "example": 1731312000123456
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "description": "The ETag of the version you hold: answered 304 Not Modified, with no body and not billed, when the object is still at it. Poll a configuration or flags this way.\n",
            "schema": {
              "type": "string"
            },
            "required": false
          },
          {
            "in": "header",
            "name": "X-ObjectsGrid-AccessPoint",
            "description": "EU or US depending on where your Organization Account is located",
            "schema": {
              "type": "string",
              "enum": [
                "EU",
                "US"
              ]
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-ObjectsGrid-RestApiVersion",
            "description": "This header allows targeting an API version.\nIf you want to target the latest API version set its value to 'latest'\nIf you want to target the latest stable API version set its value to 'stable'\n",
            "schema": {
              "type": "string"
            },
            "required": false
          },
          {
            "in": "header",
            "name": "X-ObjectsGrid-SessionID",
            "description": "This header allows you to provide a Session ID to be traced through the request stack and returned in the response.\n",
            "schema": {
              "type": "string"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved the object",
            "headers": {
              "X-ObjectsGrid-CorrelationID": {
                "description": "The Correlation ID is a unique value generated by ObjectsGrid and used for troubleshooting issues",
                "schema": {
                  "type": "string"
                }
              },
              "X-ObjectsGrid-SessionID": {
                "description": "If your request contained this header, it will be included in the response",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "description": "The object version. Send it in the If-Match header to update, patch or delete this exact version",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/LogEvent/v1/schema.json"
                }
              }
            }
          },
          "304": {
            "description": "Not Modified, the object is still at the version If-None-Match named; no body, not billed"
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "406": {
            "description": "This type has no JSON-LD document: ask for application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "accessTokenAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Bearer JWT",
        "description": "An ObjectsGrid access token (a JWT), sent as 'Authorization: Bearer <token>': from POST /oauth2/token, valid 1 hour, or an API key: a service account's from the bootstrap of an Organization Account created without signing in, valid 90 days; a public service account's (POST /serviceaccounts/{id}/apikey, or the bootstrap's anonymous one), without expiry, until its account is disabled or deleted."
      }
    },
    "schemas": {
      "LogSourceInfo": {
        "type": "object",
        "description": "The LogEvent fields describing where the batch's events come from, sent once: each is copied into every event\nthat does not set it. An event's own value replaces it, whole (an event's session replaces this session).\nTypically schemaVersion, app, environment, platform, baseUrl, sentAt, session, auth, client, device, network,\ngeo, web, mobile and extensions.\n",
        "additionalProperties": true
      },
      "LogEventsErrors": {
        "type": "object",
        "required": [
          "errors"
        ],
        "properties": {
          "errors": {
            "type": "array",
            "description": "One item per event that could not be stored",
            "items": {
              "type": "object",
              "required": [
                "index",
                "error"
              ],
              "properties": {
                "index": {
                  "type": "integer",
                  "description": "The event's position in logEvents, from 0"
                },
                "error": {
                  "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          }
        }
      }
    }
  }
}
