Table of Contents

Class CreateApiTokenResponse

Namespace
Mailtrap.ApiTokens.Responses
Assembly
Mailtrap.Abstractions.dll

Response returned when an API token is created. Includes the full token value, which is only returned once at creation time.

public sealed record CreateApiTokenResponse : IEquatable<CreateApiTokenResponse>
Inheritance
CreateApiTokenResponse
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

ExpiresAt

Gets the date and time when the API token expires, or null if it does not expire.

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

Property Value

DateTimeOffset?

Id

Gets the API token identifier.

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

Property Value

long

Last4Digits

Gets the last 4 characters of the token.

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

Property Value

string

Name

Gets the API token display name.

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

Property Value

string

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>

Token

Gets the full token value. Only returned at creation time — store it securely.

[JsonPropertyName("token")]
[JsonPropertyOrder(7)]
public string Token { get; set; }

Property Value

string