personalize.marketing
GuidesCode

C# .NET Integration

How to use the personalize.marketing API with C# .NET

C# .NET Integration

Increase Timeout to 5 Minutes

The API analyzes influencer profiles in real-time, which can take up to 300 seconds per request. Set your HTTP client timeout to at least 300 seconds (5 minutes) to avoid premature timeouts.

Prerequisites

You need an API key. See Get Started for instructions.

Security Tip

Store your API key in environment variables to avoid accidentally committing it to git. Never hardcode API keys in your source code.

Example

using System.Text;
using System.Text.Json;

class Program
{
    // ============ CONFIGURE THESE ============
    private static readonly string ApiKey = Environment.GetEnvironmentVariable("PERSONALIZE_API_KEY")!;
    private static readonly string ProfileUrl = "https://linkedin.com/in/arnold-schwarzenegger/";
    private static readonly string Template = @"Hey {{first name}},

Love what you are building with {{their company or product}}. We make fitness supplements that would pair perfectly with your brand.

Worth a quick chat?";
    private static readonly string BrandContext = "We are a fitness supplement brand targeting health-conscious entrepreneurs";
    private static readonly string AiInstructions = "Keep the tone professional but friendly";
    // =========================================

    static async Task Main()
    {
        using var client = new HttpClient { Timeout = TimeSpan.FromMinutes(5) };
        client.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}");

        var requestBody = new
        {
            profile_url = ProfileUrl,
            template = Template,
            brand_context = BrandContext,
            ai_instructions = AiInstructions,
            enable_brand_fit_score = false,
            include_profile_report = false,
            include_raw_data = false
        };

        var json = JsonSerializer.Serialize(requestBody);
        var content = new StringContent(json, Encoding.UTF8, "application/json");

        var response = await client.PostAsync("https://personalize.marketing/api/v1/personalize-api", content);
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}

Response:

{
  "success": true,
  "personalized_text": "Hey Arnold,\n\nLove what you are building with The Pump app. We make fitness supplements that would pair perfectly with your brand.\n\nWorth a quick chat?",
  "profile_url": "https://linkedin.com/in/arnold-schwarzenegger/",
  "brand_fit_score": 9,
  "profile_report": "Arnold Schwarzenegger is an entrepreneur, actor, and fitness icon with 500K+ LinkedIn followers. He actively promotes his businesses including The Pump app and his daily newsletter. His content focuses on fitness, motivation, and health advice. High engagement rates with a professional, health-conscious audience.",
  "raw_data": {
    "profile": {
      "firstName": "Arnold",
      "lastName": "Schwarzenegger",
      "headline": "Businessman | Founder of The Pump",
      "followerCount": 500000
    },
    "posts": ["..."]
  }
}

Request Fields

FieldRequiredDescription
profile_urlYesLinkedIn, Instagram, or TikTok profile URL
templateYesYour message with {{instruction}} placeholders (e.g., {{first name}})
ai_instructionsNoCustom tone/style instructions for the AI
brand_contextNoYour brand description for better post matching
enable_variationsNoRephrase output to avoid spam detection
enable_brand_fit_scoreNoGet 1-10 brand fit score
include_profile_reportNoGet detailed influencer analysis
include_raw_dataNoGet raw profile data (unstable, for debugging only)

See API Reference for complete documentation.

On this page