Create Project
The createProject endpoint allows you to create a new project to organize your prompts. Projects help you group related prompts together for better organization and management.
import { PromptTK } from "@devvle/ptk-api-sdk";
const promptTK = new PromptTK({ userId: "your-user-id", apiKey: "your-api-key",});
async function createProject() { const projectName = "My New Project"; const projectDescription = "A project for organizing my marketing prompts";
try { const response = await promptTK.createProject( projectName, projectDescription // Optional ); console.log("Project created:", response); } catch (error) { console.error("Error creating project:", error); }}
createProject();Expected Output:
{ success: true, message: 'Project created successfully', data: { projectId: 'abc123xyz789', name: 'My New Project', description: 'A project for organizing my marketing prompts', createdAt: '2024-01-15T12:00:00.000Z' }}The createProject function makes a request to the following endpoint:
POST /v1/projects/newRequest Body
Section titled “Request Body”{ "name": "string", // required "description": "string" // optional}Headers
Section titled “Headers”| Header | Value |
|---|---|
Content-Type | application/json |
Authorization | Bearer your-api-key |
x-user-id | your-user-id |
Response
Section titled “Response”On success (201 Created):
{ "success": true, "message": "Project created successfully", "data": { "projectId": "string", "name": "string", "description": "string", "createdAt": "ISO 8601 timestamp" }}On error:
{ "success": false, "message": "Project name is required"}or
{ "success": false, "message": "Failed to create project", "error": "Detailed error information"}- The
nameparameter is required and must not be empty - The
descriptionparameter is optional but recommended for better organization - Project names do not need to be unique (though unique names are recommended)
- Once created, you can use the
projectIdwhen generating prompts to associate them with this project - Projects can be used to organize prompts by topic, client, or any other grouping that makes sense for your workflow