# Create a project

Source: https://openpanel.sh/docs/api/projects/create-a-project

Made with its production environment; you get admin access to it.

`POST https://openpanel.sh/api/v1/projects`

## Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `Idempotency-Key` | header | no | Any unique string up to 255 characters. Sending the same request again with it returns the first answer instead of creating twice. |

## Request body

JSON, `ProjectCreate`.

## Responses

| Status | Meaning | Body |
|---|---|---|
| 201 | Create a project | `application/json`, `Project` |
| 401 | No valid credential was sent. | `application/problem+json`, `Problem` |
| 403 | The credential may not do this. | `application/problem+json`, `Problem` |
| 409 | It clashes with something that exists, such as a name in use. | `application/problem+json`, `Problem` |
| 422 | The input was refused; detail says why. | `application/problem+json`, `Problem` |
| 429 | Too many requests; wait for Retry-After seconds. | `application/problem+json`, `Problem` |

## Schemas

### Environment

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "production": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "name",
    "production"
  ]
}
```

### Problem

```json
{
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "description": "A link to the error's explanation in the docs."
    },
    "title": {
      "type": "string"
    },
    "status": {
      "type": "integer"
    },
    "code": {
      "type": "string",
      "description": "Stable machine-readable code: not_found, forbidden, invalid, conflict, rate_limited, not_implemented, …"
    },
    "detail": {
      "type": "string",
      "description": "What went wrong, in a sentence written for a person."
    }
  },
  "required": [
    "type",
    "title",
    "status",
    "code",
    "detail"
  ]
}
```

### Project

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "organizationId": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "slug": {
      "type": "string",
      "description": "The project's part of its services' opnl.app addresses."
    },
    "visibility": {
      "type": "string",
      "enum": [
        "organization",
        "private"
      ]
    },
    "createdBy": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "access": {
      "type": "string",
      "enum": [
        "none",
        "view",
        "deploy",
        "admin"
      ],
      "description": "The caller's own access to this project."
    },
    "environments": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Environment"
      }
    }
  },
  "required": [
    "id",
    "organizationId",
    "name",
    "slug",
    "visibility",
    "createdBy",
    "createdAt",
    "updatedAt",
    "access",
    "environments"
  ]
}
```

### ProjectCreate

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 60,
      "description": "The project's name, up to 60 characters."
    },
    "visibility": {
      "description": "organization (default): everyone in the organization by their role; private: only people given access.",
      "type": "string",
      "enum": [
        "organization",
        "private"
      ]
    }
  },
  "required": [
    "name"
  ],
  "additionalProperties": false
}
```