C#
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
var token = Environment.GetEnvironmentVariable("AUTOCONTENT_TOKEN") ?? "YOUR_API_TOKEN";
var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var payload = new
{
outputType = "audio",
resources = new[]
{
new { type = "website", content = "https://autocontentapi.com" },
new { type = "text", content = "74% of businesses expect AI to increase productivity" }
},
text = "Explain why automating with AutoContent API is a game changer for any business"
};
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.autocontentapi.com/content/Create")
{
Content = new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json")
};
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Use the podcast scenario examples for language-specific recipes.
Last updated