---
updatedAt: 2026-05-07T01:57:09.000Z
agentTools:
  projectIndex: https://docs.mavan.bitminetech.io/llms.txt
---

# Create a new API key

Add a new api key for your account with a specified name. The raw `key` field is returned only in this response and never again; callers must store it immediately.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "paths": {
    "/account/apikeys": {
      "post": {
        "description": "Add a new api key for your account with a specified name. The raw `key` field is returned only in this response and never again; callers must store it immediately.",
        "operationId": "addNewApiKey",
        "parameters": [
          {
            "name": "api-key",
            "in": "header",
            "description": "mavan api key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponseBase"
                    },
                    {
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/CreatedApiKeyDto"
                        }
                      }
                    }
                  ],
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "summary": "Create a new API key",
        "tags": [
          "Account"
        ]
      }
    }
  },
  "info": {
    "title": "MAVAN Staking API",
    "description": "The MAVAN Staking API Docs",
    "version": "1.0.181-main-mainnet",
    "contact": {}
  },
  "servers": [
    {
      "url": "https://gw-1.api.standardvalidator.com"
    }
  ],
  "components": {
    "schemas": {
      "ApiResponseBase": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        }
      },
      "ApiRoles": {
        "type": "object",
        "properties": {
          "admin": {
            "type": "boolean",
            "description": "Full access to all operations"
          },
          "staker": {
            "type": "boolean",
            "description": "Access to everything except team member management and API key management"
          },
          "reader": {
            "type": "boolean",
            "description": "Read-only access across all staking networks"
          }
        }
      },
      "IpRestrictionDto": {
        "type": "object",
        "properties": {
          "allowedCidrs": {
            "description": "List of allowed CIDR ranges (IPv4 and IPv6 supported). Singular IPs must be encoded as host CIDRs (IPv4 /32, IPv6 /128).",
            "example": [
              "192.168.1.0/24",
              "10.0.0.50/32",
              "2001:db8::/32",
              "::1/128"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "allowedCidrs"
        ]
      },
      "IpRestrictionConfigDto": {
        "type": "object",
        "properties": {
          "restrictions": {
            "description": "IP restriction rules",
            "allOf": [
              {
                "$ref": "#/components/schemas/IpRestrictionDto"
              }
            ]
          }
        },
        "required": [
          "restrictions"
        ]
      },
      "CreatedApiKeyDto": {
        "type": "object",
        "properties": {
          "keyId": {
            "type": "string",
            "example": "66f181818181818181818181",
            "description": "Internal id of the API key"
          },
          "name": {
            "type": "string",
            "example": "Default API Key"
          },
          "keyPrefix": {
            "type": "string",
            "example": "sk-mainnet-",
            "description": "Literal visible prefix of the raw key, e.g. \"sk-mainnet-\". Empty string for legacy (pre-hashing) keys."
          },
          "keyLast4": {
            "type": "string",
            "example": "cb0a",
            "description": "Last 4 characters of the raw key, for masked display."
          },
          "expiresAt": {
            "type": "object",
            "nullable": true,
            "description": "Expiration timestamp. Null/absent means the key never expires."
          },
          "deletedAt": {
            "format": "date-time",
            "type": "string"
          },
          "roles": {
            "$ref": "#/components/schemas/ApiRoles"
          },
          "ipRestrictions": {
            "description": "IP restrictions for this API key",
            "allOf": [
              {
                "$ref": "#/components/schemas/IpRestrictionConfigDto"
              }
            ]
          },
          "key": {
            "type": "string",
            "example": "sk-mainnet-0b381d39-43b4-480f-b3c9-f3ff3d19cb0a",
            "description": "The full raw API key. Shown exactly once - on creation - and never retrievable again."
          }
        },
        "required": [
          "keyId",
          "name",
          "keyPrefix",
          "keyLast4",
          "roles",
          "key"
        ]
      },
      "CreateApiKeyDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "Default API Key"
          },
          "roles": {
            "$ref": "#/components/schemas/ApiRoles"
          },
          "ipRestrictions": {
            "description": "IP restriction configuration for the API key",
            "allOf": [
              {
                "$ref": "#/components/schemas/IpRestrictionConfigDto"
              }
            ]
          },
          "expiresAt": {
            "type": "object",
            "description": "Optional expiration timestamp (ISO-8601). Omit or pass null for a key that never expires.",
            "example": "2027-01-01T00:00:00.000Z",
            "nullable": true
          }
        },
        "required": [
          "name"
        ]
      }
    }
  }
}
```