> For the complete documentation index, see [llms.txt](https://lilbobbytables.gitbook.io/mycrt-user-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lilbobbytables.gitbook.io/mycrt-user-guide/rest-api/untitled-1.md).

# Captures

## Get All Captures

Gets information for all of the captures that a user has access to.

```
GET /api/captures
```

#### Permissions

User must be logged in. User must be a member of the environment.

#### Success Response

```
200 OK
```

```typescript
[
    {
        "id": 1,
        "name": "myCapture",
        "start": "2018-05-19T22:06:53.000Z",
        "scheduledStart": null,
        "scheduledEnd": null,
        "end": "2018-05-19T22:20:39.000Z",
        "status": "DONE",
        "envId": 1,
        "type": "CAPTURE",
        "reason": null
    }
]
```

#### Error Response

```
404 NOT FOUND
```

```typescript
{
    "code": 404,
    "message": "Environment does not exist"
}
```

## Get a Specific Capture

Gets the information of a specific capture associated with an environment.

```
GET /api/captures/{id}
```

#### Permissions

User must be logged in. User must be a member of the environment.

#### Query Params <a href="#query-params" id="query-params"></a>

| Param        | Description              | Optional/Required |
| ------------ | ------------------------ | ----------------- |
| id=\[number] | id of the capture to get | Required          |

#### Success Response

```
200 OK
```

```typescript
{
    "id": 1,
    "name": "myCapture",
    "start": "2018-05-19T22:06:53.000Z",
    "scheduledStart": null,
    "scheduledEnd": null,
    "end": "2018-05-19T22:20:39.000Z",
    "status": "DONE",
    "envId": 1,
    "type": "CAPTURE",
    "reason": null
}
```

#### Error Response

```
404 NOT FOUND
```

```typescript
{
    "code": 404,
    "message": "Capture's environment not found"
}
```

## Get Metrics for a Specific Capture

Gets the CloudWatch metrics associated with specific capture associated with an environment.

```
GET /api/captures/{id}/metrics
```

#### Permissions

User must be logged in. User must be a member of the environment.

#### Query Params <a href="#query-params" id="query-params"></a>

| Param        | Description                          | Optional/Required |
| ------------ | ------------------------------------ | ----------------- |
| id=\[number] | id of the capture to get metrics for | Required          |

#### Success Response

```
200 OK
```

```typescript
[
    {
        "label": "ReadIOPS",
        "type": "READ IOPS",
        "displayName": "READ IOPS",
        "dataPoints": [
            {
                "Timestamp": "2018-05-17T00:53:00.000Z",
                "Maximum": 0.06666888896296544,
                "Unit": "Count/Second"
            }
    }
]
```

#### Error Response

```
404 NOT FOUND
```

```typescript
{
    "code": 404,
    "message": "Capture's environment not found"
}
```

## Stop a Capture

Stops a specific capture associated with a given environment. The capture must be in the “Running” state before it is stopped.

```
POST /api/captures/{id}/stop
```

#### Permissions

User must be logged in. User must either be the owner of the capture or be an  admin of the environment.

#### Query Params <a href="#query-params" id="query-params"></a>

| Param        | Description               | Optional/Required |
| ------------ | ------------------------- | ----------------- |
| id=\[number] | id of the capture to stop | Required          |

#### Success Response

```
200 OK
```

#### Error Response

```
404 NOT FOUND
```

```typescript
{
    "code": 404,
    "message": "Capture not found"
}
```

```
409 CONFLICT
```

```typescript
{
    "code": 409,
    "message": "This capture has already been stopped"
}
```

```typescript
{
    "code": 409,
    "message": "This capture failed and is no longer running"
}
```

```typescript
{
    "code": 409,
    "message": "Cannot stop a capture until it has started completely. Try again soon."
}
```

## Edit a Capture

Edits the information of a specific capture associated with an environment.

```
PUT /api/captures/{id}
```

#### Permissions

User must be logged in. User must either be the owner of the capture or be an  admin of the environment.

#### Query Params <a href="#query-params" id="query-params"></a>

| Param        | Description               | Optional/Required |
| ------------ | ------------------------- | ----------------- |
| id=\[number] | id of the capture to edit | Required          |

#### Sample Request Body

```typescript
{
 "name" : "newName"
}
```

#### Success Response

```
200 OK
```

#### Error Response

```
400 BAD REQUEST
```

```typescript
{
    "code": 400,
    "message": "Capture with the same name already exists in this environment"
}
```

```
404 NOT FOUND
```

```typescript
{
    "code": 404,
    "message": "Capture not found"
}
```

## Post a New Capture

Creates a new capture in an environment.

```
POST /api/captures
```

#### Permissions

User must be logged in. User must be a member of the environment.

#### Body Params

| Param                  | Description                                                          | Optional/Required |
| ---------------------- | -------------------------------------------------------------------- | ----------------- |
| name=\[string]         | Name of the capture that will be displayed in the UI                 | Required          |
| envId=\[number]        | id of the environment that the capture belongs to                    | Required          |
| status=\[string]       | Status of the capture. Must be ‘SCHEDULED’, ‘STARTED’, or ‘STARTING’ | Optional          |
| start=\[date]          | Time that the capture actually started                               | Optional          |
| scheduledStart=\[date] | Time that the capture is scheduled for                               | Optional          |
| duration=\[number]     | How long the capture will run for                                    | Optional          |

#### Sample Request Body

```typescript
{
 "name" : "myCapture",
 "start" : "2018-05-19 12:00:00",
 "end" : null,
 "envId" : 1,
 "scheduledStart": null
}
```

#### Success Response

```
200 OK
```

```typescript
{
    "id": 1,
    "name": "myCapture",
    "start": "2018-05-19 12:00:00",
    "scheduledStart": null,
    "scheduledEnd": null,
    "end": null,
    "status": "STARTED",
    "envId": 1,
    "type": "CAPTURE",
    "reason": null
}
```

#### Error Response

```
400 BAD REQUEST
```

```typescript
{
    "code": 400,
    "message": "Capture with the same name already exists in this environment"
}
```

```typescript
{
    "code": 400,
    "message": "Duration must be at least 60 seconds"
}
```

```typescript
{
    "code": 400,
    "message": "Cannot schedule without a schedule start time"
}
```

## Delete a Capture

Deletes a specific capture associated with an environment.&#x20;

```
DELETE /api/captures/{id}
```

#### Permissions

User must be logged in. User must either be the owner of the capture or be an admin of the environment.

#### Query Params <a href="#query-params" id="query-params"></a>

| Param        | Description                 | Optional/Required |
| ------------ | --------------------------- | ----------------- |
| id=\[number] | id of the capture to delete | Required          |

#### Success Response

```
200 OK
```

#### Error Response

```
404 NOT FOUND
```

```typescript
{
    "code": 404,
    "message": "Capture not found"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://lilbobbytables.gitbook.io/mycrt-user-guide/rest-api/untitled-1.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.
