# Staff API

## List staffs

> Returns a paginated list of staffs.

```json
{"openapi":"3.0.0","info":{"title":"Staff API","version":"1.0.0"},"servers":[{"url":"https://{domain}/api/v1","variables":{"domain":{"default":"sandbox.akinon.com"}}}],"security":[{"OmnitronAuth":[]}],"components":{"securitySchemes":{"OmnitronAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"parameters":{"format":{"name":"format","in":"query","description":"Response format","schema":{"type":"string","enum":["json"],"default":"json"}},"page":{"name":"page","in":"query","description":"Page number","schema":{"type":"integer","default":1}},"limit":{"name":"limit","in":"query","description":"Number of items per page","schema":{"type":"integer","default":20}}},"schemas":{"Staff":{"type":"object","properties":{"id":{"type":"integer"},"retail_stores":{"type":"array","items":{"$ref":"#/components/schemas/RetailStore"}},"last_login":{"type":"string","format":"date-time"},"is_superuser":{"type":"boolean"},"is_staff":{"type":"boolean"},"date_joined":{"type":"string","format":"date-time"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"is_active":{"type":"boolean"},"remote_id":{"type":"string"},"username":{"type":"string","nullable":true},"permission_groups":{"type":"array","items":{"type":"integer"}},"current_store":{"type":"string","nullable":true}}},"RetailStore":{"type":"object","properties":{"id":{"type":"integer"},"address":{"$ref":"#/components/schemas/Address"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"omnitron_id":{"type":"integer"},"name":{"type":"string"},"email":{"type":"string"},"remote_id":{"type":"string"},"is_active":{"type":"boolean"},"fast_delivery":{"type":"boolean"}}},"Address":{"type":"object","properties":{"id":{"type":"integer"},"township":{"$ref":"#/components/schemas/Township"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"phone_number":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string","nullable":true},"retail_store":{"type":"integer"}}},"Township":{"type":"object","properties":{"id":{"type":"integer"},"city":{"$ref":"#/components/schemas/City"},"translations":{"type":"string","nullable":true},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"omnitron_id":{"type":"integer"},"name":{"type":"string"}}},"City":{"type":"object","properties":{"id":{"type":"integer"},"country":{"$ref":"#/components/schemas/Country"},"translations":{"type":"string","nullable":true},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"omnitron_id":{"type":"integer"},"name":{"type":"string"}}},"Country":{"type":"object","properties":{"id":{"type":"integer"},"translations":{"type":"string","nullable":true},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"omnitron_id":{"type":"integer"},"name":{"type":"string"},"code":{"type":"string"}}}},"responses":{"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"detail":{"type":"string"}}},"status_code":{"type":"integer"}}}}}}}},"paths":{"/staffs/":{"get":{"summary":"List staffs","description":"Returns a paginated list of staffs.","parameters":[{"$ref":"#/components/parameters/format"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"}],"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","nullable":true},"previous":{"type":"string","nullable":true},"results":{"type":"array","items":{"$ref":"#/components/schemas/Staff"}}}}}}},"403":{"$ref":"#/components/responses/Forbidden"}}}}}}
```

## Create a staff

> Creates a new staff record.

```json
{"openapi":"3.0.0","info":{"title":"Staff API","version":"1.0.0"},"servers":[{"url":"https://{domain}/api/v1","variables":{"domain":{"default":"sandbox.akinon.com"}}}],"security":[{"OmnitronAuth":[]}],"components":{"securitySchemes":{"OmnitronAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"StaffUpsert":{"type":"object","properties":{"retail_stores":{"type":"array","items":{"type":"integer"},"description":"List of retail store IDs"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email"},"remote_id":{"type":"string"},"password":{"type":"string"},"permission_groups":{"type":"array","items":{"type":"integer"}}}}},"responses":{"UpsertBadRequest":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"retail_stores":{"type":"array","items":{"type":"string"}},"permission_groups":{"type":"array","items":{"type":"string"}}}},"status_code":{"type":"integer"}}}}}},"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"detail":{"type":"string"}}},"status_code":{"type":"integer"}}}}}}}},"paths":{"/staffs/":{"post":{"summary":"Create a staff","description":"Creates a new staff record.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"retail_stores":{"type":"array","items":{"type":"integer"},"description":"List of retail store IDs"},"first_name":{"type":"string","maxLength":30},"last_name":{"type":"string","maxLength":150},"email":{"type":"string","format":"email"},"is_active":{"type":"boolean"},"remote_id":{"type":"string","nullable":true},"password":{"type":"string"},"permission_groups":{"type":"array","items":{"type":"integer"},"description":"List of permission group IDs"}},"required":["retail_stores","first_name","last_name","email","password","remote_id"]}}}},"responses":{"201":{"description":"Staff created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StaffUpsert"}}}},"400":{"$ref":"#/components/responses/UpsertBadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}}}}
```

