# Projects

## List projects

This endpoint makes an HTTP GET request to retrieve a list of projects based on the provided keyword, with a specified limit and cursor for pagination

### Request

* Method: GET
* Endpoint: `https://api.thebrief.ai/v1/projects`
* Query Parameters:
  * `keyword` (string, optional): The keyword to search for projects.
  * `limit` (integer, optional): The maximum number of projects to be returned.
  * `cursor` (string, optional): A cursor for pagination.
  * `orderBy` (enum, optional): option to order the response results by the next fields:&#x20;

    ```typescript
    ID
    NAME
    CREATED_AT
    UPDATED_AT
    ```
  * `orderDirection` (enum, optional): option to order the response by direction:

    ```
    ASC
    DESC
    ```

```bash
curl --location 'https://api.thebrief.ai/v1/projects?keyword=Levai&limit=10&cursor=eyJsaW1pdCI6MSwibGFzdElkIjozOTE3MzQzfQ%3D%3D' \
--header 'Authorization: Bearer eyJh...'
```

### Response

Upon a successful execution, the response will have a status code of 200 and a JSON content type. The response body will contain the following structure:

JSON

```json
{
  "response": {
    "totalCount": 0,
    "nodes": [
      {
        "id": 0,
        "name": "",
        "createdBy": 0,
        "color": null,
        "description": null,
        "brandKit": {
          "id": 0,
          "name": ""
        }
      }
    ],
    "pageInfo": {
      "hasNextPage": true,
      "endCursor": ""
    }
  }
}

```

The `totalCount` indicates the total number of projects found, while the `nodes` array contains the project details such as `id`, `name`, `createdBy`, `color`, `description`, and `brandKit`. The `pageInfo` object specifies if there are more pages available for pagination, along with the `endCursor` for the next page.

```json
{
    "response": {
        "totalCount": 10,
        "nodes": [
            {
                "id": 3102440,
                "name": "api created user's project",
                "createdBy": 719026,
                "color": null,
                "description": null,
                "brandKit": {
                    "id": 1224286,
                    "name": "Lets tag this to project"
                }
            },
            {
                "id": 3102437,
                "name": "api created user's project",
                "createdBy": 719026,
                "color": null,
                "description": null,
                "brandKit": {
                    "id": 1224286,
                    "name": "Lets tag this to project"
                }
            },
            {
                "id": 2898068,
                "name": "Samuel Negru's project",
                "createdBy": 141,
                "color": null,
                "description": null,
                "brandKit": {
                    "id": 1224286,
                    "name": "Lets tag this to project"
                }
            },
           ...
            {
                "id": 2400300,
                "name": "Vridhi QA's project",
                "createdBy": 719026,
                "color": null,
                "description": null,
                "brandKit": {
                    "id": 1224286,
                    "name": "Lets tag this to project"
                }
            },
            {
                "id": 2313714,
                "name": "Tibi Orosz's project",
                "createdBy": 719026,
                "color": null,
                "description": null,
                "brandKit": {
                    "id": 1224286,
                    "name": "Lets tag this to project"
                }
            }
        ],
        "pageInfo": {
            "hasNextPage": true,
            "endCursor": "eyJsaW1pdCI6MTAsImxhc3RJZCI6MjMxMzcxNH0="
        }
    }
}
```

## Create Project

This endpoint allows you to create a new project.

### Request

* Method: POST
* Endpoint: `https://api.thebrief.ai/v1/projects`
* Body:
  * `name` (string, required): The name of the project.
  * `brandKitId` (integer, required): The ID of the brand kit associated with the project.

### Response

The response of this request can be documented as a JSON schema:

JSON

```json
{
    "type": "object",
    "properties": {
        "response": {
            "type": "object",
            "properties": {
                "project": {
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "integer"
                        },
                        "teamId": {
                            "type": "integer"
                        },
                        "name": {
                            "type": "string"
                        },
                        "createdBy": {
                            "type": "integer"
                        },
                        "color": {
                            "type": "string"
                        },
                        "description": {
                            "type": ["string", "null"]
                        },
                        "brandKit": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "name": {
                                    "type": "string"
                                },
                                "teamId": {
                                    "type": "integer"
                                },
                                "typography": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "fontId": {
                                                "type": ["integer", "null"]
                                            },
                                            "fontName": {
                                                "type": "string"
                                            },
                                            "fontSize": {
                                                "type": "integer"
                                            },
                                            "fontWeight": {
                                                "type": "string"
                                            },
                                            "type": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                },
                                "createdBy": {
                                    "type": "integer"
                                }
                            }
                        }
                  }
            }
      }
}


```

## Delete Project

This endpoint allows you to delete a project.

### Request

* Method: DELETE
* Endpoint: `https://api.thebrief.ai/v1/projects`
* Body:
  * `projectId` (integer, required): The ID of the project you want to delete.

{% code title="Request example" %}

```bash
curl --location --request DELETE 'https://api.thebrief.ai/v1/projects' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhdXRob3JpemF0aW9uIjoiQmVhcmVyIGV5SmhiR2NpT2lKSVV6STFOaUlzSW5SNWNDSTZJa3BYVkNKOS5leUpwWVhRaU9qRTJPREV4TVRVMU56YzVPRElzSW1Oc2FXVnVkRWxrSWpvaU16QmpaalJsTldRdE1XRmxOQzAwT1RrNExUa3lNV010TVdVMU5qZzJOemd4WW1VeEluMC56WlRDX0ZHZW5FdklRZHhZTlk1cW9OWnlxSEdEOUYtTUtpNm1uV0h6V1NvIiwiYWxnIjoiSFMyNTYifQ.eyJjbGllbnRJZCI6IjZhMzhlYTk3LTEyOWQtNDE3MS04NTljLTU1MzVjOWYzZTRlMSJ9.gWvLWJSqk0bSO78t5xxdYcR08KHAyvQtKCxd0mnlK5U' \
--data '{
    "projectId": 123
}'
```

{% endcode %}

### Response

```
{
    "response": 
    {
        "status": "success" 
    }
}
```

## Update projects

This endpoint allows you to update the name and the assigned brandkit for a project.

### Request

* Method: `PUT`
* Endpoint: `https://api.thebrief.ai/v1/projects`
* Body:
  * `projectId` (integer, required): The project id
  * `name` (string, optional): The new name of the project.
  * `assignedBrandKitId` (integer, optional): The id of the assigned brandkit.
  * `isBrandKitSelectable` (boolean, optional): true if brandkits are selectable from Editor.

### Response

The response will be in JSON format with the following structure:

```graphql
{
    "type": "object",
    "properties": {
        "response": {
            "type": "object",
            "properties": {
                "project": {
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "integer"
                        },
                        "teamId": {
                            "type": "integer"
                        },
                        "name": {
                            "type": "string"
                        },
                        "createdBy": {
                            "type": "integer"
                        },
                        "color": {
                            "type": "string"
                        },
                        "description": {
                            "type": ["string", "null"]
                        },
                        "brandKit": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "name": {
                                    "type": "string"
                                },
                                "teamId": {
                                    "type": "integer"
                                },
                                "typography": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "fontId": {
                                                "type": ["integer", "null"]
                                            },
                                            "fontName": {
                                                "type": "string"
                                            },
                                            "fontSize": {
                                                "type": "integer"
                                            },
                                            "fontWeight": {
                                                "type": "string"
                                            },
                                            "type": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                },
                                "createdBy": {
                                    "type": "integer"
                                }
                            }
                        }
                  }
            }
      }
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thebrief.ai/public-api/rest-api/projects.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
