# Create a key result

`POST /api/key-results`

Authentication (security requirement alternatives):

```json
[
  {
    "bearer": []
  }
]
```

- bearer: http (bearer), header JWT. Enter JWT token

Request body: application/json (required)

Type: object

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

- `name` (required)
  Type: string
  
  readOnly: true

- `description` (required)
  Type: string
  
  readOnly: true

- `type` (required)
  Type: string
  
  readOnly: true

- `targetValue` (required)
  Type: number
  
  readOnly: true

- `initialValue` (required)
  Type: number
  
  readOnly: true

- `unit` (required)
  Type: string
  
  readOnly: true

- `update` (required)
  Type: number
  
  readOnly: true

- `progress` (required)
  Type: number
  
  readOnly: true

- `deadline` (required)
  Type: string
  
  readOnly: true

- `hardDeadline` (required)
  Type: string, date-time
  
  readOnly: true

- `softDeadline` (required)
  Type: string, date-time
  
  readOnly: true

- `status` (required)
  Type: string
  
  readOnly: true

- `weight` (required)
  Type: string
  
  readOnly: true

- `ownerId` (required)
  Type: string
  
  readOnly: true

- `owner` (required)
  Type: object
  
  readOnly: true

- `lead` (required)
  Type: object
  
  readOnly: true

- `leadId` (required)
  Type: string
  
  readOnly: true

- `project` (required)
  Type: object
  
  readOnly: true

- `projectId` (required)
  Type: string
  
  readOnly: true

- `task` (required)
  Type: object
  
  readOnly: true

- `kpi` (required)
  Type: object
  
  readOnly: true

- `kpiId` (required)
  Type: string
  
  readOnly: true

- `goal` (required)
  Type: object
  
  readOnly: true

- `goalId` (required)
  Type: string
  
  readOnly: true

- `updates` (required)
  Type: array
  
  readOnly: true
  
  Items:
    Type: object

Responses:

- 200: Key Result Created

Content type: application/json

Type: object

Schema: [KeyResult](https://sourcey-gauzy.pages.dev/api-reference/models/keyresult/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

- `name` (required)
  Type: string

- `description` (required)
  Type: string

- `type` (required)
  Type: string
  
  enum: ["Numerical","True/False","Currency","Task","KPI"]

- `targetValue` (required)
  Type: number

- `initialValue` (required)
  Type: number

- `unit` (required)
  Type: string

- `update` (required)
  Type: number

- `progress` (required)
  Type: number

- `deadline` (required)
  Type: string
  
  enum: ["No Custom Deadline","Hard Deadline","Hard and Soft Deadline"]

- `hardDeadline` (required)
  Type: string, date-time

- `softDeadline` (required)
  Type: string, date-time

- `status` (required)
  Type: string

- `weight` (required)
  Type: string

- `owner` (required)
  Reference: [Employee](https://sourcey-gauzy.pages.dev/api-reference/models/employee/index.md); Type: object

- `ownerId` (required)
  Type: string

- `lead` (required)
  Reference: [Employee](https://sourcey-gauzy.pages.dev/api-reference/models/employee/index.md); Type: object

- `leadId` (required)
  Type: string

- `project` (required)
  Reference: [OrganizationProject](https://sourcey-gauzy.pages.dev/api-reference/models/organizationproject/index.md); Type: object

- `projectId` (required)
  Type: string
  
  readOnly: true

- `task` (required)
  Reference: [Task](https://sourcey-gauzy.pages.dev/api-reference/models/task/index.md); Type: object

- `taskId` (required)
  Type: string
  
  readOnly: true

- `kpi` (required)
  Reference: [GoalKPI](https://sourcey-gauzy.pages.dev/api-reference/models/goalkpi/index.md); Type: object

- `kpiId` (required)
  Type: string
  
  readOnly: true

- `goal` (required)
  Reference: [Goal](https://sourcey-gauzy.pages.dev/api-reference/models/goal/index.md); Type: object

- `goalId` (required)
  Type: string
  
  readOnly: true

- `updates` (required)
  Reference: [KeyResultUpdate](https://sourcey-gauzy.pages.dev/api-reference/models/keyresultupdate/index.md); Type: object

- 401: Unauthorized

- 403: Forbidden

- 404: Key Result not found

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/key-results' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{}'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:3000/api/key-results', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body: '{}',
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:3000/api/key-results',
    data='{}'.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
