API Documentation

Technical reference for the NextCoder API

  • GET/api/auth/session
    Required

    Get current user session information

  • POST/api/payments/checkout
    Required

    Create a Stripe checkout session for a subscription

  • POST/api/payments/webhook
    Webhook signature verification

    Handle Stripe webhook events

  • GET/api/workspaces
    Required

    List all workspaces for the authenticated user

  • POST/api/workspaces
    Required

    Create a new workspace

  • GET/api/workspaces/{id}
    Required

    Get details for a specific workspace

  • PUT/api/workspaces/{id}
    Required

    Update a workspace

  • DELETE/api/workspaces/{id}
    Required

    Delete a workspace

  • GET/api/agents
    Required

    List all AI agents for the authenticated user

  • POST/api/agents
    Required

    Create a new AI agent

  • GET/api/agents/{id}
    Required

    Get details for a specific AI agent

  • PUT/api/agents/{id}
    Required

    Update an AI agent

  • DELETE/api/agents/{id}
    Required

    Delete an AI agent

  • GET/api/integrations
    Required

    List all integrations for the authenticated user

  • POST/api/integrations
    Required

    Create a new integration

  • GET/api/integrations/{id}
    Required

    Get details for a specific integration

  • PUT/api/integrations/{id}
    Required

    Update an integration

  • DELETE/api/integrations/{id}
    Required

    Delete an integration

Authentication

All API requests require authentication via Clerk session cookies. The authentication is handled automatically when making requests from the browser.

Example Request

const response = await fetch('/api/workspaces', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
  },
});

const workspaces = await response.json();

Error Handling

The API uses standard HTTP status codes to indicate the success or failure of requests.

Success Codes

  • 200OK - Request successful
  • 201Created - Resource created successfully
  • 204No Content - Request successful, no content returned

Error Codes

  • 400Bad Request - Invalid request parameters
  • 401Unauthorized - Authentication required
  • 404Not Found - Resource not found
  • 500Internal Server Error - Something went wrong