/
Contact usSee pricingStart building
    Introduction
    Overview
    Postman
    Users
      Create user
      Search users
      Get user
      Update user
      Exchange primary factor
    • Delete

      • Delete user
        Delete user email
        Delete user phone number
        Delete user WebAuthn registration
        Delete user biometric registration
        Delete user TOTP
        Delete user crypto wallet
        Delete user password
        Delete user OAuth registration
    Magic links
    • Via email

      • Send magic link
        Log in or create user
        Invite
        Revoke pending invite
    • Embeddable

      • Create
      Authenticate
    OAuth
      Attach
      Authenticate
    • Start

      • Google
        Amazon
        Apple
        Bitbucket
        Coinbase
        Discord
        Facebook
        Figma
        GitHub
        GitLab
        Linkedin
        Microsoft
        Salesforce
        Slack
        Snapchat
        TikTok
        Twitch
        Twitter
        Yahoo
    Passwords
      Create
      Authenticate
      Strength check
      Migrate
    • Reset options

      • Password reset by email start
        Password reset by email
        Password reset by existing password
        Password reset by session
    One-time passcodes (OTP)
    • Via SMS

      • Send
        Login or create user
    • Via Whatsapp

      • Send
        Login or create user
    • Via email

      • Send
        Login or create user
      Authenticate
    Session management
      Session object
      Get JWKS
      Get sessions
      Authenticate Session
      Revoke session
      Migrate session
      Attest Session
      Exchange Access Token
    Passkeys & WebAuthn
    • Register

      • Start
        Register
    • Authenticate

      • Start
        Authenticate
      Update
      List WebAuthn Credentials
    Time-based one-time passcodes (TOTP)
      Create
      Authenticate
      Get recovery codes
      Recover
    Crypto wallets
      Authenticate start
      Authenticate
    M2M Authentication
      M2M Client Object
    • Token

      • Get Access Token
        Authenticate Access Token
    • M2M Client

      • Create M2M client
        Get M2M client
        Search M2M clients
        Update M2M client
        Delete M2M client
    • Rotate secret

      • Start secret rotation
        Rotate secret
        Cancel secret rotation
    Connected AppsBeta
      Exchange Authorization Code
      Exchange Refresh Token
    • Tokens

      • Connected App ID Token Object
        Connected App Access Token Object
    • Configuration

      • Get JWKS
        Get OpenID Configuration
    • Methods

      • Introspect Token
        Authenticate Access Token (Local)
        Revoke Token
        Get UserInfo
    • Consent Management

      • Start OAuth AuthorizationComing soon
        Submit OAuth AuthorizationComing soon
        Get Authorized Connected Apps for a User
        Revoke Connected App Access to a User
    • Application Management

      • Dynamic Client Registration
        Create Connected App
        Get Connected App
        Search Connected Apps
        Update Connected App
        Delete Connected App
    • Rotate secret

      • Start secret rotation
        Rotate secret
        Cancel secret rotation
    RBAC
      Resource object
      Role object
      Scope object
      Get RBAC Policy
    User Impersonation
      Authenticate Token
    Resources
      Email templates
      URL validation
      Metadata
      User states
    Errors
      Overview
      Error object
      400
      401
      403
      404
      405
      429
      499
      500
      503
Get support on SlackVisit our developer forum

Contact us

Consumer Authentication

/

API reference

/

M2M Authentication

/

M2M Client

/

Search M2M clients

Search M2M Clients

POST
https://test.stytch.com/v1/m2m/clients/search

Search for M2M Clients within your Stytch Project. Submit an empty query in the request to return all M2M Clients.

The following search filters are supported today:

  • client_id: Pass in a list of client IDs to get many clients in a single request
  • client_name: Search for clients by exact match on client name
  • scopes: Search for clients assigned a specific scope

Body parameters


limit int

The number of search results to return per page. The default limit is 100. A maximum of 1000 results can be returned by a single search request. If the total size of your result set is greater than one page size, you must paginate the response. See the cursor field.


cursor string

The cursor field allows you to paginate through your results. Each result array is limited to 1000 results. If your query returns more than 1000 results, you will need to paginate the responses using the cursor. If you receive a response that includes a non-null next_cursor in the results_metadata object, repeat the search call with the next_cursor value set to the cursor field to retrieve the next page of results. Continue to make search calls until the next_cursor in the response is null.


query object

The optional query object contains the operator, i.e. AND or OR, and the operands that will filter your results. Only an operator is required. If you include no operands, no filtering will be applied. If you include no query object, it will return all results with no filtering applied.

operator string

The action to perform on the operands. The accepted value are:

AND – all the operand values provided must match.

OR – the operator will return any matches to at least one of the operand values you supply.

operands array[objects]

An array of operand objects that contains all of the filters and values to apply to your search search query.

filter_name string

The type of search filter to apply.

filter_value string, array, or object

The values to search for based on which search filter is specified in filter_name.

client_id array[strings]

The client_id filter allows you to search for one or more exact client_ids. The filter_value accepts an array of client_ids, e.g. ["client-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6"].

client_name array[strings]

The client_name filter allows you to search for one or more exact client_names. The filter_value accepts an array of client_names, e.g. ["My Sample Client"].

scopes array[strings]

The scopes filter allows you to search for clients containing one or more scopess. The filter_value accepts an array of scopess, e.g. ["read:users"].


Response fields


request_id string

Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.


status_code int

The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.


m2m_clients array[object]

An array of M2M Clients that match your search query.


results_metadata object

The search results_metadata object contains metadata relevant to your specific query like total and next_cursor.

next_cursor string

The next_cursor string is returned when your search result contains more than one page of results. This value is passed into your next search call in the cursor field.

total int

The total number of results returned by your search query. If totals have been disabled for your Stytch Workspace to improve search performance, the value will always be -1.

const stytch = require('stytch');

const client = new stytch.Client({
  project_id: 'PROJECT_ID',
  secret: 'SECRET',
});

const params = {
  limit: 10,
};

client.m2m.clients.search(params)
  .then(resp => { console.log(resp) })
  .catch(err => { console.log(err) });
RESPONSE 200
200
​
{
    "status_code": 200,
    "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
    "m2m_clients": [{...}, {...}, {...}],
    "results_metadata": {
        "next_cursor": null,
        "total": 1
    }
}
RESPONSE 404
200
​
{
  "status_code": 404,
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "error_type": "m2m_client_not_found",
  "error_message": "The m2m client requested could not be found.",
  "error_url": "https://stytch.com/docs/api/errors/404"
}
RESPONSE 429
200
​
{
  "status_code": 429,
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "error_type": "too_many_requests",
  "error_message": "Too many requests have been made.",
  "error_url": "https://stytch.com/docs/api/errors/429"
}
RESPONSE 500
200
​
{
  "status_code": 500,
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "error_type": "internal_server_error",
  "error_message": "Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.",
  "error_url": "https://stytch.com/docs/api/errors/500"
}

Common Error Types

  • m2m_search_expected_array_of_strings
  • m2m_search_filter_name_not_recognized
  • m2m_search_missing_filter_name
  • user_search_invalid_cursor
  • user_search_invalid_operator