# Capture a start/stop screenshot

`POST /api/timesheet/screenshot`

Captures a screenshot when the timer is started or stopped. This API allows uploading the screenshot file along with related metadata.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [Screenshot](https://sourcey-gauzy.pages.dev/api-reference/models/screenshot/index.md)

- `deletedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `createdAt` (optional)
  Type: string, date-time
  
  The creation timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `updatedAt` (optional)
  Type: string, date-time
  
  The last update timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `id` (optional)
  Type: string

- `isActive` (optional)
  Type: boolean
  
  default: true

- `isArchived` (optional)
  Type: boolean
  
  default: false

- `archivedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `tenantId` (optional)
  Type: string

- `organizationId` (optional)
  Type: string

- `file` (required)
  Type: string

- `thumb` (optional)
  Type: string

- `recordedAt` (optional)
  Type: timestamptz

- `storageProvider` (optional)
  Type: string
  
  enum: ["LOCAL","S3","WASABI","CLOUDINARY","DIGITALOCEAN"]

- `isWorkRelated` (optional)
  Type: string
  
  Specifies whether the image or screenshot is work-related.

- `description` (optional)
  Type: string
  
  Description of the image or screenshot.

- `apps` (optional)
  Type: json
  
  Applications associated with the image or screenshot.

- `timeSlotId` (optional)
  Type: string

- `userId` (optional)
  Type: string

Responses:

- 200: Screenshot captured successfully.

Content type: application/json

Type: object

Schema: [Screenshot](https://sourcey-gauzy.pages.dev/api-reference/models/screenshot/index.md)

- `deletedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `createdAt` (optional)
  Type: string, date-time
  
  The creation timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `updatedAt` (optional)
  Type: string, date-time
  
  The last update timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `id` (optional)
  Type: string

- `isActive` (optional)
  Type: boolean
  
  default: true

- `isArchived` (optional)
  Type: boolean
  
  default: false

- `archivedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `tenantId` (optional)
  Type: string

- `organizationId` (optional)
  Type: string

- `file` (required)
  Type: string

- `thumb` (optional)
  Type: string

- `recordedAt` (optional)
  Type: timestamptz

- `storageProvider` (optional)
  Type: string
  
  enum: ["LOCAL","S3","WASABI","CLOUDINARY","DIGITALOCEAN"]

- `isWorkRelated` (optional)
  Type: string
  
  Specifies whether the image or screenshot is work-related.

- `description` (optional)
  Type: string
  
  Description of the image or screenshot.

- `apps` (optional)
  Type: json
  
  Applications associated with the image or screenshot.

- `timeSlotId` (optional)
  Type: string

- `userId` (optional)
  Type: string

- 400: Invalid input provided. Check the response body for error details.

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/timesheet/screenshot' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "deletedAt": "2018-11-21T06:20:32.232Z",
  "createdAt": "2018-11-21T06:20:32.232Z",
  "updatedAt": "2018-11-21T06:20:32.232Z",
  "id": "string",
  "isActive": true,
  "isArchived": false,
  "archivedAt": "2018-11-21T06:20:32.232Z",
  "tenantId": "string",
  "organizationId": "string",
  "file": "string",
  "thumb": "string",
  "storageProvider": "LOCAL",
  "isWorkRelated": "string",
  "description": "string",
  "timeSlotId": "string",
  "userId": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "deletedAt": "2018-11-21T06:20:32.232Z",
  "createdAt": "2018-11-21T06:20:32.232Z",
  "updatedAt": "2018-11-21T06:20:32.232Z",
  "id": "string",
  "isActive": true,
  "isArchived": false,
  "archivedAt": "2018-11-21T06:20:32.232Z",
  "tenantId": "string",
  "organizationId": "string",
  "file": "string",
  "thumb": "string",
  "storageProvider": "LOCAL",
  "isWorkRelated": "string",
  "description": "string",
  "timeSlotId": "string",
  "userId": "string"
}`;

const response = await fetch('http://localhost:3000/api/timesheet/screenshot', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "deletedAt": "2018-11-21T06:20:32.232Z",
  "createdAt": "2018-11-21T06:20:32.232Z",
  "updatedAt": "2018-11-21T06:20:32.232Z",
  "id": "string",
  "isActive": true,
  "isArchived": false,
  "archivedAt": "2018-11-21T06:20:32.232Z",
  "tenantId": "string",
  "organizationId": "string",
  "file": "string",
  "thumb": "string",
  "storageProvider": "LOCAL",
  "isWorkRelated": "string",
  "description": "string",
  "timeSlotId": "string",
  "userId": "string"
}'''

response = requests.post(
    'http://localhost:3000/api/timesheet/screenshot',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
