1.0.0 • Published 6 months ago
@artistify/artistify-sdk-express v1.0.0
Artistify AI SDK Express Server
This Express server provides a RESTful API interface to the Artistify AI SDK, allowing you to easily integrate the Artistify AI platform into your applications.
Features
- Authentication with Solana wallet-based credentials
- Image generation API
- Song generation API
- User management
- Agents listing
- Analytics data
- Webhook support for event notifications
Installation
- Clone this repository
- Install dependencies:
npm install- Create a
.envfile in the root directory with the following variables:
PORT=3000
ARTISTIFY_API_URL=https://your-artistify-instance.com/apiRunning the Server
Development mode
npm run devProduction mode
npm startAPI Endpoints
Authentication
GET /api/auth/message- Get a message to signPOST /api/auth/authenticate- Authenticate with signed messagePOST /api/auth/logout- Logout
Images
GET /api/images- List imagesGET /api/images/:id- Get a specific imageGET /api/images/:id/status- Check image generation statusPOST /api/images- Create a new image
Songs
GET /api/songs- List songsGET /api/songs/:id- Get a specific songGET /api/songs/:id/status- Check song generation statusPOST /api/songs- Create a new songPOST /api/songs/generate- Generate a song directly
User
GET /api/user/info- Get current user informationGET /api/user/credits- Get user credits
Agents
GET /api/agents- List available agentsGET /api/agents/:id- Get a specific agent
Analytics
GET /api/analytics- Get analytics data
Webhooks
POST /api/webhooks/register- Register a webhook for notificationsPOST /api/webhooks/callback- Webhook callback endpoint (for Artistify AI to send events)
Authentication
This server uses Solana wallet-based authentication. To authenticate:
- Call
GET /api/auth/messageto get a message string - Sign the message with a Solana wallet
- Send the signed message, original message, and public key to
POST /api/auth/authenticate - The server will return a success response if authentication is successful
Webhooks
You can set up webhook listeners to be notified when specific events occur on the Artistify AI platform.
To register a webhook:
// Register a webhook for song and image completion events
const webhook = await fetch("/api/webhooks/register", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
url: "https://your-server.com/webhook-endpoint",
events: ["song.completed", "image.completed"],
}),
});The POST /api/webhooks/callback endpoint is used internally by the Artistify AI platform to deliver webhook events to this server.
License
MIT
1.0.0
6 months ago