Skip to content

Instantly share code, notes, and snippets.

@YuchenJin
Created June 18, 2025 17:45
Show Gist options
  • Save YuchenJin/0fb5353a199aadf9d69030140e62ba8d to your computer and use it in GitHub Desktop.
Save YuchenJin/0fb5353a199aadf9d69030140e62ba8d to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.3",
"info": {
"title": "Castle API",
"version": "2.0.0"
},
"servers": [
{
"url": "https://api.hyperbolic.xyz"
}
],
"paths": {
"/v2/openapi.json": {
"get": {
"operationId": "openApiJson",
"security": [
{
"Authorization": []
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v2/usage/request-cost": {
"post": {
"operationId": "usage-getRequestCost",
"summary": "Provides the inference request cost in nanoUSD for a list of request IDs.",
"description": "Inference requests are billed based on the cost of the tokens used in the request. The request ID can be found in the \"X-Inference-Request-Id\" inference response header.",
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"requestIds": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"requestIds"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"requests": {
"type": "array",
"items": {
"type": "object",
"properties": {
"requestId": {
"type": "string"
},
"costNanoUsd": {
"type": "number"
}
},
"required": [
"requestId",
"costNanoUsd"
]
},
"maxItems": 100
}
},
"required": [
"requests"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v2/marketplace/instances/create-cheapest": {
"post": {
"operationId": "marketplace-createCheapestInstance",
"summary": "Create the cheapest instance",
"description": "Creates the cheapest instance. If a gpu model or gpu count is provided, creates the cheapest possible instance with those parameters",
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"gpuModel": {
"type": "string"
},
"gpuCount": {
"type": "number",
"minimum": 1
},
"publicKey": {
"type": "string"
},
"image": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"tag": {
"type": "string"
},
"port": {
"type": "number"
}
},
"required": [
"name",
"tag",
"port"
]
},
"userMetadata": {
"type": "object",
"additionalProperties": {}
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": {
"type": "string"
},
"instanceName": {
"type": "string"
}
},
"required": [
"status",
"instanceName"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v2/marketplace/cheapest": {
"get": {
"operationId": "marketplace-getCheapestNodes",
"summary": "Get a list of cheapest nodes matching filters",
"description": "Get a list of the cheapest available nodes filtered by optional gpu model and count",
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"in": "query",
"name": "gpuModel",
"schema": {
"type": "string"
}
},
{
"in": "query",
"name": "gpuCount",
"schema": {
"type": "number",
"minimum": 1
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"node": {
"type": "object",
"properties": {
"clusterId": {
"type": "string"
},
"nodeId": {
"type": "string"
},
"gpuModel": {
"type": "string"
}
},
"required": [
"clusterId",
"nodeId",
"gpuModel"
]
},
"price": {
"type": "number"
}
},
"required": [
"node"
]
}
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v2/marketplace/virtual-machine-rentals": {
"post": {
"operationId": "marketplace-createVirtualMachineRental",
"summary": "Create a virtual machine rental",
"description": "Create a virtual machine rental",
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"gpuCount": {
"type": "number"
}
},
"required": [
"gpuCount"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string",
"nullable": true
},
"deletedAt": {
"type": "string",
"nullable": true
},
"userId": {
"type": "string",
"maxLength": 50
},
"startedAt": {
"type": "string",
"nullable": true
},
"terminatedAt": {
"type": "string",
"nullable": true
},
"externalId": {
"type": "string"
},
"rentalProvider": {
"type": "string"
},
"costPerHour": {
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"meta": {}
},
"required": [
"id",
"createdAt",
"updatedAt",
"deletedAt",
"userId",
"startedAt",
"terminatedAt",
"externalId",
"rentalProvider",
"costPerHour"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
},
"get": {
"operationId": "marketplace-getActiveVirtualMachineRentals",
"summary": "Get a list of active virtual machine rentals",
"description": "Get a list of active virtual machine rentals",
"security": [
{
"Authorization": []
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string",
"nullable": true
},
"deletedAt": {
"type": "string",
"nullable": true
},
"userId": {
"type": "string",
"maxLength": 50
},
"startedAt": {
"type": "string",
"nullable": true
},
"terminatedAt": {
"type": "string",
"nullable": true
},
"externalId": {
"type": "string"
},
"rentalProvider": {
"type": "string"
},
"costPerHour": {
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"meta": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"type": {
"type": "string"
},
"public_ip": {
"type": "string"
},
"gpu_count": {
"type": "number"
},
"resources": {
"type": "object",
"properties": {
"ram_gb": {
"type": "number"
},
"storage_gb": {
"type": "number"
},
"vcpu_count": {
"type": "number"
},
"gpus": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"count": {
"type": "number"
}
},
"required": [
"count"
]
}
}
},
"required": [
"ram_gb",
"storage_gb",
"vcpu_count",
"gpus"
]
},
"hostnode_id": {
"type": "string"
},
"internal_ip": {
"type": "string"
},
"rental_type": {
"type": "string",
"enum": [
"virtual-machine"
]
},
"ssh_command": {
"type": "string"
},
"port_forwards": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_port": {
"type": "number"
},
"internal_port": {
"type": "number"
}
},
"required": [
"external_port",
"internal_port"
]
}
},
"operating_system": {
"type": "string"
},
"termination_reason": {
"type": "string"
},
"timestamp_creation": {
"type": "string"
}
},
"required": [
"name",
"tags",
"type",
"public_ip",
"gpu_count",
"resources",
"hostnode_id",
"internal_ip",
"rental_type",
"ssh_command",
"port_forwards",
"operating_system",
"timestamp_creation"
]
},
"status": {
"type": "string",
"enum": [
"Failed",
"Pending",
"Running",
"Terminated",
"Unknown"
],
"default": "Unknown"
}
},
"required": [
"id",
"createdAt",
"updatedAt",
"deletedAt",
"userId",
"startedAt",
"terminatedAt",
"externalId",
"rentalProvider",
"costPerHour",
"meta",
"status"
]
}
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v2/marketplace/virtual-machine-rentals/terminate": {
"post": {
"operationId": "marketplace-terminateVirtualMachineRental",
"summary": "Terminate a virtual machine rental",
"description": "Terminate a virtual machine rental",
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"rentalId": {
"type": "number"
},
"reason": {
"type": "string"
}
},
"required": [
"rentalId"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"rentalId": {
"type": "number"
}
},
"required": [
"message",
"rentalId"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v2/marketplace/bare-metal-rentals": {
"post": {
"operationId": "marketplace-createBareMetalRental",
"summary": "Create a bare metal rental",
"description": "Create a bare metal rental",
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"networkType": {
"type": "string",
"enum": [
"infiniband",
"ethernet"
]
},
"gpuCount": {
"type": "number",
"multipleOf": 8,
"minimum": 1,
"maximum": 144
}
},
"required": [
"networkType",
"gpuCount"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string",
"nullable": true
},
"deletedAt": {
"type": "string",
"nullable": true
},
"userId": {
"type": "string",
"maxLength": 50
},
"startedAt": {
"type": "string",
"nullable": true
},
"terminatedAt": {
"type": "string",
"nullable": true
},
"externalId": {
"type": "string"
},
"rentalProvider": {
"type": "string"
},
"costPerHour": {
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"meta": {}
},
"required": [
"id",
"createdAt",
"updatedAt",
"deletedAt",
"userId",
"startedAt",
"terminatedAt",
"externalId",
"rentalProvider",
"costPerHour"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
},
"get": {
"operationId": "marketplace-getActiveBareMetalRentals",
"summary": "Get a list of active bare metal rentals",
"description": "Get a list of active bare metal rentals",
"security": [
{
"Authorization": []
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string",
"nullable": true
},
"deletedAt": {
"type": "string",
"nullable": true
},
"userId": {
"type": "string",
"maxLength": 50
},
"startedAt": {
"type": "string",
"nullable": true
},
"terminatedAt": {
"type": "string",
"nullable": true
},
"externalId": {
"type": "string"
},
"rentalProvider": {
"type": "string"
},
"costPerHour": {
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"status": {
"type": "string",
"enum": [
"Failed",
"Pending",
"Running",
"Terminated",
"Unknown"
],
"default": "Unknown"
},
"meta": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"sub_order": {},
"node_count": {
"type": "number"
},
"rental_type": {
"type": "string",
"enum": [
"bare-metal"
]
},
"network_type": {
"type": "string"
},
"specs_per_node": {
"type": "object",
"properties": {
"ram_gb": {
"type": "number"
},
"cpu_count": {
"type": "number"
},
"cpu_model": {
"type": "string"
},
"gpu_count": {
"type": "number"
},
"gpu_model": {
"type": "string"
},
"storage_gb": {
"type": "number"
}
},
"required": [
"ram_gb",
"cpu_count",
"cpu_model",
"gpu_count",
"gpu_model",
"storage_gb"
]
},
"username": {
"type": "string"
},
"node_networking": {
"type": "array",
"items": {
"type": "object",
"properties": {
"public_ip": {
"type": "string"
},
"private_ip": {
"type": "string"
}
},
"required": [
"public_ip",
"private_ip"
]
}
},
"creation_timestamp": {
"type": "string"
},
"termination_reason": {
"type": "string"
}
},
"required": [
"name",
"node_count",
"rental_type",
"network_type",
"specs_per_node"
]
}
},
"required": [
"id",
"createdAt",
"updatedAt",
"deletedAt",
"userId",
"startedAt",
"terminatedAt",
"externalId",
"rentalProvider",
"costPerHour",
"status",
"meta"
]
}
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v2/marketplace/bare-metal-rentals/terminate": {
"post": {
"operationId": "marketplace-terminateBareMetalRental",
"summary": "Terminate a bare metal rental",
"description": "Terminate a bare metal rental",
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"rentalId": {
"type": "number"
},
"reason": {
"type": "string"
}
},
"required": [
"rentalId"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"rentalId": {
"type": "number"
}
},
"required": [
"message",
"rentalId"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v2/marketplace/virtual-machine-options": {
"get": {
"operationId": "marketplace-getVirtualMachineOptions",
"summary": "Get a list of virtual machine options",
"description": "Get a list of virtual machine options",
"security": [
{
"Authorization": []
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"gpuCount": {
"type": "number"
},
"resources": {
"type": "object",
"properties": {
"vcpuCount": {
"type": "number"
},
"ramGb": {
"type": "number"
},
"storageGb": {
"type": "number"
}
},
"required": [
"vcpuCount",
"ramGb",
"storageGb"
]
},
"costPerHour": {
"type": "number"
}
},
"required": [
"gpuCount",
"resources",
"costPerHour"
]
}
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v2/marketplace/bare-metal-options": {
"get": {
"operationId": "marketplace-getBareMetalOptions",
"summary": "Get a list of bare metal options",
"description": "Get a list of bare metal options",
"security": [
{
"Authorization": []
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"ethernet": {
"type": "object",
"properties": {
"gpuCount": {
"type": "number"
},
"costPerHour": {
"type": "number"
},
"specsPerNode": {
"type": "object",
"properties": {
"gpuCount": {
"type": "number"
},
"cpuModel": {
"type": "string"
},
"cpuCount": {
"type": "number"
},
"ramGb": {
"type": "number"
},
"storageGb": {
"type": "number"
}
},
"required": [
"gpuCount",
"cpuModel",
"cpuCount",
"ramGb",
"storageGb"
]
}
},
"required": [
"gpuCount",
"costPerHour",
"specsPerNode"
]
},
"infiniband": {
"type": "object",
"properties": {
"gpuCount": {
"type": "number"
},
"costPerHour": {
"type": "number"
},
"specsPerNode": {
"type": "object",
"properties": {
"gpuCount": {
"type": "number"
},
"cpuModel": {
"type": "string"
},
"cpuCount": {
"type": "number"
},
"ramGb": {
"type": "number"
},
"storageGb": {
"type": "number"
}
},
"required": [
"gpuCount",
"cpuModel",
"cpuCount",
"ramGb",
"storageGb"
]
}
},
"required": [
"gpuCount",
"costPerHour",
"specsPerNode"
]
}
},
"required": [
"ethernet",
"infiniband"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v2/marketplace/rental-history": {
"get": {
"operationId": "marketplace-getRentalHistory",
"summary": "Get a list of past rentals",
"description": "Get a list of past rentals",
"security": [
{
"Authorization": []
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string",
"nullable": true
},
"deletedAt": {
"type": "string",
"nullable": true
},
"userId": {
"type": "string",
"maxLength": 50
},
"startedAt": {
"type": "string",
"nullable": true
},
"terminatedAt": {
"type": "string",
"nullable": true
},
"externalId": {
"type": "string"
},
"rentalProvider": {
"type": "string"
},
"costPerHour": {
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"meta": {
"oneOf": [
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"type": {
"type": "string"
},
"public_ip": {
"type": "string"
},
"gpu_count": {
"type": "number"
},
"resources": {
"type": "object",
"properties": {
"ram_gb": {
"type": "number"
},
"storage_gb": {
"type": "number"
},
"vcpu_count": {
"type": "number"
},
"gpus": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"count": {
"type": "number"
}
},
"required": [
"count"
]
}
}
},
"required": [
"ram_gb",
"storage_gb",
"vcpu_count",
"gpus"
]
},
"hostnode_id": {
"type": "string"
},
"internal_ip": {
"type": "string"
},
"rental_type": {
"type": "string",
"enum": [
"virtual-machine"
]
},
"ssh_command": {
"type": "string"
},
"port_forwards": {
"type": "array",
"items": {
"type": "object",
"properties": {
"external_port": {
"type": "number"
},
"internal_port": {
"type": "number"
}
},
"required": [
"external_port",
"internal_port"
]
}
},
"operating_system": {
"type": "string"
},
"termination_reason": {
"type": "string"
},
"timestamp_creation": {
"type": "string"
}
},
"required": [
"name",
"tags",
"type",
"public_ip",
"gpu_count",
"resources",
"hostnode_id",
"internal_ip",
"rental_type",
"ssh_command",
"port_forwards",
"operating_system",
"timestamp_creation"
]
},
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"sub_order": {},
"node_count": {
"type": "number"
},
"rental_type": {
"type": "string",
"enum": [
"bare-metal"
]
},
"network_type": {
"type": "string"
},
"specs_per_node": {
"type": "object",
"properties": {
"ram_gb": {
"type": "number"
},
"cpu_count": {
"type": "number"
},
"cpu_model": {
"type": "string"
},
"gpu_count": {
"type": "number"
},
"gpu_model": {
"type": "string"
},
"storage_gb": {
"type": "number"
}
},
"required": [
"ram_gb",
"cpu_count",
"cpu_model",
"gpu_count",
"gpu_model",
"storage_gb"
]
},
"username": {
"type": "string"
},
"node_networking": {
"type": "array",
"items": {
"type": "object",
"properties": {
"public_ip": {
"type": "string"
},
"private_ip": {
"type": "string"
}
},
"required": [
"public_ip",
"private_ip"
]
}
},
"creation_timestamp": {
"type": "string"
},
"termination_reason": {
"type": "string"
}
},
"required": [
"name",
"node_count",
"rental_type",
"network_type",
"specs_per_node"
]
}
]
},
"totalCost": {
"type": "number"
}
},
"required": [
"id",
"createdAt",
"updatedAt",
"deletedAt",
"userId",
"startedAt",
"terminatedAt",
"externalId",
"rentalProvider",
"costPerHour",
"meta",
"totalCost"
]
}
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v2/skypilot/catalog": {
"get": {
"operationId": "skypilot-getCatalog",
"summary": "Provides a list of instances",
"description": "A parsed version of the Hyperbolic GPU marketplace, formatted to fit Skypilot conventions",
"security": [
{
"Authorization": []
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"vms": {
"type": "array",
"items": {
"type": "object",
"properties": {
"InstanceType": {
"type": "string"
},
"AcceleratorCount": {
"type": "number"
},
"AcceleratorName": {
"type": "string"
},
"MemoryGiB": {
"type": "number"
},
"StorageGiB": {
"type": "number"
},
"vCPUs": {
"type": "number"
},
"Price": {
"type": "number"
},
"Region": {
"type": "string"
},
"SpotPrice": {
"type": "string"
},
"GpuInfo": {
"type": "object",
"properties": {
"Gpus": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Manufacturer": {
"type": "string"
},
"Count": {
"type": "number"
},
"MemoryInfo": {
"type": "object",
"properties": {
"SizeInMiB": {
"type": "number"
}
},
"required": [
"SizeInMiB"
]
}
},
"required": [
"Name",
"Manufacturer",
"Count",
"MemoryInfo"
]
}
},
"TotalGpuMemoryInMiB": {
"type": "number"
}
},
"required": [
"Gpus",
"TotalGpuMemoryInMiB"
]
}
},
"required": [
"InstanceType",
"AcceleratorCount",
"AcceleratorName",
"MemoryGiB",
"StorageGiB",
"vCPUs",
"Price",
"Region",
"SpotPrice",
"GpuInfo"
]
}
}
},
"required": [
"vms"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v2/private/ledger-rentals": {
"post": {
"operationId": "private-ledgerRentalsJob",
"summary": "Runs user rental ledgering",
"description": "Kicks off an idempotent process that ledgers usage for all active rentals given a timeframe, defaulting to the past whole hour",
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"timeAnchor": {
"type": "string"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"timeAnchor": {
"type": "string"
},
"period": {
"type": "object",
"properties": {
"start": {
"type": "string"
},
"end": {
"type": "string"
}
},
"required": [
"start",
"end"
]
},
"success": {
"type": "array",
"items": {
"type": "object",
"properties": {
"userId": {
"type": "string"
},
"rentalId": {
"type": "number"
},
"cost": {
"type": "number"
},
"ledgeredAmount": {
"type": "number"
},
"idempotencyKey": {
"type": "string",
"nullable": true
},
"message": {
"type": "string"
}
},
"required": [
"userId",
"rentalId",
"cost",
"ledgeredAmount",
"idempotencyKey"
]
}
},
"error": {
"type": "array",
"items": {
"type": "object",
"properties": {
"userId": {
"type": "string"
},
"rentalId": {
"type": "number"
},
"cost": {
"type": "number"
},
"ledgeredAmount": {
"type": "number"
},
"idempotencyKey": {
"type": "string",
"nullable": true
},
"message": {
"type": "string"
},
"error": {
"type": "string",
"default": ""
}
},
"required": [
"userId",
"rentalId",
"cost",
"ledgeredAmount",
"idempotencyKey",
"error"
]
}
},
"skipped": {
"type": "array",
"items": {
"type": "object",
"properties": {
"userId": {
"type": "string"
},
"rentalId": {
"type": "number"
},
"cost": {
"type": "number"
},
"ledgeredAmount": {
"type": "number"
},
"idempotencyKey": {
"type": "string",
"nullable": true
},
"message": {
"type": "string"
}
},
"required": [
"userId",
"rentalId",
"cost",
"ledgeredAmount",
"idempotencyKey"
]
}
}
},
"required": [
"timeAnchor",
"period",
"success",
"error",
"skipped"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v2/private/terminate-rentals": {
"post": {
"operationId": "private-terminateRentalsJob",
"summary": "Runs user rental termination",
"description": "Terminates all active rentals as appropriate (eg, zero balance)",
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"includeBalanceNotifications": {
"type": "boolean"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
},
"required": [
"success"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/users/me": {
"get": {
"operationId": "user-getCurrent",
"summary": "Get the current user",
"description": "Get the current user",
"tags": [
"users"
],
"security": [
{
"Authorization": []
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"apiKey": {
"type": "string",
"nullable": true
},
"createdAt": {
"type": "string",
"nullable": true
},
"email": {
"type": "string",
"nullable": true,
"maxLength": 255
},
"emailVerified": {
"type": "boolean",
"nullable": true
},
"id": {
"type": "string",
"maxLength": 50
},
"isActive": {
"type": "boolean",
"nullable": true
},
"name": {
"type": "string",
"nullable": true,
"maxLength": 255
},
"picture": {
"type": "string",
"nullable": true
},
"provider": {
"type": "string",
"nullable": true,
"maxLength": 255
},
"publicKey": {
"type": "string",
"nullable": true
},
"onboardedAt": {
"type": "string",
"nullable": true
},
"onboardedFor": {
"type": "string",
"nullable": true,
"maxLength": 50
},
"referralCode": {
"type": "string",
"nullable": true
},
"completedPromos": {
"type": "array",
"items": {
"type": "string"
}
},
"role": {
"type": "string",
"enum": [
"user",
"pro",
"elite"
]
},
"roles": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"apiKey",
"createdAt",
"email",
"emailVerified",
"id",
"isActive",
"name",
"picture",
"provider",
"publicKey",
"onboardedAt",
"onboardedFor",
"referralCode",
"completedPromos",
"role",
"roles"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
},
"delete": {
"operationId": "user-deleteCurrentUser",
"summary": "Delete the current user",
"description": "Delete the current user",
"tags": [
"users"
],
"security": [
{
"Authorization": []
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
},
"required": [
"success"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
},
"put": {
"operationId": "user-updateCurrentUser",
"summary": "Update the current user",
"description": "Update the current user",
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"nullable": true,
"maxLength": 255
},
"onboardedFor": {
"type": "string",
"nullable": true,
"maxLength": 50
},
"publicKey": {
"type": "string",
"nullable": true
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"user": {
"type": "object",
"properties": {
"apiKey": {
"type": "string",
"nullable": true
},
"createdAt": {
"type": "string",
"nullable": true
},
"email": {
"type": "string",
"nullable": true,
"maxLength": 255
},
"emailVerified": {
"type": "boolean",
"nullable": true
},
"id": {
"type": "string",
"maxLength": 50
},
"isActive": {
"type": "boolean",
"nullable": true
},
"name": {
"type": "string",
"nullable": true,
"maxLength": 255
},
"picture": {
"type": "string",
"nullable": true
},
"provider": {
"type": "string",
"nullable": true,
"maxLength": 255
},
"publicKey": {
"type": "string",
"nullable": true
},
"onboardedAt": {
"type": "string",
"nullable": true
},
"onboardedFor": {
"type": "string",
"nullable": true,
"maxLength": 50
},
"referralCode": {
"type": "string",
"nullable": true
}
},
"required": [
"apiKey",
"createdAt",
"email",
"emailVerified",
"id",
"isActive",
"name",
"picture",
"provider",
"publicKey",
"onboardedAt",
"onboardedFor",
"referralCode"
]
}
},
"required": [
"success",
"user"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/users/me/api-key": {
"put": {
"operationId": "user-resetCurrentUserApiKey",
"summary": "Set the API key for the current user",
"description": "Set the API key for the current user",
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"apiKey": {
"type": "string",
"nullable": true
},
"success": {
"type": "boolean"
}
},
"required": [
"apiKey",
"success"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/users/referrals/by-code/:referralCode": {
"get": {
"operationId": "referral-getUserByReferralCode",
"summary": "Get a user by referral code",
"description": "Get a user by referral code",
"tags": [
"users"
],
"security": [
{
"Authorization": []
}
],
"parameters": [
{
"in": "query",
"name": "referralCode",
"schema": {
"type": "string"
},
"required": true
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"maxLength": 50
},
"name": {
"type": "string",
"nullable": true,
"maxLength": 255
},
"email": {
"type": "string",
"nullable": true,
"maxLength": 255
},
"referralCode": {
"type": "string",
"nullable": true
}
},
"required": [
"id",
"name",
"email",
"referralCode"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/users/me/referrals/outbound": {
"get": {
"operationId": "referral-listCurrentUserOutboundReferrals",
"summary": "Get the current user's outbound referrals (Who I referred?)",
"description": "Get the current user's outbound referrals (Who I referred?)",
"tags": [
"users"
],
"security": [
{
"Authorization": []
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string",
"nullable": true
},
"deletedAt": {
"type": "string",
"nullable": true
},
"referrerId": {
"type": "string",
"maxLength": 50
},
"referredId": {
"type": "string",
"maxLength": 50
},
"rewardedAt": {
"type": "string",
"nullable": true
}
},
"required": [
"id",
"createdAt",
"updatedAt",
"deletedAt",
"referrerId",
"referredId",
"rewardedAt"
]
}
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/users/me/referrals/inbound": {
"get": {
"operationId": "referral-getCurrentUserInboundReferral",
"summary": "Get the current user's referrer. (Who referred me?)",
"description": "Get the current user's referrer. (Who referred me?)",
"tags": [
"users"
],
"security": [
{
"Authorization": []
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"referral": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string",
"nullable": true
},
"deletedAt": {
"type": "string",
"nullable": true
},
"referrerId": {
"type": "string",
"maxLength": 50
},
"referredId": {
"type": "string",
"maxLength": 50
},
"rewardedAt": {
"type": "string",
"nullable": true
}
},
"required": [
"id",
"createdAt",
"updatedAt",
"deletedAt",
"referrerId",
"referredId",
"rewardedAt"
]
}
}
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.NOT_FOUND"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/users/me/referrals": {
"post": {
"operationId": "referral-create",
"summary": "Create a referral",
"description": "Create a referral",
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"referralCode": {
"type": "string"
}
},
"required": [
"referralCode"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
},
"required": [
"success"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"401": {
"description": "Authorization not provided",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.UNAUTHORIZED"
}
}
}
},
"403": {
"description": "Insufficient access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.FORBIDDEN"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
}
},
"components": {
"securitySchemes": {
"Authorization": {
"type": "http",
"scheme": "bearer"
}
},
"schemas": {
"error.BAD_REQUEST": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error message",
"example": "Invalid input data"
},
"code": {
"type": "string",
"description": "The error code",
"example": "BAD_REQUEST"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
]
},
"description": "An array of issues that were responsible for the error",
"example": []
}
},
"required": [
"message",
"code"
],
"title": "Invalid input data error (400)",
"description": "The error information",
"example": {
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}
},
"error.UNAUTHORIZED": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error message",
"example": "Authorization not provided"
},
"code": {
"type": "string",
"description": "The error code",
"example": "UNAUTHORIZED"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
]
},
"description": "An array of issues that were responsible for the error",
"example": []
}
},
"required": [
"message",
"code"
],
"title": "Authorization not provided error (401)",
"description": "The error information",
"example": {
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}
},
"error.FORBIDDEN": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error message",
"example": "Insufficient access"
},
"code": {
"type": "string",
"description": "The error code",
"example": "FORBIDDEN"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
]
},
"description": "An array of issues that were responsible for the error",
"example": []
}
},
"required": [
"message",
"code"
],
"title": "Insufficient access error (403)",
"description": "The error information",
"example": {
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}
},
"error.NOT_FOUND": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error message",
"example": "Not found"
},
"code": {
"type": "string",
"description": "The error code",
"example": "NOT_FOUND"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
]
},
"description": "An array of issues that were responsible for the error",
"example": []
}
},
"required": [
"message",
"code"
],
"title": "Not found error (404)",
"description": "The error information",
"example": {
"code": "NOT_FOUND",
"message": "Not found",
"issues": []
}
},
"error.INTERNAL_SERVER_ERROR": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error message",
"example": "Internal server error"
},
"code": {
"type": "string",
"description": "The error code",
"example": "INTERNAL_SERVER_ERROR"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
]
},
"description": "An array of issues that were responsible for the error",
"example": []
}
},
"required": [
"message",
"code"
],
"title": "Internal server error error (500)",
"description": "The error information",
"example": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment