Table of Contents

Class ApiToken

Namespace
Mailtrap.ApiTokens.Models
Assembly
Mailtrap.Abstractions.dll

Represents API token details.

public sealed record ApiToken : IEquatable<ApiToken>
Inheritance
ApiToken
Implements

Properties

CreatedBy

Gets the name of the user or token that created this API token.

[JsonPropertyName("created_by")]
[JsonPropertyOrder(4)]
public string? CreatedBy { get; set; }

Property Value

string

Creator name or null if not available.

ExpiresAt

Gets the date and time when the API token expires.

[JsonPropertyName("expires_at")]
[JsonPropertyOrder(5)]
public DateTimeOffset? ExpiresAt { get; set; }

Property Value

DateTimeOffset?

Expiration date and time, or null if the token does not expire.

Id

Gets the API token identifier.

[JsonPropertyName("id")]
[JsonPropertyOrder(1)]
[JsonRequired]
public long Id { get; set; }

Property Value

long

API token identifier.

Last4Digits

Gets the last 4 characters of the token.

[JsonPropertyName("last_4_digits")]
[JsonPropertyOrder(3)]
public string Last4Digits { get; set; }

Property Value

string

Last 4 characters of the token. The full token value is only returned on create or reset.

Name

Gets the API token display name.

[JsonPropertyName("name")]
[JsonPropertyOrder(2)]
public string Name { get; set; }

Property Value

string

API token display name.

Resources

Gets the resource accesses granted to this API token.

[JsonPropertyName("resources")]
[JsonPropertyOrder(6)]
[JsonObjectCreationHandling(JsonObjectCreationHandling.Populate)]
public IList<ApiTokenAccess> Resources { get; }

Property Value

IList<ApiTokenAccess>

Collection of resource accesses.