Skip to content

Set custom device(user agent)

Ramtin Jokar edited this page Aug 20, 2018 · 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 = "HUAWEI/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",
    // Device brand/android board name/device model : android version/hardware model/95414346:user/release-keys
    FirmwareFingerprint = "HUAWEI/HONOR/PRA-LA1:7.0.0/hi6250/95414346:user/release-keys",
    // don't change this
    AndroidBootloader = "4.23",
    // don't change this
    DeviceModelBoot = "qcom",
    // don't change this
    FirmwareTags = "release-keys",
    // don't change this
    FirmwareType = "user"
};

Setting up:

InstaApi = InstaApiBuilder.CreateBuilder()
    .SetUser(userSession)
    // Set up device
    .SetDevice(device)
    .Build();
Clone this wiki locally