{
  "openapi" : "3.1.0",
  "info" : {
    "title" : "Service Accounts REST API",
    "description" : "API for managing Service Accounts",
    "version" : "v1"
  },
  "servers" : [ {
    "url" : "https://apis.objectsgrid.com"
  } ],
  "paths" : {
    "/serviceaccounts" : {
      "post" : {
        "summary" : "Create a Service Account",
        "operationId" : "createUserAccount",
        "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" : {
                "$ref" : "https://objectsgrid.com/.well-known/objects-catalog/ServiceAccount/v1/schema.json"
              }
            }
          }
        },
        "responses" : {
          "201" : {
            "description" : "Successfully created the service account",
            "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/ServiceAccount/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"
                }
              }
            }
          },
          "409" : {
            "description" : "Conflict, the service account already exists",
            "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"
                }
              }
            }
          }
        }
      },
      "get" : {
        "summary" : "Query Service Accounts",
        "operationId" : "queryServiceAccounts",
        "description" : "This operation supports Elastic Search Query DSL query format\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" : "query",
          "schema" : {
            "type" : "string"
          },
          "description" : "Elastic Search Query DSL for querying service Accounts.",
          "example" : "{ \"query\": { \"match_all\": {} } }"
        }, {
          "in" : "query",
          "name" : "from",
          "schema" : {
            "type" : "integer"
          },
          "description" : "Defines the starting record number for retrieval."
        }, {
          "in" : "query",
          "name" : "size",
          "schema" : {
            "type" : "integer"
          },
          "description" : "Defines the number of records to retrieve."
        }, {
          "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 service accounts",
            "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" : {
                  "type" : "array",
                  "items" : {
                    "$ref" : "https://objectsgrid.com/.well-known/objects-catalog/ServiceAccount/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"
                }
              }
            }
          }
        }
      }
    },
    "/serviceaccounts/{id}" : {
      "get" : {
        "summary" : "Retrieve a Service Account",
        "operationId" : "retrieveServiceAccount",
        "security" : [ {
          "accessTokenAuth" : [ ]
        } ],
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "description" : "ID of the service account to retrieve"
        }, {
          "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 service account",
            "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/ServiceAccount/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"
                }
              }
            }
          },
          "404" : {
            "description" : "Not Found",
            "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"
                }
              }
            }
          }
        }
      },
      "put" : {
        "summary" : "Update a Service Account",
        "operationId" : "updateServiceAccount",
        "security" : [ {
          "accessTokenAuth" : [ ]
        } ],
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "description" : "ID of the service account to update"
        }, {
          "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" : "If-Match",
          "description" : "The ETag of the object version being modified, as returned by the Retrieve, Create, Update or Patch operations.\nIf the object has been modified since that version, the request fails with 412 Precondition Failed.\n",
          "schema" : {
            "type" : "string"
          },
          "required" : false
        }, {
          "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" : {
                "$ref" : "https://objectsgrid.com/.well-known/objects-catalog/ServiceAccount/v1/schema.json"
              }
            }
          }
        },
        "responses" : {
          "200" : {
            "description" : "Successfully updated the service account",
            "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/ServiceAccount/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"
                }
              }
            }
          },
          "404" : {
            "description" : "Not Found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "412" : {
            "description" : "Precondition Failed - the object was modified since the version in the If-Match header",
            "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"
                }
              }
            }
          }
        }
      },
      "delete" : {
        "summary" : "Delete a Service Account",
        "operationId" : "deleteServiceAccount",
        "description" : "Deletes the Service Account",
        "security" : [ {
          "accessTokenAuth" : [ ]
        } ],
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "description" : "ID of the service account to delete"
        }, {
          "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" : "If-Match",
          "description" : "The ETag of the object version being modified, as returned by the Retrieve, Create, Update or Patch operations.\nIf the object has been modified since that version, the request fails with 412 Precondition Failed.\n",
          "schema" : {
            "type" : "string"
          },
          "required" : false
        }, {
          "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 deleted the service account",
            "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"
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "412" : {
            "description" : "Precondition Failed - the object was modified since the version in the If-Match header",
            "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"
                }
              }
            }
          }
        }
      }
    },
    "/serviceaccounts/{id}/secret" : {
      "post" : {
        "summary" : "Rotate a Service Account's secret",
        "description" : "Gives a secret service account a new secret, answered in the response. The secret it replaces keeps working for 24 hours (previousSecretExpiresAt), so that clients move to the new one without downtime; a secret replaced by an earlier rotation stops at once, so at most two secrets work at any time. Authorized as an update of the account: an account holding the administrator role can only be rotated by an administrator. A public service account has no secret (400).",
        "operationId" : "rotateServiceAccountSecret",
        "security" : [ {
          "accessTokenAuth" : [ ]
        } ],
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "description" : "ID of the service account"
        }, {
          "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" : "If-Match",
          "description" : "The ETag of the service account as read: rotate only if it has not changed since (412 otherwise)",
          "schema" : {
            "type" : "string"
          },
          "required" : false
        } ],
        "responses" : {
          "200" : {
            "description" : "The service account with its new secret",
            "headers" : {
              "ETag" : {
                "description" : "The service account's new version",
                "schema" : {
                  "type" : "string"
                }
              }
            },
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "https://objectsgrid.com/.well-known/objects-catalog/ServiceAccount/v1/schema.json"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request, or a public service account",
            "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"
                }
              }
            }
          },
          "409" : {
            "description" : "The service account kept changing while the rotation was applied",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "412" : {
            "description" : "If-Match does not match the service account's version",
            "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"
                }
              }
            }
          }
        }
      }
    },
    "/serviceaccounts/{id}/apikey" : {
      "post" : {
        "summary" : "Make a public service account's API key",
        "description" : "An API key for a public service account, to ship in a web page or an app and send as 'Authorization: Bearer <apiKey>'. It has no expiry: it is public anyway, and every key of the account works until the account is disabled or deleted, which stops them within a minute. Its requests are held to the account's allowedOrigins and monthlyRequestLimit. Administrators only. To replace a misused key without downtime, create another public service account with the same tags, ship its key, then disable this one.",
        "operationId" : "createPublicServiceAccountAPIKey",
        "security" : [ {
          "accessTokenAuth" : [ ]
        } ],
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "description" : "ID of the public service account"
        }, {
          "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
        } ],
        "responses" : {
          "201" : {
            "description" : "The API key. Cache-Control: no-store.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "object",
                  "properties" : {
                    "serviceAccountId" : {
                      "type" : "string"
                    },
                    "apiKey" : {
                      "type" : "string",
                      "description" : "The API key, without expiry"
                    }
                  },
                  "required" : [ "serviceAccountId", "apiKey" ]
                }
              }
            }
          },
          "400" : {
            "description" : "The service account is disabled",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized, or not an administrator",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "404" : {
            "description" : "No public service account with this id in the Organization Account",
            "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"
                }
              }
            }
          }
        }
      }
    },
    "/serviceaccounts/{id}/usage" : {
      "get" : {
        "summary" : "Read a public service account's usage this month",
        "description" : "Its billable requests this month, counted as the Organization Account's are, against its monthlyRequestLimit, and where they came from: each allowed origin, none (no Origin header: a server or a script), or unlisted (browser requests of an account that lists no origins). Administrators only.",
        "operationId" : "getPublicServiceAccountUsage",
        "security" : [ {
          "accessTokenAuth" : [ ]
        } ],
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "description" : "ID of the public service account"
        }, {
          "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
        } ],
        "responses" : {
          "200" : {
            "description" : "The usage this month",
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "object",
                  "properties" : {
                    "serviceAccountId" : {
                      "type" : "string"
                    },
                    "month" : {
                      "type" : "string",
                      "description" : "The month, YYYY-MM, UTC"
                    },
                    "usage" : {
                      "type" : "integer",
                      "description" : "Billable requests this month"
                    },
                    "monthlyRequestLimit" : {
                      "type" : "integer",
                      "description" : "The account's limit; 0 for none"
                    },
                    "origins" : {
                      "type" : "object",
                      "description" : "Requests by origin: an allowed origin, none or unlisted",
                      "additionalProperties" : {
                        "type" : "integer"
                      }
                    }
                  },
                  "required" : [ "serviceAccountId", "month", "usage", "monthlyRequestLimit", "origins" ]
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized, or not an administrator",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "https://objectsgrid.com/.well-known/objects-catalog/ErrorResponse/v1/schema.json"
                }
              }
            }
          },
          "404" : {
            "description" : "No public service account with this id in the Organization Account",
            "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."
      }
    }
  }
}