> ## Documentation Index
> Fetch the complete documentation index at: https://shivamgoyal.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# API Creation

> Learn how to create and configure new APIs in the CodeNull API Dashboard

# API Creation

The API Creation tool in CodeNull allows you to design and implement backend APIs for your web application without writing complex code. This guide walks you through the process of creating robust, scalable API endpoints that connect to your database and external services.

## Overview

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/shivamgoyal/images/api-creation-overview.png" alt="API Creation Interface" />
</Frame>

The API Creation interface provides an intuitive visual environment for designing your application's backend services. It allows you to:

* Define API endpoints with appropriate HTTP methods
* Configure request and response schemas
* Implement business logic using a visual flow editor
* Connect endpoints to your database collections
* Add authentication and authorization rules
* Test your APIs in real-time

## Creating Your First API

<Steps>
  <Step title="Navigate to the API Dashboard">
    From your CodeNull workspace, click on "API Dashboard" in the left navigation panel.
  </Step>

  <Step title="Create a New API">
    Click the "Create New API" button in the top-right corner of the dashboard.
  </Step>

  <Step title="Define API Details">
    Enter the basic information for your API:

    * **API Name**: A descriptive name for your API (e.g., "Product Management")
    * **Base Path**: The root URL path for your API (e.g., "/api/products")
    * **Description**: A brief explanation of what your API does
  </Step>

  <Step title="Configure API Settings">
    Set global options for your API:

    * **Authentication**: Choose authentication method (None, API Key, JWT, OAuth)
    * **Rate Limiting**: Configure request limits to prevent abuse
    * **CORS Settings**: Specify allowed origins and methods
    * **Response Format**: Define standard response structure
  </Step>

  <Step title="Save API Configuration">
    Click "Create API" to generate your API structure. You'll be redirected to the endpoint management screen where you can add specific endpoints.
  </Step>
</Steps>

## API Configuration Options

<Tabs>
  <Tab title="Authentication">
    <Frame>
      <img src="https://mintlify.s3.us-west-1.amazonaws.com/shivamgoyal/images/api-auth-config.png" alt="API Authentication Configuration" />
    </Frame>

    Choose from multiple authentication options:

    * **No Authentication**: Publicly accessible API
    * **API Key**: Simple key-based authentication
    * **JWT**: JSON Web Token authentication
    * **OAuth 2.0**: Industry-standard protocol for authorization

    For each method, you can configure specific settings such as token expiration, key rotation policies, and scope definitions.
  </Tab>

  <Tab title="Rate Limiting">
    <Frame>
      <img src="https://mintlify.s3.us-west-1.amazonaws.com/shivamgoyal/images/api-rate-config.png" alt="API Rate Limiting Configuration" />
    </Frame>

    Protect your API from abuse by setting rate limits:

    * **Requests per minute**: Control request frequency
    * **Total daily requests**: Set maximum daily usage
    * **Per-endpoint limits**: Configure different limits for specific endpoints
    * **Client identification**: Choose how to identify clients (IP, API key, user)
  </Tab>

  <Tab title="CORS">
    <Frame>
      <img src="https://mintlify.s3.us-west-1.amazonaws.com/shivamgoyal/images/api-cors-config.png" alt="API CORS Configuration" />
    </Frame>

    Configure Cross-Origin Resource Sharing settings:

    * **Allowed Origins**: Specify which domains can access your API
    * **Allowed Methods**: Control which HTTP methods are permitted
    * **Allowed Headers**: Define accepted request headers
    * **Credentials Support**: Enable/disable cookies and authentication
  </Tab>
</Tabs>

## Connecting to Data Sources

Your API can connect to various data sources:

<CardGroup cols={3}>
  <Card title="MongoDB Collections" icon="database">
    Connect to your NoSQL database collections
  </Card>

  <Card title="SQL Tables" icon="table">
    Link to relational database tables
  </Card>

  <Card title="External APIs" icon="globe">
    Integrate with third-party API services
  </Card>

  <Card title="Serverless Functions" icon="bolt">
    Execute custom serverless functions
  </Card>

  <Card title="Static Data" icon="file">
    Use static JSON or CSV data
  </Card>

  <Card title="Real-time Sources" icon="broadcast-tower">
    Connect to WebSockets or SSE
  </Card>
</CardGroup>

## Best Practices

Follow these best practices when creating APIs:

* **Use RESTful conventions**: Follow REST principles for intuitive API design
* **Consistent naming**: Use consistent patterns for endpoint URLs
* **Proper status codes**: Return appropriate HTTP status codes
* **Versioning**: Include version information in your API paths
* **Input validation**: Validate all input data to prevent errors and security issues
* **Response formatting**: Maintain consistent response structure

## Next Steps

<CardGroup cols={2}>
  <Card title="Endpoints Management" icon="sitemap" href="/api-dashboard/endpoints-management">
    Learn how to create and manage specific API endpoints
  </Card>

  <Card title="Database Integration" icon="database" href="/database-dashboard/overview">
    Explore how to connect your API to database resources
  </Card>
</CardGroup>
