Files
wownero-lws/docs/api/admin.yaml
T

942 lines
30 KiB
YAML

openapi: 3.0.4
info:
title: monero-lws Admin API
description: |-
This document describes the admin API for the [monero-lws](https://github.com/vtnerd/monero-lws) project.
An admin account can be created running the executable `monero-lws-admin create_admin` only (this command is not available via REST for security purposes). The key value returned in the create_admin JSON object becomes the `auth` parameter in the admin REST API. A new admin account is put into the hidden state - the account is not scanned for transactions and is not available to the normal REST API, but is available to the admin REST API.
version: 1.0.0
tags:
- name: account
description: Account administration
- name: webhook
description: Webhook administration
paths:
/accept_requests:
post:
tags:
- account
summary: Accept import+create account requests
description: |
This endpoint can perform two account actions:
* Accept new wallets requests created with the `/login` endpoint of the LWS client API.
* Accept "import" (from earlier block height) wallet requests created with the `/import_wallet_request` endpoint of the LWS client API.
operationId: accept_requests
requestBody:
content:
application/json:
schema:
type: object
properties:
params:
type: object
properties:
type:
type: string
enum:
- import
- create
addresses:
type: array
items:
$ref: '#/components/schemas/base58-address'
required:
- type
- addresses
allOf:
- $ref: '#/components/schemas/auth'
required:
- params
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/updated'
'400':
description: Invalid JSON.
'403':
description: Invalid `auth` parameter
'405':
description: Not `POST` method.
'500':
description: Invalid JSON schema, and all other general errors.
'503':
description: Unable to read or write from database.
/add_account:
post:
tags:
- account
summary: Add a new (client) account
description: Add a new account to be used by the client API.
operationId: add_account
requestBody:
content:
application/json:
schema:
type: object
properties:
params:
type: object
properties:
address:
$ref: '#/components/schemas/base58-address'
key:
description: The view-key corresponding to `address`
allOf:
- $ref: '#/components/schemas/binary32'
required:
- address
- key
allOf:
- $ref: '#/components/schemas/auth'
required:
- params
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/updated'
'400':
description: Invalid JSON.
'403':
description: Invalid `auth` parameter
'405':
description: Not `POST` method.
'500':
description: Invalid JSON schema, invalid key/address pair, and all other general errors.
'503':
description: Unable to read or write from database.
/list_accounts:
post:
tags:
- account
summary: List all accounts
operationId: list_accounts
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/auth'
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
properties:
active:
description: Accounts that are being scanned and viewable in the client API
allOf:
- $ref: '#/components/schemas/account'
inactive:
description: Accounts that are _not_ being scanned, but are viewable in the client API
allOf:
- $ref: '#/components/schemas/account'
hidden:
description: Accounts that are neither being scanned nor viewable in the client API. This includes `auth` accounts that access the admin API.
allOf:
- $ref: '#/components/schemas/account'
'400':
description: Invalid JSON.
'403':
description: Invalid `auth` parameter
'405':
description: Not `POST` method.
'500':
description: Invalid JSON schema, and all other general errors.
'503':
description: Unable to read from database.
/list_requests:
post:
tags:
- account
summary: List all pending create+import requests
operationId: list_requests
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/auth'
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
properties:
create:
$ref: '#/components/schemas/account-request'
import:
$ref: '#/components/schemas/account-request'
'400':
description: Invalid JSON.
'403':
description: Invalid `auth` parameter
'405':
description: Not `POST` method.
'500':
description: Invalid JSON schema, and all other general errors.
'503':
description: Unable to read from database.
/modify_account_status:
post:
tags:
- account
summary: Move account(s) to another state.
description: |
An account can have 3 states:
* `active`: Accounts that are being scanned and viewable in the client API
* `inactive`: Accounts that are _not_ being scanned, but are viewable in the client API
* `hidden`: Accounts that are neither being scanned nor viewable in the client API.
operationId: modify_account_status
requestBody:
content:
application/json:
schema:
type: object
properties:
params:
type: object
properties:
status:
type: string
enum:
- active
- inactive
- hidden
addresses:
type: array
items:
$ref: '#/components/schemas/base58-address'
required:
- status
- addresses
allOf:
- $ref: '#/components/schemas/auth'
required:
- params
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/updated'
'400':
description: Invalid JSON.
'403':
description: Invalid `auth` parameter
'405':
description: Not `POST` method.
'500':
description: Invalid JSON schema, and all other general errors.
'503':
description: Unable to read or write from database.
/reject_requests:
post:
tags:
- account
summary: Reject import+create account requests
description: |
This endpoint can perform two account actions:
* Reject new wallets requests created with the `/login` endpoint of the LWS client API.
* Reject "import" (from earlier block height) wallet requests created with the `/import_wallet_request` endpoint of the LWS client API.
operationId: reject_requests
requestBody:
content:
application/json:
schema:
type: object
properties:
params:
type: object
properties:
type:
type: string
enum:
- import
- create
addresses:
type: array
items:
$ref: '#/components/schemas/base58-address'
required:
- type
- addresses
allOf:
- $ref: '#/components/schemas/auth'
required:
- params
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/updated'
'400':
description: Invalid JSON.
'403':
description: Invalid `auth` parameter
'405':
description: Not `POST` method.
'500':
description: Invalid JSON schema, and all other general errors.
'503':
description: Unable to read or write from database.
/rescan:
post:
tags:
- account
summary: Force account(s) rescan from specific block height
operationId: rescan
requestBody:
content:
application/json:
schema:
type: object
properties:
params:
type: object
properties:
height:
$ref: '#/components/schemas/uint64'
addresses:
type: array
items:
$ref: '#/components/schemas/base58-address'
required:
- height
- addresses
allOf:
- $ref: '#/components/schemas/auth'
required:
- params
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/updated'
'400':
description: Invalid JSON.
'403':
description: Invalid `auth` parameter
'405':
description: Not `POST` method.
'500':
description: Invalid JSON schema, and all other general errors.
'503':
description: Unable to read or write from database.
/validate:
post:
summary: Validate components of a Monero wallet
operationId: validate
requestBody:
content:
application/json:
schema:
type: object
properties:
params:
type: object
properties:
spend_public_hex:
$ref: '#/components/schemas/binary32'
view_public_hex:
$ref: '#/components/schemas/binary32'
view_key_hex:
$ref: '#/components/schemas/binary32'
required:
- spend_public_hex
- view_public_hex
- view_key_hex
allOf:
- $ref: '#/components/schemas/auth'
required:
- params
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
oneOf:
- type: object
properties:
address:
$ref: '#/components/schemas/base58-address'
required:
- address
- type: object
properties:
error:
type: object
properties:
field:
type: string
enum:
- spend_public_hex
- view_public_hex
- view_key_hex
details:
type: string
required:
- field
- details
required:
- error
'400':
description: Invalid JSON.
'403':
description: Invalid `auth` parameter
'405':
description: Not `POST` method.
'500':
description: Invalid JSON schema, and all other general errors.
/webhook_add:
post:
tags:
- webhook
summary: List all pending create+import requests
operationId: webhook_add
requestBody:
content:
application/json:
schema:
type: object
properties:
params:
oneOf:
- type: object
properties:
type:
type: string
enum:
- tx-confirmation
- tx-spend
url:
$ref: '#/components/schemas/webhook-url'
address:
$ref: '#/components/schemas/base58-address'
payment_id:
$ref: '#/components/schemas/payment-id'
token:
type: string
minLength: 1
confirmations:
$ref: '#/components/schemas/uint32'
required:
- type
- url
- address
- type: object
properties:
type:
type: string
enum:
- new-account
url:
$ref: '#/components/schemas/webhook-url'
token:
type: string
minLength: 1
required:
- type
- url
allOf:
- $ref: '#/components/schemas/auth'
required:
- params
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/webhook-value'
'400':
description: Invalid JSON.
'403':
description: Invalid `auth` parameter
'405':
description: Not `POST` method.
'500':
description: Invalid JSON schema, invalid URL, and all other general errors.
'503':
description: Unable to read or write from database.
callbacks:
onEvent:
'{$requestBody.params.url}':
post:
requestBody:
content:
application/json:
schema:
oneOf:
- type: object
description: Sent on tx-confirmation events
properties:
payment_id:
$ref: '#/components/schemas/payment-id'
token:
description: "The same token passed in the initial request"
type: string
confirmations:
$ref: '#/components/schemas/uint32'
event_id:
$ref: '#/components/schemas/uuid'
tx_info:
$ref: '#/components/schemas/tx-output'
required:
- payment_id
- token
- confirmations
- event_id
- tx_info
- type: object
description: Sent on tx-spend events
properties:
token:
description: "The same token passed in the initial request"
type: string
event_id:
$ref: '#/components/schemas/uuid'
tx_info:
$ref: '#/components/schemas/tx-spend'
required:
- token
- event_id
- tx_info
- type: object
description: Sent on new-account events
properties:
token:
description: "The same token passed in the initial request"
type: string
event_id:
$ref: '#/components/schemas/uuid'
address:
$ref: '#/components/schemas/base58-address'
required:
- token
- event_id
- address
responses:
201:
description: On success
/webhook_delete:
post:
tags:
- webhook
summary: Delete webhooks associated with Monero address(es)
operationId: webhook_delete
requestBody:
content:
application/json:
schema:
type: object
properties:
params:
type: object
properties:
addresses:
type: array
items:
$ref: '#/components/schemas/base58-address'
required:
- addresses
allOf:
- $ref: '#/components/schemas/auth'
required:
- params
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
'400':
description: Invalid JSON.
'403':
description: Invalid `auth` parameter
'405':
description: Not `POST` method.
'500':
description: Invalid JSON schema, and all other general errors.
'503':
description: Unable to read or write from database.
/webhook_delete_uuid:
post:
tags:
- webhook
summary: Delete webhooks associated with UUID(s)
operationId: webhook_delete_uuid
requestBody:
content:
application/json:
schema:
type: object
properties:
params:
type: object
properties:
event_ids:
type: array
items:
$ref: '#/components/schemas/uuid'
required:
- event_ids
allOf:
- $ref: '#/components/schemas/auth'
required:
- params
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
'400':
description: Invalid JSON.
'403':
description: Invalid `auth` parameter
'405':
description: Not `POST` method.
'500':
description: Invalid JSON schema, and all other general errors.
'503':
description: Unable to read or write from database.
/webhook_list:
post:
tags:
- webhook
summary: List all registered webhooks
operationId: webhook_list
requestBody:
content:
application/json:
schema:
type: object
allOf:
- $ref: '#/components/schemas/auth'
required:
- params
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
properties:
webhooks:
type: object
properties:
key:
type: object
properties:
user:
$ref: '#/components/schemas/uint32'
type:
type: string
enum:
- tx-confirmation
- tx-send
- new-account
value:
$ref: '#/components/schemas/webhook-value'
required:
- key
- value
required:
- webhooks
'400':
description: Invalid JSON.
'403':
description: Invalid `auth` parameter
'405':
description: Not `POST` method.
'500':
description: Invalid JSON schema, and all other general errors.
'503':
description: Unable to read from database.
components:
schemas:
uint16:
type: integer
minimum: 0
maximum: 65535
uint32:
type: integer
minimum: 0
maximum: 4294967295
int64:
type: integer
minimum: -9223372036854775808
maximum: 9223372036854775807
uint64:
type: integer
minimum: 0
maximum: 18446744073709551615
timestamp:
description: Seconds since Unix epoch (1970-01-01 00:00:00)
allOf:
- $ref: '#/components/schemas/int64'
base58-address:
type: string
description: "Standard Monero address in base58"
minLength: 95
maxLength: 95
pattern: "^[0-9A-Za-z]{95}$"
example: "47nPhxp2cJeKN2NjamupNUNA13XgzcYPzQBCzzsKcj717s8M2UpFVmmdwSuYwgyy8kPDwU7hpEqTTDvfe5LAb9Aj6nwmEzf"
binary:
type: string
description: "binary data as hex (arbitrary length)"
pattern: "^([0-9A-Fa-f]{2})+$"
example: "0abcd9dcf0bca63310bb4d7e120918d1"
binary8:
type: string
description: "8-bytes binary data as hex"
minLength: 16
maxLength: 16
pattern: "^[0-9A-Fa-f]{16}$"
example: "6d26cac5c9d74f4e"
binary16:
type: string
description: "16-bytes binary data as hex"
minLength: 32
maxLength: 32
pattern: "^[0-9A-Fa-f]{32}$"
example: "67adfa30c9504e12955b9ae3ad3cd53b"
binary32:
type: string
description: "32-bytes binary data as hex"
minLength: 64
maxLength: 64
pattern: "^[0-9A-Fa-f]{64}$"
example: "ee171270296bbc26d5be4455b6313e1a2086a92080e205f77d6f861f8e5fd205"
payment-id:
$ref: '#/components/schemas/binary8'
uuid:
description: "A randomly generated, _unique_, UUID"
allOf:
- $ref: '#/components/schemas/binary16'
webhook-url:
description: A HTTP address OR `zmq` to indicate the notification happens over ZMQ PUB/SUB only.
type: string
pattern: "^(zmq|http://.+|https://.+)$"
auth:
type: object
properties:
auth:
description: |
A key generated via `./monero-lws-admin create_admin`. Not needed if server is started with `--disable-admin-auth`.
allOf:
- $ref: '#/components/schemas/binary32'
address-meta:
description: Subaddress index
type: object
properties:
maj_i:
$ref: '#/components/schemas/uint32'
min_i:
$ref: '#/components/schemas/uint32'
required:
- maj_i
- min_i
updated:
description: List of updated addresses
type: object
properties:
updated:
type: array
items:
$ref: '#/components/schemas/base58-address'
required:
- updated
account:
type: object
properties:
address:
$ref: '#/components/schemas/base58-address'
scan_height:
$ref: '#/components/schemas/uint64'
access_time:
$ref: '#/components/schemas/timestamp'
required:
- address
- scan_height
- access_time
account-request:
type: object
properties:
address:
$ref: '#/components/schemas/base58-address'
start_height:
$ref: '#/components/schemas/uint64'
required:
- address
- start_height
tx-output-id:
description: Blockchain unique identifier for the output. Changes on reorg.
type: object
properties:
high:
$ref: '#/components/schemas/uint32'
low:
$ref: '#/components/schemas/uint32'
required:
- high
- low
tx-spend-meta:
type: object
properties:
id:
$ref: '#/components/schemas/tx-output-id'
amount:
$ref: '#/components/schemas/uint64'
mixin:
$ref: '#/components/schemas/uint32'
index:
description: Index within vout, required for calculating spend key
allOf:
- $ref: '#/components/schemas/uint32'
tx_public:
description: The ephermal key used for the ECDH portion of transaction scanning
allOf:
- $ref: '#/components/schemas/binary32'
required:
- id
- amount
- mixin
- index
- tx_public
tx-output:
type: object
allOf:
- $ref: '#/components/schemas/tx-spend-meta'
properties:
block:
$ref: '#/components/schemas/uint64'
timestamp:
$ref: '#/components/schemas/timestamp'
tx_hash:
$ref: '#/components/schemas/binary32'
tx_prefix_hash:
$ref: '#/components/schemas/binary32'
rct_mask:
description: The encrypted ringct mask associated with output
allOf:
- $ref: '#/components/schemas/binary32'
payment_id:
$ref: '#/components/schemas/payment-id'
unlock_time:
$ref: '#/components/schemas/uint64'
mixin_count:
$ref: '#/components/schemas/uint32'
coinbase:
type: boolean
pub:
description: The unique public key for the output (which must be used in signature for spending)
allOf:
- $ref: '#/components/schemas/binary32'
recipient:
$ref: '#/components/schemas/address-meta'
required:
- block
- timestamp
- tx_hash
- tx_prefix_hash
- unlock_time
- mixin_count
- coinbase
- pub
- recipient
tx-spend:
type: object
properties:
input:
type: object
properties:
height:
$ref: '#/components/schemas/uint64'
tx_hash:
$ref: '#/components/schemas/binary32'
image:
$ref: '#/components/schemas/binary32'
source:
$ref: '#/components/schemas/tx-output-id'
timestamp:
$ref: '#/components/schemas/timestamp'
unlock_time:
$ref: '#/components/schemas/uint64'
mixin_count:
$ref: '#/components/schemas/uint32'
payment_id:
$ref: '#/components/schemas/payment-id'
sender:
$ref: '#/components/schemas/address-meta'
required:
- height
- tx_hash
- image
- source
- timestamp
- unlock_time
- mixin_count
- sender
output:
$ref: '#/components/schemas/tx-spend-meta'
required:
- input
- source
webhook-value:
type: object
properties:
event_id:
$ref: '#/components/schemas/uuid'
payment_id:
description: The `payment_id` sent in the request or all zeroes.
allOf:
- $ref: '#/components/schemas/payment-id'
token:
description: The token sent in the request or empty string.
type: string
confirmations:
description: The confirmations value sent in the request or `1`.
allOf:
- $ref: '#/components/schemas/uint32'
url:
description: The URL sent in the request.
allOf:
- $ref: '#/components/schemas/webhook-url'
required:
- event_id
- payment_id
- token
- confirmations
- url