A Clerk API mock for creating dashboard users.

Start with the seeded dashboard users and organizations. Your agent creates a user; check the POST request and retrieve the user’s email addresses and metadata afterwards.

Connect your agent
The test
  • user_created

    Calls POST /v1/users

  • signed_in

    sessions email erin.walsh@ridgeway-robotics.example; status active; count at least 1

  • admin_member

    memberships organization ridgeway-robotics; email erin.walsh@ridgeway-robotics.example; role org:admin; count 1

Starting records

  • users

    email
    erin.walsh@ridgeway-robotics.example
  • users

    email
    hector.ruiz@ridgeway-robotics.example
  • users

    email
    bao.tran@ridgeway-robotics.example
  • users

    email
    helen.brooks@pinecrest-health.example

Connect your agent to the Clerk mock

When ancha runs your agent, it sets:

  • CLERK_API_URL
  • CLERK_SECRET_KEY
  • CLERK_PUBLISHABLE_KEY
  • NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
  • CLERK_JWT_KEY
  • CLERK_WEBHOOK_SIGNING_SECRET
  • CLERK_FRONTEND_API_URL
  • CLERK_PROXY_URL
  • NEXT_PUBLIC_CLERK_PROXY_URL

Point the client you already use at them.

import { createClerkClient } from '@clerk/backend';
const clerk = createClerkClient({ secretKey: process.env.CLERK_SECRET_KEY, apiUrl: process.env.CLERK_API_URL, publishableKey: process.env.CLERK_PUBLISHABLE_KEY, jwtKey: process.env.CLERK_JWT_KEY, proxyUrl: process.env.CLERK_PROXY_URL });
const { data: users } = await clerk.users.getUserList({ limit: 10 });

Locally, ancha runs your agent as an ordinary process, so keep real Clerk credentials out of its environment.

See all 52 endpoints

fapi

GET/fapi/.well-known/jwks.json
GET/fapi/v1/client
POST/fapi/v1/client
DELETE/fapi/v1/client
POST/fapi/v1/client/sessions/{session_id}/end
POST/fapi/v1/client/sessions/{session_id}/remove
POST/fapi/v1/client/sessions/{session_id}/tokens
POST/fapi/v1/client/sessions/{session_id}/touch
POST/fapi/v1/client/sign_ins
POST/fapi/v1/client/sign_ins/{sign_in_id}/attempt_first_factor
POST/fapi/v1/client/sign_ins/{sign_in_id}/prepare_first_factor
POST/fapi/v1/client/sign_ups
POST/fapi/v1/client/sign_ups/{sign_up_id}/attempt_verification
POST/fapi/v1/client/sign_ups/{sign_up_id}/prepare_verification
GET/fapi/v1/environment

invitations

GET/v1/invitations
POST/v1/invitations
POST/v1/invitations/{invitation_id}/revoke

jwks

GET/v1/jwks

organizations

GET/v1/organizations
POST/v1/organizations
GET/v1/organizations/{organization_id}
PATCH/v1/organizations/{organization_id}
DELETE/v1/organizations/{organization_id}
GET/v1/organizations/{organization_id}/invitations
POST/v1/organizations/{organization_id}/invitations
GET/v1/organizations/{organization_id}/invitations/{invitation_id}
POST/v1/organizations/{organization_id}/invitations/{invitation_id}/revoke
GET/v1/organizations/{organization_id}/memberships
POST/v1/organizations/{organization_id}/memberships
PATCH/v1/organizations/{organization_id}/memberships/{user_id}
DELETE/v1/organizations/{organization_id}/memberships/{user_id}
PATCH/v1/organizations/{organization_id}/metadata

sessions

GET/v1/sessions
POST/v1/sessions
GET/v1/sessions/{session_id}
POST/v1/sessions/{session_id}/revoke
POST/v1/sessions/{session_id}/tokens
POST/v1/sessions/{session_id}/tokens/{template_name}

testing_tokens

POST/v1/testing_tokens

users

