Organization
Organization management, statistics, and user membership
List user's organizations
GET /api/v1/organizations
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Portée du jeton API : organization.view
Paramètres
| Nom | Emplacement | Type | Requis | Description |
|---|---|---|---|---|
search |
query | string | non | |
page |
query | integer | non | |
per_page |
query | integer | non |
Réponses
| Statut | Description |
|---|---|
| 200 | For non-paginated data, return as before |
| 422 |
Exemple de requête
curl -X GET "https://kworia.com/api/v1/organizations" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json"
Get organization details
GET /api/v1/organizations/{id}
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Portée du jeton API : organization.view
Paramètres
| Nom | Emplacement | Type | Requis | Description |
|---|---|---|---|---|
id |
path | integer | oui |
Réponses
| Statut | Description |
|---|---|
| 200 | For non-paginated data, return as before |
Exemple de requête
curl -X GET "https://kworia.com/api/v1/organizations/{id}" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json"
Update organization
PUT /api/v1/organizations/{id}
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Portée du jeton API : organization.update
country is immutable once the organization exists and is not accepted here. currency is locked once any financial document (invoice/quote/expense/credit note) exists — attempting to change it then returns 422. subdivision_code is editable going-forward.
Paramètres
| Nom | Emplacement | Type | Requis | Description |
|---|---|---|---|---|
id |
path | integer | oui |
Corps de la requête
| Champ | Type | Requis | Description |
|---|---|---|---|
name |
string | non | |
currency |
string | non | Base currency (ISO 4217). Locked once financial documents exist; a locked change returns 422. |
timezone |
string | non | |
language |
string | non | |
subdivision_code |
string | non | ISO 3166-2 subdivision code (e.g. CA-QC). Validated against the country_subdivisions reference table. Editable going-forward. |
settings |
array | non | |
address_line1 |
string | non | Company-profile / legal-header fields |
address_line2 |
string | non | |
city |
string | non | |
postal_code |
string | non | |
state |
string | non | |
contact_name |
string | non | |
contact_email |
string | non | |
contact_phone |
string | non | |
logo |
string | non | |
tax_number |
string | non | |
registration_number |
string | non | |
legal_form |
string | non | |
website |
string | non |
Réponses
| Statut | Description |
|---|---|
| 200 | For non-paginated data, return as before |
| 403 | |
| 422 | Validation failed, OR an immutable/locked field was changed — changing currency once financial documents exist (or country, which is never accepted) returns the reason under errors.currency / errors.country with error: field_immutable. |
Exemple de requête
curl -X PUT "https://kworia.com/api/v1/organizations/{id}" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "string",
"currency": "string",
"timezone": "string",
"language": "string",
"subdivision_code": "string",
"settings": [],
"address_line1": "string",
"address_line2": "string",
"city": "string",
"postal_code": "string",
"state": "string",
"contact_name": "string",
"contact_email": "string",
"contact_phone": "string",
"logo": "string",
"tax_number": "string",
"registration_number": "string",
"legal_form": "string",
"website": "string"
}'
Get organization statistics (Core only)
GET /api/v1/organizations/{id}/statistics
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Portée du jeton API : organization.view
NOTE: Invoicing statistics moved to ReportingController (Invoicing plugin) to maintain plugin architecture. Core should not depend on plugins.
Paramètres
| Nom | Emplacement | Type | Requis | Description |
|---|---|---|---|---|
id |
path | integer | oui |
Réponses
| Statut | Description |
|---|---|
| 200 | For non-paginated data, return as before |
Exemple de requête
curl -X GET "https://kworia.com/api/v1/organizations/{id}/statistics" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json"
List organization users
GET /api/v1/organizations/{id}/users
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Portée du jeton API : users.view
Paramètres
| Nom | Emplacement | Type | Requis | Description |
|---|---|---|---|---|
id |
path | integer | oui | |
page |
query | integer | non | |
per_page |
query | integer | non |
Réponses
| Statut | Description |
|---|---|
| 200 | For non-paginated data, return as before |
| 422 |
Exemple de requête
curl -X GET "https://kworia.com/api/v1/organizations/{id}/users" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json"
Invite user to organization
POST /api/v1/organizations/{id}/users/invite
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Portée du jeton API : users.invite
Paramètres
| Nom | Emplacement | Type | Requis | Description |
|---|---|---|---|---|
id |
path | integer | oui |
Corps de la requête
| Champ | Type | Requis | Description |
|---|---|---|---|
email |
string | oui | |
role |
string | oui |
Réponses
| Statut | Description |
|---|---|
| 404 | |
| 201 | For non-paginated data, return as before |
| 400 | |
| 403 | |
| 422 |
Exemple de requête
curl -X POST "https://kworia.com/api/v1/organizations/{id}/users/invite" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"email": "string",
"role": "string"
}'
Update user role
PUT /api/v1/organizations/{id}/users/{userId}
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Portée du jeton API : users.update
Paramètres
| Nom | Emplacement | Type | Requis | Description |
|---|---|---|---|---|
id |
path | integer | oui | |
userId |
path | integer | oui |
Corps de la requête
| Champ | Type | Requis | Description |
|---|---|---|---|
role |
string | oui |
Réponses
| Statut | Description |
|---|---|
| 200 | For non-paginated data, return as before |
| 400 | |
| 403 | |
| 422 |
Exemple de requête
curl -X PUT "https://kworia.com/api/v1/organizations/{id}/users/{userId}" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"role": "string"
}'
Remove user from organization
DELETE /api/v1/organizations/{id}/users/{userId}
Nécessite une authentification (jeton Bearer) et l’en-tête X-Organization-Id.
Portée du jeton API : users.delete
Paramètres
| Nom | Emplacement | Type | Requis | Description |
|---|---|---|---|---|
id |
path | integer | oui | |
userId |
path | integer | oui |
Réponses
| Statut | Description |
|---|---|
| 200 | For non-paginated data, return as before |
| 400 | |
| 403 |
Exemple de requête
curl -X DELETE "https://kworia.com/api/v1/organizations/{id}/users/{userId}" \
-H "Authorization: Bearer {{access_token}}" \
-H "X-Organization-Id: {{organization_id}}" \
-H "Accept: application/json"