orghunter logo
Home
Charity API Key

Accessing Detailed Charity Information in C# Using the OrgHunter Charity API

Learn how to use the OrgHunter Charity API in C# to retrieve in-depth information about a specific charity by passing its EIN for detailed data access.
Title Image

Description:

Learn how to utilize the OrgHunter Charity API in C# to retrieve detailed information about a charity by passing its EIN. This article walks you through setting up the API call to expose data such as financials, classification, and tax status.

Step-by-Step Guide:

  1. Get Your API Key: Register on the OrgHunter Charity API site to obtain your API key.
  2. Set Up Your C# Project: Open Visual Studio and create a Console Application. Add System.Net.Http to make HTTP requests.
  3. Create the API Request Function: Use the following code to make a POST request to retrieve information about a charity using its EIN:

using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace CharityDetailsApp
{
class Program
{
private static async Task GetCharityDetails(string ein)
{
string apiKey = "yourKey";
string url = $"http://data.orghunter.com/v1/charitypremium?user_key={apiKey}&ein={ein}";

using (HttpClient client = new HttpClient())
{
HttpResponseMessage response = await client.PostAsync(url, null);
if (response.IsSuccessStatusCode)
{
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
else
{
Console.WriteLine($"Error: {response.StatusCode}");
}
}
}

static async Task Main(string[] args)
{
await GetCharityDetails("123456789");
}
}
}

  1. Test the Application: Replace "123456789" with the EIN of a charity you'd like to research. Run the application, and you’ll receive detailed data about the charity.

For more on what data the API can provide, visit the Charity API Premium Documentation.


orghunter logo
Home
API Key
© OrgHunter 2024. All rights reserved.

When you visit or interact with our sites, services or tools, we or our authorised service providers may use cookies for storing information to help provide you with a better, faster and safer experience and for marketing purposes.