Skip to content

Assignment API

The Assignment API allows Administrators to link users (Employees or Developers) to specific projects.


Create Assignment

Creates a new assignment, linking a user (Employee or Dev) to a project. - Admin role required. - Maximum 1 Dev user per project (must be from the same organization as the project owner). - Maximum 1 Employee user per project (can be from any organization).

POST https://api.darukaa.com/api/v1/assignments/

HTTP request

POST https://api.darukaa.com/api/v1/assignments/

Headers

Header Value Required
Authorization Bearer Yes

Request body

{
  "user_id": "123e4567-e89b-12d3-a456-426614174000",
  "project_id": "987fcdeb-51a2-43d7-9012-345678901234"
}
Field Type Required Description
user_id UUID string Yes ID of the user to assign
project_id UUID string Yes ID of the project

Example request

curl -X POST https://api.darukaa.com/api/v1/assignments/ \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "123e4567-e89b-12d3-a456-426614174000",
    "project_id": "987fcdeb-51a2-43d7-9012-345678901234"
  }'

Status codes

Code Description
201 Created - Assignment created successfully
400 Bad Request - User lacks correct role, or organization details missing
403 Forbidden - Dev user not from the same organization
404 Not Found - User or Project not found
409 Conflict - Assignment already exists, or project limits reached
500 Internal Server Error

Response body

Success (201)

{
  "assignment_id": "11111111-2222-3333-4444-555555555555",
  "created_at": "2023-10-12T07:20:50.52Z",
  "updated_at": "2023-10-12T07:20:50.52Z",
  "user_id": "123e4567-e89b-12d3-a456-426614174000",
  "project_id": "987fcdeb-51a2-43d7-9012-345678901234",
  "user": {
    "user_id": "123e4567-e89b-12d3-a456-426614174000",
    "email": "user@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "role": ["Employee"],
    "status": "active",
    "is_email_verified": true,
    "created_at": "2023-10-12T07:20:50.52Z",
    "updated_at": "2023-10-12T07:20:50.52Z"
  },
  "project": {
    "project_id": "987fcdeb-51a2-43d7-9012-345678901234",
    "project_name": "Sample Project",
    "project_start_date": "2023-01-01",
    "project_end_date": "2033-01-01",
    "country": "India",
    "project_description": "A test project",
    "project_type": "ARR/WRC",
    "total_area": 160.55,
    "area_unit": "ha",
    "project_developer": "Developer Name",
    "crediting_period": "10 years",
    "registry": "Verra",
    "sdg": ["sdg13.png"],
    "owner_user_id": "owner-uuid-here",
    "project_status": "active",
    "has_carbon_module": true,
    "has_biodiversity_module": false,
    "has_environmental_module": false,
    "created_at": "2023-10-12T07:20:50.52Z",
    "updated_at": "2023-10-12T07:20:50.52Z",
    "site_count": 0
  }
}
Field Type Description
assignment_id UUID string Unique identifier for the assignment
created_at datetime Timestamp when the assignment was created
updated_at datetime Timestamp when the assignment was last updated
user_id UUID string ID of the assigned user
project_id UUID string ID of the assigned project
user object Nested user object containing user details
project object Nested project object containing project details

Create Bulk Assignments

Creates multiple assignments linking a DEV user to multiple projects. - Admin role required.

POST https://api.darukaa.com/api/v1/assignments/bulk

HTTP request

POST https://api.darukaa.com/api/v1/assignments/bulk?user_id={user_id}

Headers

Header Value Required
Authorization Bearer Yes

Query parameters

Field Type Required Description
user_id UUID string Yes ID of the Dev user

Request body

[
  "987fcdeb-51a2-43d7-9012-345678901234",
  "abcdef12-3456-7890-abcd-ef1234567890"
]
(List of UUID strings for project_ids)

Example request

curl -X POST "https://api.darukaa.com/api/v1/assignments/bulk?user_id=123e4567-e89b-12d3-a456-426614174000" \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '[
    "987fcdeb-51a2-43d7-9012-345678901234"
  ]'

Status codes

Code Description
200 Success - Returns list of created assignments (empty if none created)
400 Bad Request - Invalid user configuration
403 Forbidden - Organization mismatch
404 Not Found - User or Project not found

Get Projects by Organization Email

Retrieves all projects for an organization based on the email domain provided. - Admin role required.

GET https://api.darukaa.com/api/v1/assignments/projects-by-org-email/{org_email}

HTTP request

GET https://api.darukaa.com/api/v1/assignments/projects-by-org-email/{org_email}

Headers

Header Value Required
Authorization Bearer Yes

Path parameters

Field Type Required Description
org_email string Yes Any email from the organization (e.g., "user@example.com") to find all users with the same domain.

Query parameters

Field Type Required Description
skip integer No Default: 0
limit integer No Default: 100

Example request

curl -X GET "https://api.darukaa.com/api/v1/assignments/projects-by-org-email/user@example.com?skip=0&limit=10" \
  -H "Authorization: Bearer <your_access_token>"

Status codes

Code Description
200 Success - List of projects retrieved

Get Assignments by Project

Retrieves all assignments for a specific project. - Admin role required.

GET https://api.darukaa.com/api/v1/assignments/project/{project_id}

HTTP request

GET https://api.darukaa.com/api/v1/assignments/project/{project_id}

Headers

Header Value Required
Authorization Bearer Yes

Path parameters

Field Type Required Description
project_id UUID string Yes The ID of the project

Example request

curl -X GET https://api.darukaa.com/api/v1/assignments/project/987fcdeb-51a2-43d7-9012-345678901234 \
  -H "Authorization: Bearer <your_access_token>"

Status codes

Code Description
200 Success - List of assignments retrieved

List All Assignments

