# Keys

{% hint style="danger" %}
This endpoint is only available for user tokens, **not project keys**!
{% endhint %}

## List

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/keys`

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | User token  |

{% tabs %}
{% tab title="200 " %}

```
[
    {
        "_id": ObjectId,
        "type": String, //Ideally CLOUD-PROJECT-KEY or LOGIN
        "token": String, 
        "project": ObjectId,
        "name": String,
        "date": Number //Unix timestamp
    }
]
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}

## Create

<mark style="color:green;">`POST`</mark> `https://api.suble.io/projects/:projectId/keys`

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | User token  |

#### Request Body

| Name | Type   | Description             |
| ---- | ------ | ----------------------- |
| name | string | Name of the project key |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": ObjectId,
    "type": String, //CLOUD-PROJECT-KEY
    "token": String, 
    "project": ObjectId,
    "name": String,
    "date": Number //Unix timestamp
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}
