# Create new record

`POST /api/invoices`

Authentication (security requirement alternatives):

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

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

Request body: application/json (required)

Type: object

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

- `fromOrganization` (optional)
  Type: object
  
  readOnly: true

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

- `sentTo` (optional)
  Type: string
  
  readOnly: true

- `invoiceType` (optional)
  Type: string
  
  enum: ["BY_EMPLOYEE_HOURS","BY_PROJECT_HOURS","BY_TASK_HOURS","BY_PRODUCTS","BY_EXPENSES","DETAILED_ITEMS"]
  
  readOnly: true

Responses:

- 201: The record has been successfully created.

- 400: Invalid input, The response body may contain clues as to what went wrong

- 401: Unauthorized

- 403: Forbidden

## Examples

### cURL

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

### JavaScript

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