Retrieves all assignments in the system. - Admin role required.

GET https://api.darukaa.com/api/v1/assignments/

HTTP request

GET https://api.darukaa.com/api/v1/assignments/

Headers

Header Value Required
Authorization Bearer Yes

Query parameters

Field Type Required Description
skip integer No Default: 0
limit integer No Default: 100

Example request

curl -X GET "https://api.darukaa.com/api/v1/assignments/?skip=0&limit=100" \
  -H "Authorization: Bearer <your_access_token>"

Status codes

Code Description
200 Success - List of all assignments retrieved

Response body

Success (200)

[
  {
    "assignment_id": "11111111-2222-3333-4444-555555555555",
    "created_at": "2023-10-12T07:20:50.52Z",
    "updated_at": "2023-10-12T07:20:50.52Z",
    "user_id": "123e4567-e89b-12d3-a456-426614174000",
    "project_id": "987fcdeb-51a2-43d7-9012-345678901234",
    "user": {
      "user_id": "123e4567-e89b-12d3-a456-426614174000",
      "email": "user@example.com",
      "first_name": "John",
      "last_name": "Doe",
      "role": ["Employee"],
      "status": "active",
      "is_email_verified": true,
      "created_at": "2023-10-12T07:20:50.52Z",
      "updated_at": "2023-10-12T07:20:50.52Z"
    },
    "project": {
      "project_id": "987fcdeb-51a2-43d7-9012-345678901234",
      "project_name": "Sample Project",
      "project_start_date": "2023-01-01",
      "project_end_date": "2033-01-01",
      "country": "India",
      "project_description": "A test project",
      "project_type": "ARR/WRC",
      "total_area": 160.55,
      "area_unit": "ha",
      "project_developer": "Developer Name",
      "crediting_period": "10 years",
      "registry": "Verra",
      "sdg": ["sdg13.png"],
      "owner_user_id": "owner-uuid-here",
      "project_status": "active",
      "has_carbon_module": true,
      "has_biodiversity_module": false,
      "has_environmental_module": false,
      "created_at": "2023-10-12T07:20:50.52Z",
      "updated_at": "2023-10-12T07:20:50.52Z",
      "site_count": 0
    }
  }
]

Get Assignments by User

Retrieves all assignments for a specific user. - Admin role required.

GET https://api.darukaa.com/api/v1/assignments/user/{user_id}

HTTP request

GET https://api.darukaa.com/api/v1/assignments/user/{user_id}

Headers

Header Value Required
Authorization Bearer Yes

Path parameters

Field Type Required Description
user_id UUID string Yes The ID of the user

Example request

curl -X GET https://api.darukaa.com/api/v1/assignments/user/123e4567-e89b-12d3-a456-426614174000 \
  -H "Authorization: Bearer <your_access_token>"

Status codes

Code Description
200 Success - List of assignments retrieved

Get Assignment by ID

Retrieves a single assignment by its unique ID. - Admin role required.

GET https://api.darukaa.com/api/v1/assignments/{assignment_id}

HTTP request

GET https://api.darukaa.com/api/v1/assignments/{assignment_id}

Headers

Header Value Required
Authorization Bearer Yes

Path parameters

Field Type Required Description
assignment_id UUID string Yes The ID of the assignment

Example request

curl -X GET https://api.darukaa.com/api/v1/assignments/11111111-2222-3333-4444-555555555555 \
  -H "Authorization: Bearer <your_access_token>"

Status codes

Code Description
200 Success - Assignment retrieved
404 Not Found - Assignment not found

Response body

Success (200)

{
  "assignment_id": "11111111-2222-3333-4444-555555555555",
  "created_at": "2023-10-12T07:20:50.52Z",
  "updated_at": "2023-10-12T07:20:50.52Z",
  "user_id": "123e4567-e89b-12d3-a456-426614174000",
  "project_id": "987fcdeb-51a2-43d7-9012-345678901234",
  "user": {
    "user_id": "123e4567-e89b-12d3-a456-426614174000",
    "email": "user@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "role": ["Employee"],
    "status": "active",
    "is_email_verified": true,
    "created_at": "2023-10-12T07:20:50.52Z",
    "updated_at": "2023-10-12T07:20:50.52Z"
  },
  "project": {
    "project_id": "987fcdeb-51a2-43d7-9012-345678901234",
    "project_name": "Sample Project",
    "project_start_date": "2023-01-01",
    "project_end_date": "2033-01-01",
    "country": "India",
    "project_description": "A test project",
    "project_type": "ARR/WRC",
    "total_area": 160.55,
    "area_unit": "ha",
    "project_developer": "Developer Name",
    "crediting_period": "10 years",
    "registry": "Verra",
    "sdg": ["sdg13.png"],
    "owner_user_id": "owner-uuid-here",
    "project_status": "active",
    "has_carbon_module": true,
    "has_biodiversity_module": false,
    "has_environmental_module": false,
    "created_at": "2023-10-12T07:20:50.52Z",
    "updated_at": "2023-10-12T07:20:50.52Z",
    "site_count": 0
  }
}

Delete Assignment

Deletes an assignment by its unique ID. - Admin role required.

DELETE https://api.darukaa.com/api/v1/assignments/{assignment_id}

HTTP request

DELETE https://api.darukaa.com/api/v1/assignments/{assignment_id}

Headers

Header Value Required
Authorization Bearer Yes

Path parameters

Field Type Required Description
assignment_id UUID string Yes The ID of the assignment

Example request

curl -X DELETE https://api.darukaa.com/api/v1/assignments/11111111-2222-3333-4444-555555555555 \
  -H "Authorization: Bearer <your_access_token>"

Status codes

Code Description
204 No Content - Assignment deleted successfully
404 Not Found - Assignment not found