The PiOpenHub API provides a set of endpoints for interacting with the PiOpenHub application. This API allows users to manage accounts, perform transactions, and access blockchain-related functionalities.
https://api.piopenhub.com/v1
All API requests require authentication via a JSON Web Token (JWT). To obtain a token, users must log in with their credentials.
- URL:
/auth/login - Method:
POST - Request Body:
{ "username": "your_username", "password": "your_password" } - Response:
- 200 OK:
{ "token": "your_jwt_token" } - 401 Unauthorized:
{ "message": "Invalid credentials" }
- 200 OK:
- URL:
/users - Method:
POST - Request Body:
{ "username": "new_user", "email": "new_user@example.com", "password": "secure_password" } - Response:
- 201 Created:
{ "id": 1, "username": "new_user", "email": "new_user@example.com" } - 400 Bad Request:
{ "message": "Validation error" }
- 201 Created:
- URL:
/users/{id} - Method:
GET - Headers:
Authorization: Bearer your_jwt_token
- Response:
- 200 OK:
{ "id": 1, "username": "new_user", "email": "new_user@example.com" } - 404 Not Found:
{ "message": "User not found" }
- 200 OK:
- URL:
/transactions - Method:
POST - Headers:
Authorization: Bearer your_jwt_token
- Request Body:
{ "to": "recipient_address", "amount": 0.01, "currency": "XLM" } - Response:
- 201 Created:
{ "transaction_id": "txn_123456", "status": "pending" } - 400 Bad Request:
{ "message": "Insufficient funds" }
- 201 Created:
- URL:
/transactions/{id} - Method:
GET - Headers:
Authorization: Bearer your_jwt_token
- Response:
- 200 OK:
{ "transaction_id": "txn_123456", "from": "sender_address", "to": "recipient_address", "amount": 0.01, "currency": "XLM", "status": "completed" } - 404 Not Found:
{ "message": "Transaction not found" }
- 200 OK:
The API uses standard HTTP status codes to indicate the success or failure of a request. The response body will contain a JSON object with a message field describing the error.
- 400 Bad Request: The request was invalid or cannot be served.
- 401 Unauthorized: Authentication failed or user does not have permissions for the requested operation.
- 404 Not Found: The requested resource could not be found.
- 500 Internal Server Error: An unexpected error occurred on the server.
To ensure fair usage of the API, rate limiting is enforced. Each user is allowed a maximum of 100 requests per minute. Exceeding this limit will result in a 429 Too Many Requests response.
This API documentation provides a comprehensive overview of the available endpoints and their usage. For further assistance, please contact the support team at support@piopenhub.com.