Sample code for 30+ languages & platforms
Zig

Yousign: Download File

See more Yousign Examples

Downloads a previously uploaded Yousign file.

Chilkat Zig Downloads

Zig
const std = @import("std");
const chilkat = @import("chilkat");

pub fn main(init: std.process.Init) !void {
    const alloc = init.arena.allocator();

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    const http = try chilkat.Http.init();
    defer http.deinit();

    // Adds the "Authorization: Bearer YOUR_API_KEY" header.
    http.setAuthToken("YOUR_API_KEY");

    const download_url = "https://staging-api.yousign.com/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/download?alt=media";
    const local_file_path = "qa_output/x.pdf";

    http.download(download_url, local_file_path) catch {
        std.debug.print("{s}\n", .{try http.getLastErrorText(alloc)});
        return;
    };

    std.debug.print("The PDF file is downloaded...\n", .{});
}