## Retrieve a staff

> Returns detailed information of a staff by its ID.

```json
{"openapi":"3.0.0","info":{"title":"Staff API","version":"1.0.0"},"servers":[{"url":"https://{domain}/api/v1","variables":{"domain":{"default":"sandbox.akinon.com"}}}],"security":[{"OmnitronAuth":[]}],"components":{"securitySchemes":{"OmnitronAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"parameters":{"format":{"name":"format","in":"query","description":"Response format","schema":{"type":"string","enum":["json"],"default":"json"}}},"schemas":{"Staff":{"type":"object","properties":{"id":{"type":"integer"},"retail_stores":{"type":"array","items":{"$ref":"#/components/schemas/RetailStore"}},"last_login":{"type":"string","format":"date-time"},"is_superuser":{"type":"boolean"},"is_staff":{"type":"boolean"},"date_joined":{"type":"string","format":"date-time"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"is_active":{"type":"boolean"},"remote_id":{"type":"string"},"username":{"type":"string","nullable":true},"permission_groups":{"type":"array","items":{"type":"integer"}},"current_store":{"type":"string","nullable":true}}},"RetailStore":{"type":"object","properties":{"id":{"type":"integer"},"address":{"$ref":"#/components/schemas/Address"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"omnitron_id":{"type":"integer"},"name":{"type":"string"},"email":{"type":"string"},"remote_id":{"type":"string"},"is_active":{"type":"boolean"},"fast_delivery":{"type":"boolean"}}},"Address":{"type":"object","properties":{"id":{"type":"integer"},"township":{"$ref":"#/components/schemas/Township"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"phone_number":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string","nullable":true},"retail_store":{"type":"integer"}}},"Township":{"type":"object","properties":{"id":{"type":"integer"},"city":{"$ref":"#/components/schemas/City"},"translations":{"type":"string","nullable":true},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"omnitron_id":{"type":"integer"},"name":{"type":"string"}}},"City":{"type":"object","properties":{"id":{"type":"integer"},"country":{"$ref":"#/components/schemas/Country"},"translations":{"type":"string","nullable":true},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"omnitron_id":{"type":"integer"},"name":{"type":"string"}}},"Country":{"type":"object","properties":{"id":{"type":"integer"},"translations":{"type":"string","nullable":true},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"omnitron_id":{"type":"integer"},"name":{"type":"string"},"code":{"type":"string"}}}},"responses":{"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"detail":{"type":"string"}}},"status_code":{"type":"integer"}}}}}},"NotFoundStaff":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"detail":{"type":"string"}}},"status_code":{"type":"integer"}}}}}}}},"paths":{"/staffs/{id}/":{"get":{"summary":"Retrieve a staff","description":"Returns detailed information of a staff by its ID.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/format"}],"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/Staff"}}}}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFoundStaff"}}}}}}
```

## Update a staff

> Updates the details of a single staff identified by its ID.

