{"components":{"headers":{"ContentRange":{"description":"first-last/total: 0-9/120, or 0-9/* without count=exact, or */0 when nothing matched.","schema":{"type":"string"}},"XCache":{"description":"Whether the rows came from the 5-minute cache.","schema":{"enum":["HIT","MISS"],"type":"string"}}},"parameters":{"acceptProfile":{"description":"The schema to read from.","in":"header","name":"Accept-Profile","schema":{"default":"public","type":"string"}},"and":{"description":"Conditions that must all match, written as in or.","in":"query","name":"and","schema":{"type":"string"}},"contentProfile":{"description":"The schema to write to.","in":"header","name":"Content-Profile","schema":{"default":"public","type":"string"}},"limit":{"in":"query","name":"limit","schema":{"default":10,"maximum":1000,"minimum":1,"type":"integer"}},"offset":{"in":"query","name":"offset","schema":{"default":0,"minimum":0,"type":"integer"}},"onConflict":{"description":"For an upsert: the unique columns, comma-separated. The primary key by default.","in":"query","name":"on_conflict","schema":{"type":"string"}},"or":{"description":"Conditions of which any may match: or=(age.lt.18,age.gt.65). Groups nest: or(…), and(…), not.and(…).","in":"query","name":"or","schema":{"type":"string"}},"order":{"description":"order=col.desc,other.asc.nullslast. Each column takes asc or desc, and nullsfirst or nullslast.","in":"query","name":"order","schema":{"type":"string"}},"preferCount":{"description":"count=exact puts the number of matching rows in Content-Range.","in":"header","name":"Prefer","schema":{"enum":["count=exact"],"type":"string"}},"preferDelete":{"description":"return=representation returns the deleted rows instead of their count.","in":"header","name":"Prefer","schema":{"enum":["return=representation"],"type":"string"}},"preferWrite":{"description":"resolution=merge-duplicates updates rows that already exist (upsert); resolution=ignore-duplicates skips them. return=minimal answers with no body. Comma-separated.","in":"header","name":"Prefer","schema":{"type":"string"}},"select":{"description":"Columns to return, comma-separated: select=id,title. All by default.","in":"query","name":"select","schema":{"type":"string"}}},"schemas":{"Error":{"properties":{"code":{"description":"Postgres's SQLSTATE, when the database refused the statement.","type":"string"},"details":{"type":"string"},"error":{"description":"What went wrong.","type":"string"},"hint":{"type":"string"}},"required":["error"],"type":"object"},"Row":{"additionalProperties":true,"description":"A row: one property per column.","type":"object"}},"securitySchemes":{"apiKey":{"description":"An API key from the dashboard (Settings → API keys), as Authorization: Bearer \u003ckey\u003e.","scheme":"bearer","type":"http"}}},"externalDocs":{"url":"https://hornethive.io/docs/rest-api"},"info":{"description":"The HornetHive REST API. Query syntax and examples: https://hornethive.io/docs/rest-api","title":"HornetHive REST API","version":"1"},"openapi":"3.1.0","paths":{"/{dbId}/query":{"post":{"description":"With $1, $2… parameters. A key without the write scope runs it in a read-only transaction.","operationId":"query","parameters":[{"description":"The database's id, from the dashboard.","in":"path","name":"dbId","required":true,"schema":{"format":"uuid","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"params":{"items":{},"type":"array"},"query":{"type":"string"}},"required":["query"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"columns":{"items":{"type":"string"},"type":"array"},"rows":{"items":{"type":"object"},"type":"array"}},"type":"object"}}},"description":"The result."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The request or the statement was refused."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No API key, or not a valid one."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, or may not use this database."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such database, table or row."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached."}},"summary":"Run one SQL statement","tags":["sql"]}},"/{dbId}/rpc/{function}":{"get":{"description":"Arguments are the query string. Always runs read-only.","operationId":"rpc_function_get","parameters":[{"description":"The database's id, from the dashboard.","in":"path","name":"dbId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"path","name":"function","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/acceptProfile"}],"responses":{"200":{"content":{"application/json":{"schema":{}}},"description":"A set-returning function's rows, a composite's object, or a scalar's value."},"204":{"description":"The function returns void."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The request or the statement was refused."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No API key, or not a valid one."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, or may not use this database."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such database, table or row."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached."}},"summary":"Call {function}, read-only","tags":["rpc"]},"post":{"description":"Arguments are named. A key without the write scope runs it read-only.","operationId":"rpc_function","parameters":[{"description":"The database's id, from the dashboard.","in":"path","name":"dbId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"path","name":"function","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/contentProfile"}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"description":"The function's arguments, by name.","type":"object"}}}},"responses":{"200":{"content":{"application/json":{"schema":{}}},"description":"A set-returning function's rows, a composite's object, or a scalar's value."},"204":{"description":"The function returns void."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The request or the statement was refused."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No API key, or not a valid one."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, or may not use this database."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such database, table or row."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached."}},"summary":"Call {function}","tags":["rpc"]}},"/{dbId}/{table}":{"delete":{"description":"At least one filter is required.","operationId":"delete_rows","parameters":[{"description":"The database's id, from the dashboard.","in":"path","name":"dbId","required":true,"schema":{"format":"uuid","type":"string"}},{"description":"The table or view.","in":"path","name":"table","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/or"},{"$ref":"#/components/parameters/and"},{"$ref":"#/components/parameters/select"},{"$ref":"#/components/parameters/preferDelete"},{"$ref":"#/components/parameters/contentProfile"}],"responses":{"200":{"content":{"application/json":{"schema":{"oneOf":[{"properties":{"deleted":{"type":"integer"}},"type":"object"},{"items":{"$ref":"#/components/schemas/Row"},"type":"array"}]}}},"description":"How many rows were deleted, or the rows with return=representation."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The request or the statement was refused."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No API key, or not a valid one."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, or may not use this database."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such database, table or row."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached."}},"summary":"Delete the rows that match the filters","tags":["rows"]},"get":{"operationId":"list_rows","parameters":[{"description":"The database's id, from the dashboard.","in":"path","name":"dbId","required":true,"schema":{"format":"uuid","type":"string"}},{"description":"The table or view.","in":"path","name":"table","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/or"},{"$ref":"#/components/parameters/and"},{"$ref":"#/components/parameters/select"},{"$ref":"#/components/parameters/order"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"},{"$ref":"#/components/parameters/preferCount"},{"$ref":"#/components/parameters/acceptProfile"}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Row"},"type":"array"}}},"description":"The rows; the first 10 unless limit is given.","headers":{"Content-Range":{"$ref":"#/components/headers/ContentRange"},"X-Cache":{"$ref":"#/components/headers/XCache"}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The request or the statement was refused."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No API key, or not a valid one."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, or may not use this database."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such database, table or row."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached."}},"summary":"List rows","tags":["rows"]},"patch":{"description":"At least one filter is required.","operationId":"update_rows","parameters":[{"description":"The database's id, from the dashboard.","in":"path","name":"dbId","required":true,"schema":{"format":"uuid","type":"string"}},{"description":"The table or view.","in":"path","name":"table","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/or"},{"$ref":"#/components/parameters/and"},{"$ref":"#/components/parameters/select"},{"$ref":"#/components/parameters/contentProfile"}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"description":"The new values, by column.","type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Row"},"type":"array"}}},"description":"The updated rows."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The request or the statement was refused."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No API key, or not a valid one."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, or may not use this database."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such database, table or row."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached."}},"summary":"Update the rows that match the filters","tags":["rows"]},"post":{"operationId":"insert_rows","parameters":[{"description":"The database's id, from the dashboard.","in":"path","name":"dbId","required":true,"schema":{"format":"uuid","type":"string"}},{"description":"The table or view.","in":"path","name":"table","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/select"},{"$ref":"#/components/parameters/onConflict"},{"$ref":"#/components/parameters/preferWrite"},{"$ref":"#/components/parameters/contentProfile"}],"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Row"},{"items":{"$ref":"#/components/schemas/Row"},"type":"array"}]}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Row"},{"items":{"$ref":"#/components/schemas/Row"},"type":"array"}]}}},"description":"The inserted rows: an object for an object, an array for an array. Empty with return=minimal."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The request or the statement was refused."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No API key, or not a valid one."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, or may not use this database."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such database, table or row."},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"A unique or foreign key constraint refused the row."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached."}},"summary":"Insert one row or many, or upsert","tags":["rows"]}},"/{dbId}/{table}/{id}":{"get":{"description":"Matches `id`. A view, or a table without a primary key, matches a column named id.","operationId":"get_rows","parameters":[{"description":"The database's id, from the dashboard.","in":"path","name":"dbId","required":true,"schema":{"format":"uuid","type":"string"}},{"description":"The table or view.","in":"path","name":"table","required":true,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/select"},{"$ref":"#/components/parameters/acceptProfile"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Row"}}},"description":"The row."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The request or the statement was refused."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No API key, or not a valid one."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key lacks the scope, or may not use this database."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"No such database, table or row."},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limit reached."}},"summary":"Get one row by its primary key","tags":["rows"]}}},"security":[{"apiKey":[]}],"servers":[{"url":"https://api.hornethive.io/v1/rest"}]}