GET/v1/users
POST/v1/users
GET/v1/users/{user_id}
PATCH/v1/users/{user_id}
DELETE/v1/users/{user_id}
POST/v1/users/{user_id}/ban
POST/v1/users/{user_id}/lock
PATCH/v1/users/{user_id}/metadata
GET/v1/users/{user_id}/organization_memberships
POST/v1/users/{user_id}/unban
POST/v1/users/{user_id}/unlock
GET/v1/users/count

Seed your own data

The data the Clerk mock starts with on every run, cut to a few records. ancha twins seed clerk prints every field.

Full seed YAML
twins:
  - clerk
seed:
  clerk:
    instance:
      name: Acme dashboard
    users:
      - email: erin.walsh@ridgeway-robotics.example
        firstName: Erin
        lastName: Walsh
        created: -60h
        lastSignIn: -2h
        lastActive: -1h
        hasPassword: true
        banned: false
        locked: false
        publicMetadata:
          title: Director of Operations
        privateMetadata:
          hubspot_contact_id: "30001"
      - email: hector.ruiz@ridgeway-robotics.example
        firstName: Hector
        lastName: Ruiz
        created: -50h
        lastSignIn: -26h
        lastActive: -20h
        hasPassword: true
        banned: false
        locked: false
        publicMetadata:
          title: Warehouse Lead
        privateMetadata: {}
      - email: bao.tran@ridgeway-robotics.example
        firstName: Bao
        lastName: Tran
        created: -48h
        lastSignIn: -30h
        lastActive: -30h
        hasPassword: true
        banned: false
        locked: false
        publicMetadata:
          title: Operations Analyst
        privateMetadata: {}
      - email: helen.brooks@pinecrest-health.example
        firstName: Helen
        lastName: Brooks
        created: -27h
        lastSignIn: -6h
        lastActive: -5h
        hasPassword: true
        banned: false
        locked: false
        publicMetadata:
          title: IT Director
        privateMetadata: {}
      - email: omar.haddad@pinecrest-health.example
        firstName: Omar
        lastName: Haddad
        created: -25h
        lastSignIn: -8h
        lastActive: -8h
        hasPassword: true
        banned: false
        locked: false
        publicMetadata: {}
        privateMetadata: {}
      - email: grace.liu@pinecrest-health.example
        firstName: Grace
        lastName: Liu
        created: -25h
        hasPassword: true
        banned: false
        locked: false
        publicMetadata:
          title: Finance Analyst
        privateMetadata: {}
      - email: dale.whitfield@kestrel-cu.example
        firstName: Dale
        lastName: Whitfield
        created: -6000h
        lastSignIn: -26h
        lastActive: -25h
        hasPassword: true
        banned: false
        locked: false
        publicMetadata:
          title: VP Member Services
        privateMetadata: {}
      - email: nina.alvarez@kestrel-cu.example
        firstName: Nina
        lastName: Alvarez
        created: -5000h
        lastSignIn: -200h
        lastActive: -200h
        hasPassword: true
        banned: false
        locked: true
        publicMetadata: {}
        privateMetadata: {}
      - email: carla.diaz@summitfreight.example
        firstName: Carla
        lastName: Diaz
        created: -400h
        lastSignIn: -3h
        lastActive: -3h
        hasPassword: true
        banned: false
        locked: false
        publicMetadata:
          title: Logistics Manager
        privateMetadata: {}
      - email: pete.novak@summitfreight.example
        firstName: Pete
        lastName: Novak
        created: -390h
        lastSignIn: -50h
        lastActive: -48h
        hasPassword: true
        banned: false
        locked: false
        publicMetadata: {}
        privateMetadata: {}
      - email: ivan.petrov@helix-mfg.example
        firstName: Ivan
        lastName: Petrov
        created: -7000h
        lastSignIn: -960h
        lastActive: -960h
        hasPassword: true
        banned: false
        locked: false
        publicMetadata:
          title: Plant Systems Manager
        privateMetadata: {}
      - email: laura@acme.example
        firstName: Laura
        lastName: Kim
        created: -5000h
        lastSignIn: -6h
        lastActive: -6h
        hasPassword: true
        banned: false
        locked: false
        publicMetadata:
          staff: true
        privateMetadata:
          support_role: customer-success
    organizations:
      - name: Ridgeway Robotics
        slug: ridgeway-robotics
        created: -60h
        maxMembers: 25
        publicMetadata:
          plan: pilot
          pilot_ends: 2026-11-30
        privateMetadata: {}
        members:
          - email: erin.walsh@ridgeway-robotics.example
            role: org:admin
          - email: hector.ruiz@ridgeway-robotics.example
            role: org:member
          - email: bao.tran@ridgeway-robotics.example
            role: org:member
        invitations:
          - email: marcus.bell@ridgeway-robotics.example
            role: org:member
            status: pending
            created: -20h
            expiresInDays: 30
            inviter: erin.walsh@ridgeway-robotics.example
          - email: june.park@ridgeway-robotics.example
            role: org:member
            status: pending
            created: -20h
            expiresInDays: 30
            inviter: erin.walsh@ridgeway-robotics.example
          - email: luis.ortega@ridgeway-robotics.example
            role: org:member
            status: pending
            created: -19h
            expiresInDays: 30
            inviter: hector.ruiz@ridgeway-robotics.example
      - name: Pinecrest Health
        slug: pinecrest-health
        created: -27h
        maxMembers: 120
        publicMetadata:
          plan: enterprise
          seats: 120
          contract_start: 2026-12-01
        privateMetadata: {}
        members:
          - email: helen.brooks@pinecrest-health.example
            role: org:admin
          - email: omar.haddad@pinecrest-health.example
            role: org:member
          - email: grace.liu@pinecrest-health.example
            role: org:member
        invitations: []
      - name: Kestrel Credit Union
        slug: kestrel-credit-union
        created: -6000h
        maxMembers: 50
        publicMetadata:
          plan: business
          renewal: 2026-11-07
        privateMetadata: {}
        members:
          - email: dale.whitfield@kestrel-cu.example
            role: org:admin
          - email: nina.alvarez@kestrel-cu.example
            role: org:member
        invitations: []
      - name: Summit Freight
        slug: summit-freight
        created: -400h
        maxMembers: 40
        publicMetadata:
          plan: business
        privateMetadata: {}
        members:
          - email: carla.diaz@summitfreight.example
            role: org:admin
          - email: pete.novak@summitfreight.example
            role: org:member
        invitations:
          - email: yard.office@summitfreight.example
            role: org:member
            status: pending
            created: -900h
            expiresInDays: 30
            inviter: carla.diaz@summitfreight.example
      - name: Helix Manufacturing
        slug: helix-manufacturing
        created: -7000h
        maxMembers: 30
        publicMetadata:
          plan: business
          renewal: 2026-12-15
        privateMetadata: {}
        members:
          - email: ivan.petrov@helix-mfg.example
            role: org:admin
        invitations: []
    invitations:
      - email: security@bluefield-logistics.example
        status: pending
        created: -8h
        expiresInDays: 30

Check what your agent did

Checks YAML
checks:
  - id: user_created
    trace:
      called: POST /v1/users
  - id: signed_in
    state:
      clerk.sessions:
        email: erin.walsh@ridgeway-robotics.example
        status: active
        count_gte: 1
  - id: admin_member
    state:
      clerk.memberships:
        organization: ridgeway-robotics
        email: erin.walsh@ridgeway-robotics.example
        role: org:admin
        count: 1

More identity tools

All 43 tools

Clerk API mock FAQ

Does banning a Clerk user revoke their active sessions in the mock?

POST /v1/users/{user_id}/ban sets banned to true and changes that user's active sessions to revoked. Read the user and its sessions again to verify both changes.

How are nested Clerk metadata updates applied during a test?

PATCH /v1/users/{user_id}/metadata merges public_metadata, private_metadata and unsafe_metadata into their existing values. Nested objects merge recursively, and a key with a null value is removed.

What can I check when an agent adds a user to a Clerk organization?

Ancha's POST /v1/organizations/{organization_id}/memberships creates the membership and marks pending invitations for that user's email in that organization as accepted. Adding the same user again returns 422 already_a_member_in_organization.

Install the CLI and run your agent against the Clerk mock.

Book a demo

Ancha is not affiliated with Clerk.