```json
{"openapi":"3.0.0","info":{"title":"Staff API","version":"1.0.0"},"servers":[{"url":"https://{domain}/api/v1","variables":{"domain":{"default":"sandbox.akinon.com"}}}],"security":[{"OmnitronAuth":[]}],"components":{"securitySchemes":{"OmnitronAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"parameters":{"format":{"name":"format","in":"query","description":"Response format","schema":{"type":"string","enum":["json"],"default":"json"}}},"schemas":{"StaffUpsert":{"type":"object","properties":{"retail_stores":{"type":"array","items":{"type":"integer"},"description":"List of retail store IDs"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email"},"remote_id":{"type":"string"},"password":{"type":"string"},"permission_groups":{"type":"array","items":{"type":"integer"}}}}},"responses":{"UpsertBadRequest":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"retail_stores":{"type":"array","items":{"type":"string"}},"permission_groups":{"type":"array","items":{"type":"string"}}}},"status_code":{"type":"integer"}}}}}},"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"detail":{"type":"string"}}},"status_code":{"type":"integer"}}}}}},"NotFoundStaff":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"detail":{"type":"string"}}},"status_code":{"type":"integer"}}}}}}}},"paths":{"/staffs/{id}/":{"put":{"summary":"Update a staff","description":"Updates the details of a single staff identified by its ID.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/format"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"retail_stores":{"type":"array","items":{"type":"integer"}},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email"},"is_active":{"type":"boolean"},"is_staff":{"type":"boolean"},"remote_id":{"type":"string","nullable":true},"username":{"type":"string"}},"required":["retail_stores","email","first_name","last_name","username","is_active","is_staff","remote_id"]}}}},"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StaffUpsert"}}}},"400":{"$ref":"#/components/responses/UpsertBadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFoundStaff"}}}}}}
```

## Partially update a staff

> Partially updates the details of a single staff. Only the provided fields will be updated; other fields remain unchanged.

```json
{"openapi":"3.0.0","info":{"title":"Staff API","version":"1.0.0"},"servers":[{"url":"https://{domain}/api/v1","variables":{"domain":{"default":"sandbox.akinon.com"}}}],"security":[{"OmnitronAuth":[]}],"components":{"securitySchemes":{"OmnitronAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"parameters":{"format":{"name":"format","in":"query","description":"Response format","schema":{"type":"string","enum":["json"],"default":"json"}}},"schemas":{"StaffUpsert":{"type":"object","properties":{"retail_stores":{"type":"array","items":{"type":"integer"},"description":"List of retail store IDs"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email"},"remote_id":{"type":"string"},"password":{"type":"string"},"permission_groups":{"type":"array","items":{"type":"integer"}}}}},"responses":{"UpsertBadRequest":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"retail_stores":{"type":"array","items":{"type":"string"}},"permission_groups":{"type":"array","items":{"type":"string"}}}},"status_code":{"type":"integer"}}}}}},"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"detail":{"type":"string"}}},"status_code":{"type":"integer"}}}}}},"NotFoundStaff":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"detail":{"type":"string"}}},"status_code":{"type":"integer"}}}}}}}},"paths":{"/staffs/{id}/":{"patch":{"summary":"Partially update a staff","description":"Partially updates the details of a single staff. Only the provided fields will be updated; other fields remain unchanged.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/format"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"retail_stores":{"type":"array","items":{"type":"integer"}},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email"},"is_active":{"type":"boolean"},"is_staff":{"type":"boolean"},"remote_id":{"type":"string","nullable":true},"username":{"type":"string"}}}}}},"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StaffUpsert"}}}},"400":{"$ref":"#/components/responses/UpsertBadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFoundStaff"}}}}}}
```

## Lists the permissions a staff has

> Returns the permission details of given staff identified by its ID.

```json
{"openapi":"3.0.0","info":{"title":"Staff API","version":"1.0.0"},"servers":[{"url":"https://{domain}/api/v1","variables":{"domain":{"default":"sandbox.akinon.com"}}}],"security":[{"OmnitronAuth":[]}],"components":{"securitySchemes":{"OmnitronAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"parameters":{"format":{"name":"format","in":"query","description":"Response format","schema":{"type":"string","enum":["json"],"default":"json"}}},"schemas":{"Permission":{"type":"object","properties":{"id":{"type":"integer"},"is_visible_for_user":{"type":"boolean"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"name":{"type":"string"},"path":{"type":"string"},"label":{"type":"string","nullable":true},"method":{"type":"string","nullable":true},"parent":{"type":"string","nullable":true},"permission_groups":{"type":"array","items":{"type":"integer"}}}}},"responses":{"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"detail":{"type":"string"}}},"status_code":{"type":"integer"}}}}}},"NotFoundStaff":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"detail":{"type":"string"}}},"status_code":{"type":"integer"}}}}}}}},"paths":{"/staffs/{id}/list_staff_permission_info/":{"get":{"summary":"Lists the permissions a staff has","description":"Returns the permission details of given staff identified by its ID.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/format"}],"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Permission"}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFoundStaff"}}}}}}
```

