# Charity Search

To try a test and directly interact with the API endpoint click "Test It" and use an embedded API client to send requests with custom headers and variables, then see the live response; essentially letting you test this API directly within this page. When testing please use our Demo URL: `https://demo-payments.frontstream.com/api/CharitySearch`

## GET /api/CharitySearch

> Nonprofit Charity Search

```json
{"openapi":"3.0.1","info":{"title":"The Payment API","version":"v1"},"paths":{"/api/CharitySearch":{"get":{"tags":["Charity Search"],"summary":"Nonprofit Charity Search","description":"","parameters":[{"name":"Name","in":"query","description":"optional - Charity Name - partial or full name","schema":{"maxLength":70,"type":"string"}},{"name":"EIN","in":"query","description":"optional - Valid US/CA Nonprofit EIN/Tax ID. For US EINs, the dash proceeding the first two numbers is optional; the endpoint will handle it either way (i.e. 12-3456789 and 123456789 are both valid and will result in the same record being returned)","schema":{"maxLength":15,"minLength":9,"type":"string"}},{"name":"CharitySource","in":"query","description":"optional - This should be either 1 (US) or 2 (Canada) - Default to US","schema":{"type":"integer","format":"int32"}},{"name":"City","in":"query","description":"optional - Searches the city name of charity addresses","schema":{"maxLength":30,"type":"string"}},{"name":"State","in":"query","description":"optional - Searches the state code of charity addresses - ISO Standard two digit State code. (VA, NY)","schema":{"maxLength":2,"type":"string"}},{"name":"PageIndex","in":"query","description":"Defaults to 1 - The page of results to display (i.e. if there are 100 overall results to your search and you provide this as 3 with a PageSize=10, this will return results #21 through #30)","schema":{"type":"integer","format":"int32"}},{"name":"PageSize","in":"query","description":"Defaults to 10 - The number of results to display per page.","schema":{"type":"integer","format":"int32"}},{"name":"SortColumn","in":"query","description":"Default SortColumn NpoName - Indicates which SearchResults field to sort by (see response example for valid values). Only supports sorting by one column.","schema":{"type":"string"}},{"name":"SortDesc","in":"query","description":"true/false - Determine to order the results by descending values of the selected column (or NpoName if not selected).","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Returns Charity Search Data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CharitySearchResults"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BrokenRule"}}}}},"404":{"description":"If Charity Search Data not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"CharitySearchResults":{"type":"object","properties":{"TotalResultCount":{"type":"integer","description":"How many total possible results there are for your search.","format":"int32"},"TotalPages":{"type":"integer","description":"How many pages of data exist based on your selected PageSize.","format":"int32"},"PageIndex":{"type":"integer","description":"Confirms what you passed in the querystring.","format":"int32"},"PageSize":{"type":"integer","description":"Confirms what you passed in the querystring.","format":"int32"},"SearchResults":{"type":"array","items":{"$ref":"#/components/schemas/CharitySearchResultsList"},"description":"Each record in the array represents a full Charity Record.","nullable":true}},"additionalProperties":false,"description":""},"CharitySearchResultsList":{"type":"object","properties":{"CharityId":{"type":"string","description":"Unique Identifier for the Charity in the Payment API.","nullable":true},"NpoName":{"type":"string","description":"Name of the Charity in the Payment API database.","nullable":true},"EIN":{"type":"string","description":"The United States EIN or Canadian Tax ID of the Charity.","nullable":true},"Address1":{"type":"string","description":"Address Line 1 of the Charity's address.","nullable":true},"Address2":{"type":"string","description":"Address Line 2 of the Charity's address.","nullable":true},"City":{"type":"string","description":"City of the Charity's address.","nullable":true},"State":{"type":"string","description":"State of the Charity's address.","nullable":true},"Zip":{"type":"string","description":"Postal Code of the Charity's address.","nullable":true},"Country":{"type":"string","description":"Country of the Charity's address.","nullable":true},"NpoEligibilityFlag":{"type":"boolean","description":"Indicates whether or not the organization is currently able to receive tax-deductible donations based on United States IRS filings."},"ParentOrgName":{"type":"string","description":"This will return the same value as NpoName if the Charity has no Parent organization, but if a particular organization has indicated that it is a child organization of a larger Charity (such as a regional chapter of a nationwide charity), the Parent Charity name will appear here.","nullable":true},"NTEEcode":{"type":"string","description":"The Charity's NTEE code as defined by United States IRS filings. This is not a required classification, and thus may not exist for all records (and will not exist for Canadian charity records).","nullable":true}},"additionalProperties":false,"description":""},"BrokenRule":{"type":"object","properties":{"ErrorCode":{"type":"integer","format":"int32"},"Message":{"type":"string","nullable":true},"LoggerMessage":{"type":"string","nullable":true}},"additionalProperties":false},"ProblemDetails":{"type":"object","properties":{"type":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"status":{"type":"integer","format":"int32","nullable":true},"detail":{"type":"string","nullable":true},"instance":{"type":"string","nullable":true}},"additionalProperties":{}}}}}
```

