Search for Organizations

POST
https://test.stytch.com/v1/b2b/organizations/search

Search for Organizations. If you send a request with no body params, no filtering will be applied and the endpoint will return all Organizations. All fuzzy search filters require a minimum of three characters.


Body parameters


cursorstring

limitint

queryobject

Response fields


request_idstring

status_codeint

results_metadataobject

organizationsarray[objects]
const stytch = require('stytch');

const client = new stytch.B2BClient({
  project_id: 'PROJECT_ID',
  secret: 'SECRET',
  env: stytch.envs.test,
});

const params = {
  limit: 200,
  cursor: "",
  query: {
    operator: "OR",
    operands: [
      {
        filter_name: "allowed_domains",
        filter_value: ["stytch.com"]
      },
      {
        filter_name: "organization_name_fuzzy",
        filter_value: "example org"
      }
    ]
  }
};

client.organizations
  .search(params)
  .then((resp) => {
    console.log(resp);
  })
  .catch((err) => {
    console.log(err);
  });
RESPONSE
{
  "status_code": 200,
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "results_metadata": {
		"next_cursor": null,
		"total": 5
	},
  "organizations": [
		...
  ]
}

Common Error Types