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

# Verify an email code

> Sends the code from the email and the `code_token` from `request_code`. On success the
email becomes the verified notification email of the account.

- Who may call: anyone who holds the code token and the code. No sign-in is
  necessary, because the code token came back sealed to the owner who asked.
- Before: a `code_issued` reply from `request_code`. Seal `code_token` and `code`
  under `anafi/notification-email/verify-code/<network>/` plus the 20 address bytes
  of `aa`.
- Guarantee: the opened reply has an `outcome`. A code token allows 3 wrong codes.
  After that, or after 15 minutes, request a new code.




## OpenAPI

````yaml /api/openapi.yaml post /api/wallets/{aa}/notification_email/verify_code
openapi: 3.1.0
info:
  title: Anafi API
  version: 0.3.0
  summary: The public HTTP API of one Anafi network.
  description: >
    The Anafi API is the HTTP surface of one Anafi network. Each network has its
    own host.

    The public TypeScript SDK `@anafi-cc/anafi-sdk` calls these routes for you,
    and it also

    builds and checks the signed and sealed payloads. You can call the routes
    directly.


    - No API key is necessary today.

    - Request and response bodies are JSON, except where an operation says
    otherwise.

    - A route that carries a confidential payload takes an HPKE-sealed envelope.
    Read
      [Sealed requests](/api-reference/sealed-requests) before you call it without the SDK.
    - Read [Introduction](/api-reference/introduction) for formats and
      [Errors](/api-reference/errors) for the error bodies.

    Browser origin: the API hosts answer CORS only for `https://app.ana.fi`
    today. A browser

    page on another origin cannot call the API directly. A server, a script, or
    your own

    same-origin proxy can call it.
servers:
  - url: https://api.polygon.ana.fi
    description: Polygon PoS (chain id 137)
  - url: https://api.xlayer.ana.fi
    description: X Layer (chain id 196)
  - url: https://api.polygon-amoy.ana.fi
    description: Polygon Amoy testnet (chain id 80002)
security: []
tags:
  - name: Accounts
    description: >-
      Find the accounts of an owner address, and deploy the 1-of-1 Safe of an
      owner.
  - name: Safe relay
    description: Submit an owner-signed Safe transaction. Anafi pays the gas.
  - name: Rules
    description: >-
      Stage a sealed rule document. The engine returns the attestation for the
      on-chain commit.
  - name: Confidential channel
    description: >-
      Read back the rule document and the account state of an account through a
      sealed channel.
  - name: Notification email
    description: Verify the email address that rule notifications go to.
  - name: Activity
    description: Read the payments that the engine made for an account.
  - name: Fees
    description: Read the fee terms of the network and the sponsorship of an account.
  - name: Payments
    description: Ask for the email receipt of a payment made on the pay page.
  - name: Rule language
    description: >-
      Read the rule language reference, and write a rule document from a
      description.
  - name: Bank payouts
    description: >
      Connect a Safe to Monerium for bank payouts in euro, and read the state of
      the

      connection and of the orders. These routes are served only on
      `polygon-amoy`

      (Monerium sandbox). The `polygon` and `xlayer` hosts answer `404`.
  - name: Status
    description: Check that the Anafi API answers.
paths:
  /api/wallets/{aa}/notification_email/verify_code:
    post:
      tags:
        - Notification email
      summary: Verify an email code
      description: >
        Sends the code from the email and the `code_token` from `request_code`.
        On success the

        email becomes the verified notification email of the account.


        - Who may call: anyone who holds the code token and the code. No sign-in
        is
          necessary, because the code token came back sealed to the owner who asked.
        - Before: a `code_issued` reply from `request_code`. Seal `code_token`
        and `code`
          under `anafi/notification-email/verify-code/<network>/` plus the 20 address bytes
          of `aa`.
        - Guarantee: the opened reply has an `outcome`. A code token allows 3
        wrong codes.
          After that, or after 15 minutes, request a new code.
      operationId: verifyNotificationEmailCode
      parameters:
        - $ref: '#/components/parameters/AccountPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SealedRelayRequest'
      responses:
        '200':
          description: The sealed reply. Open it with the response key of your request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SealedResponse'
        '400':
          $ref: '#/components/responses/InvalidPathOrJson'
        '413':
          $ref: '#/components/responses/BodyTooLarge'
        '415':
          $ref: '#/components/responses/MissingJsonContentType'
        '422':
          description: >-
            The envelope or its payload did not open under the `info` tag of
            this network and this `aa`. A plain-text body from the Anafi API
            means that a JSON field is missing or has the wrong type.
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/PlainTextError'
              example: could not open the notification-email request
        '500':
          description: >-
            The engine could not store the result or seal the reply. Try again
            later.
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/PlainTextError'
        '502':
          description: The engine could not be reached. Try again later.
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/PlainTextError'
              example: engine unreachable
