Hydra is now in beta|Get started free|Follow our journey on X.com

Team API
On this page

Team

Team members are users with access to your project’s admin panel. Each member has a role that determines their permissions. The project creator is automatically assigned the Owner role.

Base URL: https://api.hydrajs.dev

Admin authentication required

All team endpoints require admin (JWT) authentication. They cannot be called with API keys.

Endpoints

Method Path Auth Description
GET /v1/store/team Admin List team members
POST /v1/store/team Admin Invite a team member
PATCH /v1/store/team/{id} Admin Change a member’s role
DELETE /v1/store/team/{id} Admin Remove a team member

List team members

GET /v1/store/team

Returns all team members for the current project, including their email, role, and join date.

Request

curl https://api.hydrajs.dev/v1/store/team \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Response 200

{
	"data": [
		{
			"id": "mem_abc123def456ghij",
			"user_id": "550e8400-e29b-41d4-a716-446655440000",
			"email": "owner@example.com",
			"role": "owner",
			"role_label": "Owner",
			"is_pending": false,
			"created_at": "2026-01-10T08:00:00.000Z"
		},
		{
			"id": "mem_klm789nop012qrst",
			"user_id": "660f9500-f30c-52e5-b827-557766550111",
			"email": "dev@example.com",
			"role": "developer",
			"role_label": "Developer",
			"is_pending": false,
			"created_at": "2026-03-15T14:30:00.000Z"
		}
	]
}

Invite a team member

POST /v1/store/team

Adds a user to the project by email. The user must already have an account. Requires the team permission.

Request body

Field Type Required Description
email string Yes Email address of the user to invite
role string Yes Role slug to assign (owner, developer, or a custom role slug)

Request

curl -X POST https://api.hydrajs.dev/v1/store/team \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"email": "newdev@example.com", "role": "developer"}'

Response 201

{
	"data": {
		"id": "mem_uvw345xyz678abcd",
		"user_id": "770a0600-a41d-63f6-c938-668877660222",
		"email": "newdev@example.com",
		"role": "developer",
		"role_label": "Developer",
		"is_pending": false,
		"created_at": "2026-08-20T10:00:00.000Z"
	}
}

Error 400 - user not found

{
	"error": {
		"code": "invalid_request",
		"message": "No account found for this email. The user must create an account first.",
		"field": "email"
	}
}

Error 409 - already a member

{
	"error": {
		"code": "conflict",
		"message": "This user is already a member of this project."
	}
}

Change a member’s role

PATCH /v1/store/team/{id}

Updates a team member’s role. Cannot demote the sole owner — another user must be promoted to owner first. Requires the team permission.

Request body

Field Type Required Description
role string Yes New role slug (owner, developer, or a custom role slug)

Request

curl -X PATCH https://api.hydrajs.dev/v1/store/team/mem_klm789nop012qrst \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"role": "owner"}'

Response 200

{
	"data": {
		"status": "updated"
	}
}

Error 400 - sole owner

{
	"error": {
		"code": "invalid_request",
		"message": "Cannot change the role of the only owner. Transfer ownership first."
	}
}

Remove a team member

DELETE /v1/store/team/{id}

Removes a team member from the project. Cannot remove the sole owner. Requires the team permission.

Request

curl -X DELETE https://api.hydrajs.dev/v1/store/team/mem_klm789nop012qrst \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Response 204

Empty body.

Error 400 - sole owner

{
	"error": {
		"code": "invalid_request",
		"message": "Cannot remove the only owner."
	}
}

The team member object

Field Type Description
id string Unique membership ID (prefix: mem_)
user_id string The user’s account ID
email string The user’s email address
role string Role slug (owner, developer, or custom role slug)
role_label string Human-readable role name
is_pending boolean Whether the invite is pending acceptance
created_at string ISO 8601 timestamp