2020-03-18 20:08:09 +09:00
{
"openapi" : "3.0.0" ,
"info" : {
"title" : "BTCPay Greenfield API" ,
"description" : "A full API to use your BTCPay Server" ,
"contact" : {
"name" : "BTCPay Server" ,
2020-03-20 14:05:23 +01:00
"url" : "https://btcpayserver.org"
2020-03-18 20:08:09 +09:00
} ,
"version" : "v1"
} ,
"servers" : [
] ,
"paths" : {
"/api-keys/authorize" : {
"get" : {
"tags" : [
"Authorization"
] ,
"summary" : "Authorize User" ,
"description" : "Redirect the browser to this endpoint to request the user to generate an api-key with specific permissions" ,
"parameters" : [
{
"name" : "permissions" ,
2020-03-27 12:43:06 +09:00
"description" : "The permissions to request. (See API Key authentication)" ,
2020-03-18 20:08:09 +09:00
"in" : "query" ,
"style" : "form" ,
"explode" : true ,
"schema" : {
"type" : "array" ,
"nullable" : true ,
"items" : {
"type" : "string"
}
} ,
"x-position" : 1
} ,
{
"name" : "applicationName" ,
"description" : "The name of your application" ,
"in" : "query" ,
"schema" : {
"type" : "string" ,
"nullable" : true
} ,
"x-position" : 2
} ,
{
"name" : "strict" ,
"description" : "If permissions are specified, and strict is set to false, it will allow the user to reject some of permissions the application is requesting." ,
"in" : "query" ,
"schema" : {
"type" : "boolean" ,
2020-03-20 20:25:10 +09:00
"default" : true ,
"nullable" : true
2020-03-18 20:08:09 +09:00
} ,
"x-position" : 3
} ,
{
"name" : "selectiveStores" ,
"description" : "If the application is requesting the CanModifyStoreSettings permission and selectiveStores is set to true, this allows the user to only grant permissions to selected stores under the user's control." ,
"in" : "query" ,
"schema" : {
"type" : "boolean" ,
2020-03-20 20:25:10 +09:00
"default" : false ,
"nullable" : true
2020-03-18 20:08:09 +09:00
} ,
"x-position" : 4
}
] ,
"responses" : {
"200" : {
2020-03-20 20:25:10 +09:00
"description" : "A HTML form that a user can use to confirm permissions to grant" ,
2020-03-18 20:08:09 +09:00
"content" : {
2020-03-20 20:25:10 +09:00
"text/html" : {
2020-03-18 20:08:09 +09:00
}
}
}
} ,
2020-03-27 14:17:31 +09:00
"security" : [ ]
2020-03-18 20:08:09 +09:00
}
} ,
"/api/v1/users/me" : {
"get" : {
"tags" : [
"Users"
] ,
"summary" : "Get current user information" ,
"description" : "View information about the current user" ,
2020-03-18 20:51:50 +09:00
"operationId" : "Users_GetCurrentUser" ,
2020-03-18 20:08:09 +09:00
"responses" : {
"200" : {
"description" : "Information about the current user" ,
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/ApplicationUserData"
}
}
}
}
} ,
"security" : [
{
2020-03-27 12:43:06 +09:00
"API Key" : [
2020-03-20 20:25:10 +09:00
"btcpay.user.canviewprofile"
2020-03-20 14:05:23 +01:00
] ,
"Basic" : [ ]
2020-03-18 20:08:09 +09:00
}
]
}
} ,
"/api/v1/users" : {
"post" : {
"tags" : [
"Users"
] ,
"summary" : "Create user" ,
2020-03-20 20:25:10 +09:00
"description" : "Create a new user.\n\nThis operation can be called without authentication in any of this cases:\n* There is not any administrator yet on the server,\n* The subscriptions are not disabled in the server's policies.\n\nIf the first administrator is created by this call, subscriptions are automatically disabled." ,
2020-03-18 20:08:09 +09:00
"requestBody" : {
"x-name" : "request" ,
"content" : {
"application/json" : {
"schema" : {
"type" : "object" ,
"additionalProperties" : false ,
"properties" : {
"email" : {
"type" : "string" ,
2020-03-18 23:35:17 +09:00
"description" : "The email of the new user" ,
2020-03-18 23:10:15 +09:00
"nullable" : false
2020-03-18 20:08:09 +09:00
} ,
"password" : {
2020-03-18 23:35:17 +09:00
"type" : "string" ,
"description" : "The password of the new user"
2020-03-18 20:08:09 +09:00
} ,
"isAdministrator" : {
"type" : "boolean" ,
2020-03-20 20:25:10 +09:00
"description" : "Make this user administrator (only if you have the `unrestricted` permission of a server administrator)" ,
2020-03-18 23:10:15 +09:00
"nullable" : true ,
"default" : false
2020-03-18 20:08:09 +09:00
}
}
}
}
} ,
"required" : true ,
"x-position" : 1
} ,
"responses" : {
"201" : {
"description" : "Information about the new user" ,
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/ApplicationUserData"
}
}
}
2020-03-18 20:51:50 +09:00
} ,
"400" : {
"description" : "A list of errors that occurred when creating the user" ,
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/ValidationProblemDetails"
}
}
}
2020-03-18 23:10:15 +09:00
} ,
"401" : {
"description" : "If you need to authenticate for this endpoint (ie. the server settings policies lock subscriptions and that an admin already exists)"
} ,
"403" : {
2020-03-20 20:26:36 +09:00
"description" : "If you are authenticated but forbidden to create a new user (ie. you don't have the `unrestricted` permission on a server administrator or if you are not administrator and registrations are disabled in the server's policies)"
2020-03-18 23:10:15 +09:00
} ,
"429" : {
"description" : "DDoS protection if you are creating more than 2 accounts every minutes (non-admin only)"
2020-03-18 20:08:09 +09:00
}
} ,
"security" : [
{
2020-03-27 12:43:06 +09:00
"API Key" : [
2020-03-20 20:25:10 +09:00
"btcpay.server.cancreateuser"
2020-03-20 14:05:23 +01:00
] ,
"Basic" : [ ]
2020-03-18 20:08:09 +09:00
}
]
}
} ,
"/api/v1/api-keys/current" : {
"get" : {
"tags" : [
"API Keys"
] ,
"summary" : "Get current API Key information" ,
"description" : "View information about the current API key" ,
"responses" : {
"200" : {
"description" : "Information about the current api key" ,
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/ApiKeyData"
}
}
}
}
} ,
"security" : [
{
2020-03-27 12:43:06 +09:00
"API Key" : [ ]
2020-03-18 20:08:09 +09:00
}
]
} ,
"delete" : {
"tags" : [
"API Keys"
] ,
"summary" : "Revoke the current API Key" ,
"description" : "Revoke the current API key so that it cannot be used anymore" ,
2020-03-18 20:51:50 +09:00
"responses" : {
"200" : {
"description" : "The key was revoked and is no longer usable" ,
2020-03-27 14:17:31 +09:00
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/ApiKeyData"
}
}
}
}
} ,
"security" : [
{
"API Key" : [ "unrestricted" ]
}
]
}
} ,
"/api/v1/api-keys" : {
"post" : {
"tags" : [
"API Keys"
] ,
"summary" : "Create a new API Key" ,
"description" : "Create a new API Key" ,
"responses" : {
"200" : {
"description" : "Information about the new api key" ,
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/ApiKeyData"
}
}
}
}
} ,
"requestBody" : {
"x-name" : "request" ,
"content" : {
"application/json" : {
"schema" : {
"type" : "object" ,
"additionalProperties" : false ,
"properties" : {
"label" : {
"type" : "string" ,
"description" : "The label of the new API Key" ,
"nullable" : true
} ,
"permissions" : {
"type" : "array" ,
"description" : "The permissions granted to this API Key (See API Key Authentication)" ,
"nullable" : true ,
"items" : {
"type" : "string"
}
}
}
}
}
}
} ,
"security" : [
{
"API Key" : [ "unrestricted" ] ,
"Basic" : [ ]
}
]
} ,
"delete" : {
"tags" : [
"API Keys"
] ,
"summary" : "Revoke the current API Key" ,
"description" : "Revoke the current API key so that it cannot be used anymore" ,
"responses" : {
"200" : {
"description" : "The key was revoked and is no longer usable" ,
2020-03-18 20:51:50 +09:00
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/ApiKeyData"
}
}
}
}
} ,
"security" : [
{
2020-03-27 12:43:06 +09:00
"API Key" : [ "unrestricted" ]
2020-03-18 20:51:50 +09:00
}
]
}
2020-03-18 20:08:09 +09:00
}
} ,
"components" : {
"schemas" : {
"ApplicationUserData" : {
"type" : "object" ,
"additionalProperties" : false ,
"properties" : {
"id" : {
"type" : "string" ,
2020-03-18 23:35:17 +09:00
"description" : "The id of the new user" ,
"nullable" : false
2020-03-18 20:08:09 +09:00
} ,
"email" : {
"type" : "string" ,
2020-03-18 23:35:17 +09:00
"description" : "The email of the new user" ,
"nullable" : false
2020-03-18 20:08:09 +09:00
} ,
"emailConfirmed" : {
2020-03-18 23:35:17 +09:00
"type" : "boolean" ,
"description" : "True if the email has been confirmed by the user"
2020-03-18 20:08:09 +09:00
} ,
"requiresEmailConfirmation" : {
2020-03-18 23:35:17 +09:00
"type" : "boolean" ,
"description" : "True if the email requires email confirmation to log in"
2020-03-18 20:08:09 +09:00
}
}
} ,
2020-03-18 20:51:50 +09:00
"ValidationProblemDetails" : {
"allOf" : [
{
"$ref" : "#/components/schemas/ProblemDetails"
} ,
{
"type" : "object" ,
"additionalProperties" : false ,
"properties" : {
"errors" : {
"type" : "object" ,
"nullable" : true ,
"additionalProperties" : {
"type" : "array" ,
"items" : {
"type" : "string"
}
}
}
}
}
]
} ,
"ProblemDetails" : {
"type" : "object" ,
"additionalProperties" : false ,
"properties" : {
"type" : {
"type" : "string" ,
"nullable" : true
} ,
"title" : {
"type" : "string" ,
"nullable" : true
} ,
"status" : {
"type" : "integer" ,
"format" : "int32" ,
"nullable" : true
} ,
"detail" : {
"type" : "string" ,
"nullable" : true
} ,
"instance" : {
"type" : "string" ,
"nullable" : true
} ,
"extensions" : {
"type" : "object" ,
"nullable" : true ,
"additionalProperties" : { }
}
}
} ,
2020-03-18 20:08:09 +09:00
"ApiKeyData" : {
"type" : "object" ,
"additionalProperties" : false ,
"properties" : {
"apiKey" : {
"type" : "string" ,
2020-03-27 12:43:06 +09:00
"description" : "The API Key to use for API Key Authentication" ,
2020-03-20 20:00:05 +09:00
"nullable" : false
2020-03-18 20:08:09 +09:00
} ,
"label" : {
"type" : "string" ,
2020-03-20 20:25:10 +09:00
"description" : "The label given by the user to this API Key" ,
2020-03-20 20:00:05 +09:00
"nullable" : false
2020-03-18 20:08:09 +09:00
} ,
"permissions" : {
"type" : "array" ,
2020-03-20 20:25:10 +09:00
"description" : "The permissions associated to this API Key" ,
"nullable" : false ,
2020-03-18 20:08:09 +09:00
"items" : {
"type" : "string"
}
}
}
}
} ,
"securitySchemes" : {
2020-03-27 12:43:06 +09:00
"API Key" : {
2020-03-18 20:08:09 +09:00
"type" : "apiKey" ,
2020-03-20 14:05:23 +01:00
"description" : "BTCPay Server supports authenticating and authorizing users through an API Key that is generated by them. Send the API Key as a header value to Authorization with the format: `token {token}`. For a smoother experience, you can generate a url that redirects users to an API key creation screen.\n\n The following permissions applies to the context of the user creating the API Key:\n * `unrestricted`: Allow unrestricted access to your account.\n * `btcpay.server.canmodifyserversettings`: Allow total control on the server settings. (only if user is administrator)\n * `btcpay.server.cancreateuser`: Allow the creation of new users on this server. (only if user is an administrator)\n * `btcpay.user.canviewprofile`: Allow view access to your user profile.\n * `btcpay.user.canmodifyprofile`: Allow view and modification access to your user profile.\n\nThe following permissions applies to all stores of the user, you can limit to a specific store with the following format: `btcpay.store.cancreateinvoice:6HSHAEU4iYWtjxtyRs9KyPjM9GAQp8kw2T9VWbGG1FnZ`:\n * `btcpay.store.canviewstoresettings`: Allow view access to the stores settings. \n * `btcpay.store.canmodifystoresettings`: Allow view and modification access to the stores settings.\n * `btcpay.store.cancreateinvoice`: Allow invoice creation of the store.\n\nNote that API Keys only limits permission of a user and can never expand it. If an API Key has the permission `btcpay.server.canmodifyserversettings` but that the user account creating this API Key is not administrator, the API Key will not be able to modify the server settings.\n" ,
2020-03-18 20:08:09 +09:00
"name" : "Authorization" ,
2020-03-20 14:05:23 +01:00
"in" : "header" ,
"scheme" : "token"
} ,
"Basic" : {
"type" : "http" ,
"description" : "BTCPay Server supports authenticating and authorizing users through the Basic HTTP authentication scheme. Send the user and password encoded in base64 with the format `Basic {base64(username:password)}`. Using this authentication method implicitly provides you with the `unrestricted` permission" ,
"name" : "Authorization" ,
"in" : "header" ,
"scheme" : "Basic"
2020-03-18 20:08:09 +09:00
}
}
} ,
"security" : [
{
2020-03-27 12:43:06 +09:00
"API Key" : [ ] ,
"Basic" : [ ]
2020-03-18 20:08:09 +09:00
}
] ,
"tags" : [
{
"name" : "Users"
} ,
{
"name" : "API Keys"
}
]
}