{"openapi":"3.1.0","info":{"title":"Praecise Keys","version":"0.1.0","description":"Early and unproven. Keys are never exported or deleted. See the limits guide."},"servers":[{"url":"https://keys.praecise.com"}],"tags":[{"name":"Accounts","description":"Made by a Praecise product with the admin key."},{"name":"Keys","description":"With the account's API key."}],"components":{"securitySchemes":{"admin":{"type":"http","scheme":"bearer","description":"The admin key, held by a Praecise product."},"account":{"type":"http","scheme":"bearer","description":"The account's API key (pkk_…)."}}},"paths":{"/accounts":{"post":{"operationId":"accounts-create","tags":["Accounts"],"summary":"Add an account","security":[{"admin":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"owner":{"type":"string","description":"The project or organisation id."},"name":{"type":"string","description":""},"praeciseAccount":{"type":"string","description":"The Praecise account the usage bills to."},"relationship":{"type":"string","description":"Its billing relationship, if known."}},"required":["owner"]}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"type":"string","description":""},"apiKey":{"type":"string","description":"Shown this once."},"owner":{"type":"string","description":""}},"required":[]}}}}}},"get":{"operationId":"accounts-list","tags":["Accounts"],"summary":"List accounts","security":[{"admin":[]}],"parameters":[{"name":"owner","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Accounts"}}}},"/accounts/{account}":{"get":{"operationId":"accounts-read","tags":["Accounts"],"summary":"Read an account and its counts","security":[{"admin":[]}],"parameters":[{"name":"account","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Account"}}},"post":{"operationId":"accounts-change","tags":["Accounts"],"summary":"Rotate the API key, suspend, or link to a Praecise account","security":[{"admin":[]}],"parameters":[{"name":"account","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rotate":{"type":"boolean"},"suspended":{"type":"boolean"},"praeciseAccount":{"type":"string","description":""},"relationship":{"type":"string","description":""}},"required":[]}}}},"responses":{"200":{"description":"Changed"}}},"delete":{"operationId":"accounts-delete","tags":["Accounts"],"summary":"Delete an account; refused (409) while it has an enabled key","security":[{"admin":[]}],"parameters":[{"name":"account","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted"},"409":{"description":"Has an enabled key"}}}},"/keys":{"post":{"operationId":"keys-create","tags":["Keys"],"summary":"Make a key","security":[{"account":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":""},"kind":{"type":"string","enum":["ed25519","ecdsa-p256","aes256-gcm96"]}},"required":["name","kind"]}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":""},"kind":{"type":"string","description":""},"latestVersion":{"type":"integer"},"publicKeys":{"type":"object"}},"required":[]}}}}}},"get":{"operationId":"keys-list","tags":["Keys"],"summary":"List keys with public keys and versions","security":[{"account":[]}],"responses":{"200":{"description":"Keys"}}}},"/keys/{key}":{"get":{"operationId":"keys-read","tags":["Keys"],"summary":"Read a key","security":[{"account":[]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"The key's name."}],"responses":{"200":{"description":"Key"}}}},"/keys/{key}/sign":{"post":{"operationId":"sign","tags":["Keys"],"summary":"Sign","security":[{"account":[]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"The key's name."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"input":{"type":"string","format":"byte","description":"The message."}},"required":["input"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"signature":{"type":"string","description":""},"version":{"type":"integer"}},"required":[]}}}}}}},"/keys/{key}/verify":{"post":{"operationId":"verify","tags":["Keys"],"summary":"Verify a signature","security":[{"account":[]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"The key's name."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"input":{"type":"string","format":"byte","description":"The message."},"signature":{"type":"string","description":""}},"required":["input","signature"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"valid":{"type":"boolean"}},"required":[]}}}}}}},"/keys/{key}/encrypt":{"post":{"operationId":"encrypt","tags":["Keys"],"summary":"Encrypt","security":[{"account":[]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"The key's name."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"plaintext":{"type":"string","format":"byte","description":"The data."}},"required":["plaintext"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"ciphertext":{"type":"string","description":""},"version":{"type":"integer"}},"required":[]}}}}}}},"/keys/{key}/decrypt":{"post":{"operationId":"decrypt","tags":["Keys"],"summary":"Decrypt","security":[{"account":[]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"The key's name."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ciphertext":{"type":"string","description":""}},"required":["ciphertext"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"plaintext":{"type":"string","format":"byte","description":"The data."}},"required":[]}}}}}}},"/keys/{key}/rotate":{"post":{"operationId":"rotate","tags":["Keys"],"summary":"Rotate: add a version","security":[{"account":[]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"The key's name."}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":""},"latestVersion":{"type":"integer"}},"required":[]}}}}}}},"/keys/{key}/disable":{"post":{"operationId":"disable","tags":["Keys"],"summary":"Disable: stop all use through Keys (the key is never deleted)","security":[{"account":[]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"The key's name."}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":""},"disabled":{"type":"boolean"}},"required":[]}}}}}}},"/audit":{"get":{"operationId":"audit","tags":["Keys"],"summary":"Your audit trail, newest first","security":[{"account":[]}],"parameters":[{"name":"key","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","maximum":1000}}],"responses":{"200":{"description":"Entries"}}}},"/usage":{"get":{"operationId":"usage","tags":["Keys"],"summary":"Today's counts and your limits","security":[{"account":[]}],"responses":{"200":{"description":"Usage"}}}}}}