# Create Goal

`POST /api/goals`

Authentication (security requirement alternatives):

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

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

Request body: application/json (required)

Type: object

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

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

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

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

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

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

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

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

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

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

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

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

Responses:

- 200: Goal Created successfully

Content type: application/json

Type: object

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

- `deadline` (required)
  Type: string

- `level` (required)
  Type: string
  
  enum: ["Organization","Team","Employee"]

- `progress` (required)
  Type: number

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

- `ownerTeamId` (required)
  Type: string

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

- `ownerEmployeeId` (required)
  Type: string

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

- `leadId` (required)
  Type: string

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

- `alignedKeyResultId` (required)
  Type: string

- `organizationStrategicInitiative` (optional)
  Type: object

- `organizationStrategicInitiativeId` (optional)
  Type: string

- `keyResults` (required)
  Type: array
  
  Items:
    Reference: [KeyResult](https://sourcey-gauzy.pages.dev/api-reference/models/keyresult/index.md); Type: object

- 401: Unauthorized

- 403: Forbidden

## Examples

### cURL

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

### JavaScript

```javascript
const response = await fetch('http://localhost:3000/api/goals', {
  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/goals',
    data='{}'.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
