Organizations are the top-level container for coaches and athletes in Astral. Each organization has a head coach, optional co-coaches, and a roster of athlete members. All organization endpoints (except GET /{org_id}) require either a valid app key or an authenticated user token.
Create an organization
Display name of the organization.
Short description of the organization.
User ID of the head coach who will own and administrate the organization.
Arbitrary settings object stored on the organization (e.g. training_principle, logo_url).
POST /api/v1/organizations
Authentication: App key (X-API-Key header)
curl -X POST https://api.astral.run/api/v1/organizations \
-H "X-API-Key: <your_app_key>" \
-H "Content-Type: application/json" \
-d '{
"name": "Summit Running Club",
"description": "Elite distance running program",
"head_coach_user_id": "usr_abc123"
}'
Response 201 Created
{
"message": "Organization created successfully",
"organization": {
"org_id": "org_xyz789",
"org_name": "Summit Running Club",
"description": "Elite distance running program",
"head_coach_user_id": "usr_abc123",
"coaches": [],
"created_at": "2025-04-23T10:00:00Z"
}
}
Get an organization
Returns full organization details including head coach, coaches list, and settings.
GET /api/v1/organizations/{org_id}
Path parameters
The unique organization identifier.
curl https://api.astral.run/api/v1/organizations/org_xyz789 \
-H "Authorization: Bearer <token>"
Response 200 OK
{
"org_id": "org_xyz789",
"org_name": "Summit Running Club",
"description": "Elite distance running program",
"head_coach_user_id": "usr_abc123",
"coaches": [
{
"user_id": "usr_coach2",
"name": "Jane Smith",
"role": "assistant_coach"
}
],
"settings": {
"training_principle": "High-volume aerobic base with periodic intensity blocks.",
"logo_url": "https://cdn.astral.run/logos/summit.png"
},
"created_at": "2025-04-23T10:00:00Z"
}
Update an organization
Updates organization metadata and settings. Requires the authenticated user to be the head coach or a platform admin.
PUT /api/v1/organizations/{org_id}
Authentication: Bearer token (require_user_auth)
The unique organization identifier.
Partial settings to merge. Supports any key, including training_principle and logo_url.
curl -X PUT https://api.astral.run/api/v1/organizations/org_xyz789 \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"settings": {
"training_principle": "Polarized training with 80/20 easy-hard split."
}
}'
Response 200 OK
{
"message": "Organization updated successfully",
"organization": {
"org_id": "org_xyz789",
"org_name": "Summit Running Club",
"settings": {
"training_principle": "Polarized training with 80/20 easy-hard split."
}
}
}
Add a member
Adds an athlete to the organization’s roster. Requires the member_management feature on the organization’s plan.
POST /api/v1/organizations/{org_id}/members
Authentication: Bearer token (require_user_auth)
The unique organization identifier.
The Astral user ID of the athlete to add.
Coach-assigned nickname. Overrides the athlete’s own display name in coach views.
Training level label (e.g. "beginner", "intermediate", "advanced").
Array of string labels for filtering and categorization.
curl -X POST https://api.astral.run/api/v1/organizations/org_xyz789/members \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"user_id": "usr_athlete1",
"display_name": "Alex",
"member_level": "intermediate",
"labels": ["5k-focus", "morning-group"]
}'
Response 201 Created
{
"message": "Member added successfully",
"member": {
"user_id": "usr_athlete1",
"display_name": "Alex",
"member_level": "intermediate",
"labels": ["5k-focus", "morning-group"],
"status": "active",
"joined_at": "2025-04-23T11:00:00Z"
}
}
Remove a member
Removes an athlete from the organization roster. Requires the member_management feature.
DELETE /api/v1/organizations/{org_id}/members/{user_id}
Authentication: Bearer token
The unique organization identifier.
The user ID of the athlete to remove.
curl -X DELETE \
https://api.astral.run/api/v1/organizations/org_xyz789/members/usr_athlete1 \
-H "Authorization: Bearer <token>"
Response 200 OK
{ "message": "Member removed successfully" }
List members
Returns all members in an organization. Accessible to coaches and admins only. Supports filtering and optional profile status enrichment.
GET /api/v1/organizations/{org_id}/members
Authentication: Bearer token (coach or admin role required)
Filter by member status: active, inactive, or suspended.
Filter by training level.
Filter members by a specific label.
When true, each member object is enriched with profile_status flags: has_strava, has_garmin, has_pace_zones, has_hr_zones, has_next_race, has_training_plan, has_mbti.
Filter to only members assigned to this coach.
curl "https://api.astral.run/api/v1/organizations/org_xyz789/members?status=active&include_profile_status=true" \
-H "Authorization: Bearer <token>"
Response 200 OK
{
"members": [
{
"user_id": "usr_athlete1",
"display_name": "Alex",
"member_level": "intermediate",
"labels": ["5k-focus"],
"status": "active",
"profile_status": {
"has_strava": true,
"has_garmin": false,
"has_pace_zones": true,
"has_hr_zones": false,
"has_next_race": true,
"has_training_plan": true,
"has_mbti": false,
"profile_image_url": "https://cdn.astral.run/images/alex.jpg",
"gender": "male"
}
}
],
"count": 1
}
Get audit logs
Returns the audit event log for the organization, including member joins/removals and group changes.
GET /api/v1/organizations/{org_id}/audit-logs
Authentication: Bearer token (coach or admin)
The unique organization identifier.
curl https://api.astral.run/api/v1/organizations/org_xyz789/audit-logs \
-H "Authorization: Bearer <token>"
Response 200 OK
{
"logs": [
{
"event_type": "member_added",
"actor_id": "usr_abc123",
"target_id": "usr_athlete1",
"target_name": "Alex",
"org_id": "org_xyz789",
"created_at": "2025-04-23T11:00:00Z"
}
],
"count": 1
}
Response fields
Unique identifier for the organization.
Display name of the organization.
Organization description.
User ID of the head coach.
Array of coach objects. Each has user_id, name, and role.
Key-value settings including training_principle and logo_url.
ISO 8601 creation timestamp.
Error codes
| Status | Meaning |
|---|
400 | Validation error — missing or invalid fields |
401 | Invalid or missing authentication credentials |
403 | Insufficient permissions (not a coach or admin) |
404 | Organization or member not found |
409 | Conflict — organization name already exists |
500 | Internal server error |