Skip to content

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/new
{
"name": "string", // required
"description": "string" // optional
}
HeaderValue
Content-Typeapplication/json
AuthorizationBearer your-api-key
x-user-idyour-user-id

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 name parameter is required and must not be empty
  • The description parameter 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 projectId when 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