### Charity Search Example

Take a look at how you may call this method:

{% tabs %}
{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;

public class CharitySearchParams
{
    public string Name { get; set; }
    public string EIN { get; set; }
    public int? CharitySource { get; set; }
    public string City { get; set; }
    public string State { get; set; }
    public int PageIndex { get; set; } = 1;
    public int PageSize { get; set; } = 10;
    public string SortColumn { get; set; } = "NpoName";
    public bool SortDesc { get; set; } = false;
}

public class CharitySearchResponse
{
    public int TotalResultCount { get; set; }
    public int TotalPages { get; set; }
    public int PageIndex { get; set; }
    public int PageSize { get; set; }
    public object[] SearchResults { get; set; }
}

public class Program
{
    private static async Task Main(string[] args)
    {
        var charitySearchParams = new CharitySearchParams
        {
            Name = "Red Cross",
            EIN = "123456789",
            City = "New York",
            State = "NY",
            PageIndex = 1,
            PageSize = 10
        };

        var url = "https://demo-payments.frontstream.com/api/CharitySearch";

        using (var client = new HttpClient())
        {
            var query = $"?Name={charitySearchParams.Name}&EIN={charitySearchParams.EIN}&City={charitySearchParams.City}&State={charitySearchParams.State}&PageIndex={charitySearchParams.PageIndex}&PageSize={charitySearchParams.PageSize}&SortColumn={charitySearchParams.SortColumn}&SortDesc={charitySearchParams.SortDesc}";
            var response = await client.GetAsync(url + query);

            if (response.IsSuccessStatusCode)
            {
                var data = await response.Content.ReadAsStringAsync();
                var charitySearchResponse = JsonConvert.DeserializeObject<CharitySearchResponse>(data);
                Console.WriteLine($"Total Results: {charitySearchResponse.TotalResultCount}");
            }
            else
            {
                Console.WriteLine("Error: " + response.StatusCode);
            }
        }
    }
}

```

{% endtab %}

{% tab title="Postman" %}

#### Postman Example for CharitySearch API:

1. **Method**: `GET`
2. **URL**: `https://demo-payments.fronstream.com/api/CharitySearch`
3. **Params**:
   * `Name`: `Red Cross` (optional, charity name)
   * `EIN`: `123456789` (optional, EIN or Tax ID)
   * `City`: `New York` (optional, city)
   * `State`: `NY` (optional, state code)
   * `PageIndex`: `1` (optional, default 1)
   * `PageSize`: `10` (optional, default 10)
   * `SortColumn`: `NpoName` (optional, default sorting by name)
   * `SortDesc`: `false` (optional, sort order)

After setting these parameters, click **Send** to view the results.
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.frontstream.com/welcome-to-our-payment-api/api-references/test-payment-api-features/charity-search.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
