API Organization Endpoints

Endpoints Overview

MethodPathAuthDescription
GET/api/organizationsList your organizations
POST/api/organizationsCreate a new organization
GET/api/organizations/:idOrSlugGet organization details
PATCH/api/organizations/:idOrSlugUpdate organization
DELETE/api/organizations/:idOrSlugDelete organization
GET/api/organizations/:idOrSlug/membersList members
POST/api/organizations/:idOrSlug/membersAdd a member
PATCH/api/organizations/:idOrSlug/members/:userIdUpdate member role
DELETE/api/organizations/:idOrSlug/members/:userIdRemove member
GET/api/organizations/:idOrSlug/activityGet organization activity

All organization endpoints require authentication. The :idOrSlug parameter accepts either a numeric ID or the organization’s URL slug.

List Organizations

GET /api/organizations

Returns all organizations the authenticated user belongs to, regardless of role.

Response

[
  {
    "id": 1,
    "name": "Acme Corp",
    "slug": "acme-corp",
    "role": "owner",
    "memberCount": 5,
    "createdAt": "2026-01-15T10:00:00Z"
  },
  {
    "id": 2,
    "name": "Legal Team",
    "slug": "legal-team",
    "role": "member",
    "memberCount": 3,
    "createdAt": "2026-02-01T08:00:00Z"
  }
]

Create Organization

POST /api/organizations
Content-Type: application/json

Request Body

{
  "name": "Acme Corp",
  "slug": "acme-corp"
}

Parameters

FieldTypeRequiredDescription
namestringYesOrganization display name
slugstringNoURL-friendly identifier (auto-generated from name if omitted)

The creating user is automatically assigned the owner role.

Get Organization Details

GET /api/organizations/:idOrSlug

Returns full details including name, slug, member count, and credit balances.

{
  "id": 1,
  "name": "Acme Corp",
  "slug": "acme-corp",
  "memberCount": 5,
  "balances": { "IT": 100, "ST": 500, "LG": 5 },
  "createdAt": "2026-01-15T10:00:00Z"
}

Update Organization

PATCH /api/organizations/:idOrSlug
Content-Type: application/json
{
  "name": "Acme Corporation"
}

Requires admin or owner role.

Delete Organization

DELETE /api/organizations/:idOrSlug

Requires owner role. This is irreversible — all organization data, activity history, and member associations are permanently removed.

Member Management

List Members

GET /api/organizations/:idOrSlug/members
[
  {
    "id": 1,
    "walletAddress": "0xabc...",
    "displayName": "Alice",
    "role": "owner",
    "joinedAt": "2026-01-15T10:00:00Z"
  },
  {
    "id": 2,
    "walletAddress": "0xdef...",
    "displayName": "Bob",
    "role": "member",
    "joinedAt": "2026-01-20T14:00:00Z"
  }
]

Add Member

POST /api/organizations/:idOrSlug/members
Content-Type: application/json
{
  "walletAddress": "0xdef...",
  "role": "member"
}

Parameters

FieldTypeRequiredDescription
walletAddressstringYesEthereum wallet address of the user to add
rolestringYesadmin, member, or viewer

The wallet must belong to a registered TimeProof user. Requires admin or owner role in the organization.

Response

{
  "member": {
    "id": 123,
    "walletAddress": "0xdef...",
    "displayName": null,
    "role": "member"
  }
}

Update Member Role

PATCH /api/organizations/:idOrSlug/members/:userId
Content-Type: application/json
{
  "role": "admin"
}

Response

{
  "message": "Role updated successfully",
  "role": "admin"
}

Remove Member

DELETE /api/organizations/:idOrSlug/members/:userId

Requires admin or owner role. The owner cannot be removed.

Role Permissions

PermissionOwnerAdminMemberViewer
View organization
Create timestamps
View timestamps
Add members
Remove members
Update roles
Update organization
Delete organization
Purchase credits

Organization Activity

GET /api/organizations/:idOrSlug/activity

Returns the organization’s timestamp history — all jobs created by any member using the organization’s credits.

Integration Example

// Create an organization
const org = await fetch('/api/organizations', {
  method: 'POST',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Acme Corp' })
}).then(r => r.json());

// Add a team member
await fetch(`/api/organizations/${org.slug}/members`, {
  method: 'POST',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    walletAddress: '0xdef...',
    role: 'member'
  })
});

// Create a timestamp under the organization
await fetch('/api/timestamps', {
  method: 'POST',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    files: [{ name: 'report.pdf', hash: 'sha256...', size: 54321 }],
    creditType: 'ST',
    orgId: org.id
  })
});

Use the live product for timestamping and verification.

The company site owns the technical reference. The app handles runtime workflows.