> ## Documentation Index
> Fetch the complete documentation index at: https://docs.namespace.ninja/llms.txt
> Use this file to discover all available pages before exploring further.

# Create or update a subname

> Creates or updates an offchain subname under a parent ENS name. Requires a valid API key.



## OpenAPI

````yaml /openapi/offchain-openapi.json POST /api/v1/subnames
openapi: 3.0.0
info:
  title: Offchain Subnames API
  description: >-
    API for managing offchain subnames. Provides endpoints for authentication,
    subname management, and statistics.
  version: 1.0.0
  contact:
    name: Namespace
    url: https://namespace.ninja
    email: cap@namespace.ninja
  termsOfService: https://namespace.ninja/tos
servers:
  - url: https://offchain-manager.namespace.ninja
    description: Production
  - url: https://staging.offchain-manager.namespace.ninja
    description: Staging
security: []
tags:
  - name: Subnames
    description: ''
paths:
  /api/v1/subnames:
    post:
      tags:
        - Subnames
      summary: Create or update a subname
      description: >-
        Creates or updates an offchain subname under a parent ENS name. Requires
        a valid API key.
      operationId: SubnameNodeController_createSubname
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSubnameRequest'
            examples:
              minimal:
                summary: Minimal example
                value:
                  parentName: oppunk.eth
                  label: alice
                  owner: 0x1234...abcd
      responses:
        '201':
          description: Subname created or updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSubnameResponseDto'
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                example:
                  statusCode: 400
                  message: >-
                    Validation failed: parentName or parentNames must be
                    provided
                  error: Bad Request
        '401':
          description: Missing or invalid API key
        '409':
          description: Subname already exists
        '500':
          description: Unexpected error
      security:
        - x-auth-token: []
components:
  schemas:
    CreateSubnameRequest:
      type: object
      properties:
        parentName:
          type: string
          description: Parent ENS name (e.g., oppunk.eth)
          minLength: 7
          maxLength: 255
          example: oppunk.eth
        label:
          type: string
          description: Subname label (e.g., alice if full name is alice.oppunk.eth)
          minLength: 1
          maxLength: 255
          example: alice
        texts:
          description: Text records to set on the subname
          example:
            - key: email
              value: alice@example.com
          type: array
          items:
            $ref: '#/components/schemas/KeyValueRequest'
        addresses:
          description: Address records to set on the subname
          example:
            - coin: 60
              value: 0x1234...abcd
          type: array
          items:
            $ref: '#/components/schemas/AddressRecordRequest'
        metadata:
          description: Arbitrary metadata stored offchain or in ENS records
          example:
            - key: role
              value: admin
          type: array
          items:
            $ref: '#/components/schemas/KeyValueRequest'
        owner:
          type: string
          description: Address of the new subname owner (must be a valid Ethereum address)
          example: 0x1234...abcd
        contenthash:
          type: string
          description: Contenthash (e.g., for IPFS/IPNS/Skynet)
          example: ipfs://0xe30101701220eec561a728cb61c29cfae...
        ttl:
          type: number
          description: TTL value in seconds
          example: 3600
      required:
        - parentName
        - label
    GetSubnameResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the subname
          example: '123'
        fullName:
          type: string
          description: Full name of the subname (e.g., alice.oppunk.eth)
          example: alice.oppunk.eth
        parentName:
          type: string
          description: Parent name (e.g., oppunk.eth)
          example: oppunk.eth
        label:
          type: string
          description: Label of the subname (e.g., alice)
          example: alice
        texts:
          type: object
          description: Text records associated with the subname
          example:
            email: alice@example.com
        addresses:
          type: object
          description: Address records associated with the subname
          example:
            ETH: 0x1234...abcd
        metadata:
          type: object
          description: Metadata associated with the subname
          example:
            role: admin
        contenthash:
          type: string
          description: Content hash of the subname
          example: ipfs://Qm...
        namehash:
          type: string
          description: Namehash of the subname
          example: 0xabc123...
      required:
        - id
        - fullName
        - parentName
        - label
        - texts
        - addresses
        - metadata
        - namehash
    KeyValueRequest:
      type: object
      properties:
        key:
          type: string
          minLength: 1
          maxLength: 255
          description: Text key
          example: email
        value:
          type: string
          minLength: 1
          maxLength: 2000
          description: Text value
          example: alice@example.com
      required:
        - key
        - value
    AddressRecordRequest:
      type: object
      properties:
        coin:
          type: number
          description: Coin type (e.g., 60 for ETH)
          example: 60
        value:
          type: string
          description: Coin-specific address string
          minLength: 5
          maxLength: 255
          example: 0x1234...abcd
      required:
        - coin
        - value
  securitySchemes:
    x-auth-token:
      type: apiKey
      in: header
      name: x-auth-token

````