components:
  parameters:
    AccountPath:
      name: aa
      in: path
      required: true
      description: >-
        The account address (a Safe or a plain address), as `0x` and 40 hex
        digits in any letter case.
      schema:
        $ref: '#/components/schemas/Address'
      example: '0xf9836de53d455019ed985896fce8af80be66b7f9'
  schemas:
    SealedRelayRequest:
      type: object
      description: >-
        The body of every route that carries a sealed request. The Anafi API
        passes `sealed` to the engine unchanged and takes the account from the
        path.
      required:
        - sealed
      properties:
        sealed:
          $ref: '#/components/schemas/SealedEnvelope'
    SealedResponse:
      type: object
      description: >
        A reply sealed with ChaCha20-Poly1305 under the response key that the
        caller

        exported from the HPKE context of the request. Each field is a JSON
        array of byte

        values. See [Sealed requests](/api-reference/sealed-requests).
      required:
        - nonce
        - ct
      properties:
        nonce:
          type: array
          description: The 12-byte AEAD nonce.
          minItems: 12
          maxItems: 12
          items:
            type: integer
            minimum: 0
            maximum: 255
        ct:
          type: array
          description: The ciphertext with its 16-byte AEAD tag.
          minItems: 16
          items:
            type: integer
            minimum: 0
            maximum: 255
    PlainTextError:
      type: string
      description: >-
        A short English sentence. Show it or log it. Do not parse it; branch on
        the status code.
    Address:
      type: string
      pattern: ^0x[0-9a-fA-F]{40}$
      description: >-
        A 20-byte address as `0x` and 40 hex digits. Requests accept any letter
        case. Responses use lowercase.
      examples:
        - '0xf9836de53d455019ed985896fce8af80be66b7f9'
    SealedEnvelope:
      type: object
      description: >
        An HPKE-sealed request. Each field is a JSON array of byte values
        (integers from 0 to

        255), not a hex string. The key names are snake_case. See

        [Sealed requests](/api-reference/sealed-requests).
      required:
        - kem_pk
        - ct
      additionalProperties: false
      properties:
        kem_pk:
          type: array
          description: >-
            The encapsulated key of the sender, an ephemeral X25519 public key
            of 32 bytes.
          minItems: 32
          maxItems: 32
          items:
            type: integer
            minimum: 0
            maximum: 255
        ct:
          type: array
          description: >-
            The ciphertext, which is the sealed payload and the 16-byte AEAD
            tag.
          minItems: 16
          items:
            type: integer
            minimum: 0
            maximum: 255
  responses:
    InvalidPathOrJson:
      description: The `aa` path segment is not an address, or the body is not valid JSON.
      content:
        text/plain:
          schema:
            $ref: '#/components/schemas/PlainTextError'
          example: >-
            Failed to parse the request body as JSON: EOF while parsing an
            object at line 1 column 1
    BodyTooLarge:
      description: >-
        The body is larger than the limit of the route. The limit is 2 MB for
        `POST /api/dsl/generate` and the bank payout routes, and 512 KiB for all
        other routes.
      content:
        text/plain:
          schema:
            $ref: '#/components/schemas/PlainTextError'
    MissingJsonContentType:
      description: 'The request has no `Content-Type: application/json` header.'
      content:
        text/plain:
          schema:
            $ref: '#/components/schemas/PlainTextError'
          example: 'Expected request with `Content-Type: application/json`'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.