curl -X POST "https://api.example.com/api/company-requests" \ -H "Authorization: Bearer <access_token>" \ -H "Content-Type: application/json" \ -d '{ "companyName": "Tech Innovations Inc.", "companySlug": "tech-innovations", "description": "A company focused on innovative technology solutions", "reason": "I would like to create this company to manage our growing team" }'
{ "success": true, "data": { "id": "770e8400-e29b-41d4-a716-446655440000", "userId": "550e8400-e29b-41d4-a716-446655440000", "companyName": "Tech Innovations Inc.", "companySlug": "tech-innovations", "description": "A company focused on innovative technology solutions", "reason": "I would like to create this company to manage our growing team", "status": "PENDING", "reviewedBy": null, "reviewedAt": null, "reviewNotes": null, "createdCompanyId": null, "createdAt": "2024-03-04T10:00:00Z", "updatedAt": "2024-03-04T10:00:00Z" }, "message": "Company request submitted successfully. An admin will review it soon."}
Company requests allow users to submit requests to create a new company. These requests must be reviewed and approved by platform administrators before the company can be created.
This workflow is an alternative to direct company creation (which requires the COMPANY:CREATE global permission). Users can submit requests without special permissions, and admins can review and approve them.
curl -X POST "https://api.example.com/api/company-requests" \ -H "Authorization: Bearer <access_token>" \ -H "Content-Type: application/json" \ -d '{ "companyName": "Tech Innovations Inc.", "companySlug": "tech-innovations", "description": "A company focused on innovative technology solutions", "reason": "I would like to create this company to manage our growing team" }'
{ "success": true, "data": { "id": "770e8400-e29b-41d4-a716-446655440000", "userId": "550e8400-e29b-41d4-a716-446655440000", "companyName": "Tech Innovations Inc.", "companySlug": "tech-innovations", "description": "A company focused on innovative technology solutions", "reason": "I would like to create this company to manage our growing team", "status": "PENDING", "reviewedBy": null, "reviewedAt": null, "reviewNotes": null, "createdCompanyId": null, "createdAt": "2024-03-04T10:00:00Z", "updatedAt": "2024-03-04T10:00:00Z" }, "message": "Company request submitted successfully. An admin will review it soon."}
{ "success": true, "data": { "id": "770e8400-e29b-41d4-a716-446655440000", "userId": "550e8400-e29b-41d4-a716-446655440000", "companyName": "Tech Innovations Inc.", "companySlug": "tech-innovations", "description": "A company focused on innovative technology solutions", "reason": "I would like to create this company to manage our growing team", "status": "APPROVED", "reviewedBy": "880e8400-e29b-41d4-a716-446655440000", "reviewedAt": "2024-03-04T11:00:00Z", "reviewNotes": "Request looks good, approved for company creation", "createdCompanyId": null, "createdAt": "2024-03-04T10:00:00Z", "updatedAt": "2024-03-04T11:00:00Z" }, "message": "Company request approved. User can now create their company."}
When a request is approved, the user receives the COMPANY:CREATE permission and can proceed to create their company. Once the company is created, the request status is updated to COMPLETED and the createdCompanyId is set.