Complete reference for the JeppeStaerk.OnePasswordConnect SDK.
The SDK provides complete coverage of the 1Password Connect API v1.8.1.
Access and manage 1Password vaults.
| Operation | Endpoint | Method | Supported |
|---|---|---|---|
| Get all vaults | /v1/vaults |
GET | ✅ |
| Get vault by ID | /v1/vaults/{vaultId} |
GET | ✅ |
| SCIM filtering | /v1/vaults?filter=... |
GET | ✅ |
Example:
var vaults = await client.Vaults.GetVaultsAsync();
var vault = await client.Vaults.GetVaultByIdAsync("vault-id");
var filtered = await client.Vaults.GetVaultsAsync(filter: "name eq \"Production\"");Full CRUD operations for vault items, including JSON Patch support.
| Operation | Endpoint | Method | Supported |
|---|---|---|---|
| Get all items in vault | /v1/vaults/{vaultId}/items |
GET | ✅ |
| Get item by ID | /v1/vaults/{vaultId}/items/{itemId} |
GET | ✅ |
| Create item | /v1/vaults/{vaultId}/items |
POST | ✅ |
| Update item (full) | /v1/vaults/{vaultId}/items/{itemId} |
PUT | ✅ |
| Partial update (PATCH) | /v1/vaults/{vaultId}/items/{itemId} |
PATCH | ✅ |
| Delete item | /v1/vaults/{vaultId}/items/{itemId} |
DELETE | ✅ |
| SCIM filtering | /v1/vaults/{vaultId}/items?filter=... |
GET | ✅ |
Example:
// Get
var items = await client.Items.GetVaultItemsAsync("vault-id");
var item = await client.Items.GetVaultItemByIdAsync("vault-id", "item-id");
// Create
var newItem = new FullItem { Title = "New Item", /* ... */ };
var created = await client.Items.CreateVaultItemAsync("vault-id", newItem);
// Update
item.Title = "Updated";
var updated = await client.Items.UpdateVaultItemAsync("vault-id", "item-id", item);
// Patch
var patchOps = new List<PatchOperation> { /* ... */ };
var patched = await client.Items.PatchVaultItemAsync("vault-id", "item-id", patchOps);
// Delete
await client.Items.DeleteVaultItemAsync("vault-id", "item-id");Download files attached to vault items.
| Operation | Endpoint | Method | Supported |
|---|---|---|---|
| Get all files in item | /v1/vaults/{vaultId}/items/{itemId}/files |
GET | ✅ |
| Get file by ID | /v1/vaults/{vaultId}/items/{itemId}/files/{fileId} |
GET | ✅ |
| Download file content (bytes) | /v1/vaults/{vaultId}/items/{itemId}/files/{fileId}/content |
GET | ✅ |
| Download file content (stream) | /v1/vaults/{vaultId}/items/{itemId}/files/{fileId}/content |
GET | ✅ |
| Inline file content | /v1/vaults/{vaultId}/items/{itemId}/files?inline_files=true |
GET | ✅ |
| Upload files | - | POST | ❌ Not supported by API |
Example:
// List files
var files = await client.Files.GetItemFilesAsync("vault-id", "item-id");
// Get file details
var file = await client.Files.GetFileByIdAsync("vault-id", "item-id", "file-id");
// Download as bytes
byte[] content = await client.Files.DownloadFileContentAsync("vault-id", "item-id", "file-id");
// Download as stream (recommended for large files)
using var stream = await client.Files.DownloadFileStreamAsync("vault-id", "item-id", "file-id");Query API request activity and audit logs.
| Operation | Endpoint | Method | Supported |
|---|---|---|---|
| Get API activity | /v1/activity |
GET | ✅ |
| Pagination support | /v1/activity?limit={limit}&offset={offset} |
GET | ✅ |
Example:
var activity = await client.Activity.GetApiActivityAsync(limit: 10, offset: 0);
foreach (var request in activity)
{
Console.WriteLine($"[{request.Timestamp}] {request.Action} - {request.Result}");
}Monitor server health and metrics.
| Operation | Endpoint | Method | Supported |
|---|---|---|---|
| Heartbeat (liveness) | /heartbeat |
GET | ✅ |
| Health check | /health |
GET | ✅ |
| Prometheus metrics | /metrics |
GET | ✅ |
Example:
// Liveness check
var heartbeat = await client.Health.GetHeartbeatAsync();
// Returns: "."
// Detailed health
var health = await client.Health.GetServerHealthAsync();
Console.WriteLine($"Server: {health.Name} v{health.Version}");
// Prometheus metrics
var metrics = await client.Health.GetPrometheusMetricsAsync();- .NET Standard 2.1 or .NET 9.0+ (multi-targeted)
- Compatible with:
- .NET Core 3.0, 3.1
- .NET 5.0, 6.0, 7.0, 8.0, 9.0
- .NET Framework 4.6.2+ (via .NET Standard 2.1)
- Mono 5.4+
- Xamarin.iOS 10.14+
- Xamarin.Android 8.0+
- Compatible with:
- Microsoft.Extensions.DependencyInjection - Required for service registration
- Microsoft.Extensions.Http - IHttpClientFactory support
- Microsoft.Extensions.Http.Polly - Resilience policies (retry, circuit breaker)
- Microsoft.Extensions.Logging.Abstractions - Structured logging
- Microsoft.Extensions.Options - Options pattern
- Polly - Resilience framework
- System.Text.Json - JSON serialization
- 1Password Connect Server (v1.8.1)
- Valid 1Password Connect API token
- Network access to 1Password Connect Server
- HTTPS recommended for production (HTTP OK for development)
This SDK version matches the 1Password Connect API specification version:
| SDK Version | API Version | OpenAPI Spec |
|---|---|---|
| 1.8.1 | 1.8.1 | res/1password-connect-api_1.8.1.yaml |
The SDK version will always match the API specification version to make compatibility clear.
The OpenAPI specification file is included in the repository for reference:
- Path:
res/1password-connect-api_1.8.1.yaml - Spec Version: OpenAPI 3.0.0
- API Version: 1.8.1
- Major version changes (2.x.x) - Breaking API changes
- Minor version changes (1.x.x) - New features, backward compatible
- Patch version changes (1.8.x) - Bug fixes, backward compatible
The SDK is designed exclusively for dependency injection and cannot be instantiated manually.
Why:
OnePasswordConnectClientconstructor requires all five specialized clients- Each client requires
IHttpClientFactoryandILogger<TClient>instances - Manual instantiation would bypass resilience policies and logging
Always use:
builder.Services.AddOnePasswordConnect(/* ... */);Don't do:
// ❌ Won't work - too many required dependencies
var client = new OnePasswordConnectClient(/* ... */);The 1Password Connect API (v1.8.1) does not support file uploads - only file downloads are available.
You can:
- ✅ List files attached to items
- ✅ Download file content (as bytes or stream)
- ✅ Get file metadata
You cannot:
- ❌ Upload new files to items
- ❌ Update existing files
- ❌ Delete files
This is a limitation of the API itself, not the SDK. File upload may be added in future API versions.
The SDK intentionally does NOT include Microsoft.Extensions.Http.Diagnostics as a dependency.
Why:
- This is a secrets management SDK
- Logging request/response bodies could expose sensitive data (passwords, API tokens, vault contents)
If you need HTTP diagnostics:
- Add the package yourself
- Implement proper redaction for sensitive headers and bodies
- Never log request/response bodies
See Advanced HTTP Diagnostics for guidance.
Enums use API naming directly (SCREAMING_SNAKE_CASE or lowercase):
// Enums match API naming exactly
var item = new FullItem
{
Category = ItemCategory.LOGIN, // Not ItemCategory.Login
Fields = new List<Field>
{
new Field
{
Type = FieldType.CONCEALED, // Not FieldType.Concealed
Purpose = FieldPurpose.PASSWORD // Not FieldPurpose.Password
}
}
};
// Exception: JSON Patch uses lowercase per RFC6902
var patchOp = new PatchOperation
{
Op = PatchOperation.replace, // lowercase per standard
Path = "/title",
Value = "New Title"
};OnePasswordConnectClient - Facade providing access to all operations.
public class OnePasswordConnectClient
{
public VaultsClient Vaults { get; }
public ItemsClient Items { get; }
public FilesClient Files { get; }
public ActivityClient Activity { get; }
public HealthClient Health { get; }
}Each operation type has its own client:
| Client | Purpose | Namespace |
|---|---|---|
VaultsClient |
Vault operations | JeppeStaerk.OnePasswordConnect.Sdk.Clients |
ItemsClient |
Item CRUD + JSON Patch | JeppeStaerk.OnePasswordConnect.Sdk.Clients |
FilesClient |
File download operations | JeppeStaerk.OnePasswordConnect.Sdk.Clients |
ActivityClient |
API activity/audit logs | JeppeStaerk.OnePasswordConnect.Sdk.Clients |
HealthClient |
Health checks, metrics | JeppeStaerk.OnePasswordConnect.Sdk.Clients |
All models are in JeppeStaerk.OnePasswordConnect.Sdk.Models:
Vault- Vault informationFullItem- Complete item with all fieldsItem- Summary item informationField- Item field (username, password, etc.)File- File metadataApiRequest- Activity log entryServerHealth- Server health status- And more...
All enums are in JeppeStaerk.OnePasswordConnect.Sdk.Enums:
ItemCategory- LOGIN, PASSWORD, API_CREDENTIAL, etc.FieldType- STRING, CONCEALED, EMAIL, URL, etc.FieldPurpose- USERNAME, PASSWORD, NONEPatchOperation- add, remove, replace, etc.
All exceptions are in JeppeStaerk.OnePasswordConnect.Sdk.Exceptions:
OnePasswordConnectException- Base exceptionBadRequestException- 400 errorsUnauthorizedException- 401 errorsForbiddenException- 403 errorsNotFoundException- 404 errors