Skip to content

Set custom device(user agent)

Ramtin Jokar edited this page Apr 17, 2021 · 7 revisions

You can set custom device (user-agent) in version 1.0.3.3 and newer.

Note: If you didn't set device, InstagramApiSharp will set it randomly.

Here is an example of an device object:

// this is an custom android device based on Huawei Honor 8 Lite (PRA-LA1) device
var device = new AndroidDevice
{
    // Device name
    AndroidBoardName = "HONOR",
    // Device brand
    DeviceBrand = "HUAWEI",
    // Hardware manufacturer
    HardwareManufacturer = "HUAWEI",
    // Device model
    DeviceModel = "PRA-LA1",
    // Device model identifier
    DeviceModelIdentifier = "PRA-LA1",
    // Firmware brand
    FirmwareBrand = "HWPRA-H",
    // Hardware model
    HardwareModel = "hi6250",
    // Device guid
    DeviceGuid = new Guid("be897499-c663-492e-a125-f4c8d3785ebf"),
    // Phone guid
    PhoneGuid = new Guid("7b72321f-dd9a-425e-b3ee-d4aaf476ec52"),
    // Device id based on Device guid
    DeviceId = ApiRequestMessage.GenerateDeviceIdFromGuid(new Guid("be897499-c663-492e-a125-f4c8d3785ebf")),
    // Resolution
    Resolution = "1080x1812",
    // Dpi
    Dpi = "480dpi",
};

Usage:

var InstaApi = InstaApiBuilder.CreateBuilder()
    .SetUser(userSession)
    // Set up device
    .SetDevice(device)
    .Build();

OR

InstaApi.SetDevice(device);
Clone this wiki locally