## Changes the password of the staff.

> Changes the password of the staff.

```json
{"openapi":"3.0.0","info":{"title":"Staff API","version":"1.0.0"},"servers":[{"url":"https://{domain}/api/v1","variables":{"domain":{"default":"sandbox.akinon.com"}}}],"paths":{"/staffs/change_password/":{"post":{"summary":"Changes the password of the staff.","description":"Changes the password of the staff.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"staff":{"type":"integer","description":"The ID of the staff whose password will be changed."},"new_password":{"type":"string","description":"The new password to be set for the staff."}},"required":["staff","new_password"]}}}},"responses":{"200":{"description":"Successful operation"},"400":{"$ref":"#/components/responses/ChangePasswordBadRequest"},"403":{"$ref":"#/components/responses/Forbidden"}}}}},"components":{"responses":{"ChangePasswordBadRequest":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"staff":{"type":"array","items":{"type":"string"}}}},"status_code":{"type":"integer"}}}}}},"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"detail":{"type":"string"}}},"status_code":{"type":"integer"}}}}}}}}}
```

## Lists staff with duplicate emails

> Returns staff records that have the same email address.

```json
{"openapi":"3.0.0","info":{"title":"Staff API","version":"1.0.0"},"servers":[{"url":"https://{domain}/api/v1","variables":{"domain":{"default":"sandbox.akinon.com"}}}],"security":[{"OmnitronAuth":[]}],"components":{"securitySchemes":{"OmnitronAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"parameters":{"format":{"name":"format","in":"query","description":"Response format","schema":{"type":"string","enum":["json"],"default":"json"}}},"schemas":{"Staff":{"type":"object","properties":{"id":{"type":"integer"},"retail_stores":{"type":"array","items":{"$ref":"#/components/schemas/RetailStore"}},"last_login":{"type":"string","format":"date-time"},"is_superuser":{"type":"boolean"},"is_staff":{"type":"boolean"},"date_joined":{"type":"string","format":"date-time"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"is_active":{"type":"boolean"},"remote_id":{"type":"string"},"username":{"type":"string","nullable":true},"permission_groups":{"type":"array","items":{"type":"integer"}},"current_store":{"type":"string","nullable":true}}},"RetailStore":{"type":"object","properties":{"id":{"type":"integer"},"address":{"$ref":"#/components/schemas/Address"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"omnitron_id":{"type":"integer"},"name":{"type":"string"},"email":{"type":"string"},"remote_id":{"type":"string"},"is_active":{"type":"boolean"},"fast_delivery":{"type":"boolean"}}},"Address":{"type":"object","properties":{"id":{"type":"integer"},"township":{"$ref":"#/components/schemas/Township"},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"phone_number":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string","nullable":true},"retail_store":{"type":"integer"}}},"Township":{"type":"object","properties":{"id":{"type":"integer"},"city":{"$ref":"#/components/schemas/City"},"translations":{"type":"string","nullable":true},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"omnitron_id":{"type":"integer"},"name":{"type":"string"}}},"City":{"type":"object","properties":{"id":{"type":"integer"},"country":{"$ref":"#/components/schemas/Country"},"translations":{"type":"string","nullable":true},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"omnitron_id":{"type":"integer"},"name":{"type":"string"}}},"Country":{"type":"object","properties":{"id":{"type":"integer"},"translations":{"type":"string","nullable":true},"created_date":{"type":"string","format":"date-time"},"modified_date":{"type":"string","format":"date-time"},"omnitron_id":{"type":"integer"},"name":{"type":"string"},"code":{"type":"string"}}}},"responses":{"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"detail":{"type":"string"}}},"status_code":{"type":"integer"}}}}}}}},"paths":{"/staffs/duplicate_email_staffs/":{"get":{"summary":"Lists staff with duplicate emails","description":"Returns staff records that have the same email address.","parameters":[{"$ref":"#/components/parameters/format"}],"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Staff"}}}}},"403":{"$ref":"#/components/responses/Forbidden"}}}}}}
```
