Getting Started
1. Get a RustMaps API key
Sign in at rustmaps.com and copy your API key from your account settings.
The key is sent on every request in the X-API-Key header — RustMapsApi handles that for you.
2. Install the package
dotnet add package RustMapsApi
3. Register the client (dependency injection)
using Microsoft.Extensions.DependencyInjection;
using RustMapsApi.V4;
services.AddRustMapsClientV4(options => options.ApiKey = "YOUR_API_KEY");
Or bind from configuration (e.g. appsettings.json / user-secrets under a RustMaps section):
services.AddRustMapsClientV4(configuration.GetSection("RustMaps"));
Prefer no container? Build the client by hand — see Client → Construction.
4. Make your first call
Inject IRustMapsClient and always check IsSuccess
before reading Data:
public sealed class MapService(IRustMapsClient client)
{
public async Task<string?> GetUrlAsync(string mapId)
{
var result = await client.GetMapByIdAsync(mapId);
return result.IsSuccess ? result.Data!.Url : null;
}
}
A call that needs no credits and no subscription is a good first test — read your generation limits:
var limits = await client.GetLimitsAsync();
if (limits.IsSuccess)
{
var concurrent = limits.Data!.Concurrent;
Console.WriteLine($"Concurrent: {concurrent?.Current}/{concurrent?.Allowed}");
}