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.
Search for Organizations
POST
https://test.stytch.com/v1/b2b/organizations/searchBody parameters
cursor string
limit int
query object
Response fields
request_id string
status_code int
results_metadata object
organizations array[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
200
{
"status_code": 200,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"results_metadata": {
"next_cursor": null,
"total": 5
},
"organizations": [
...
]
}
Common Error Types
- invalid_email
- organization_search_expected_array_of_strings
- organization_search_expected_string
- organization_search_filter_name_not_recognized
- organization_search_member_email_fuzzy_too_short
- organization_search_missing_filter_name
- organization_search_missing_filter_value
- organization_search_organization_name_fuzzy_too_short
- search_timeout
- user_search_invalid_cursor
- user_search_invalid_limit
- user_search_invalid_operator