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

# Logs a checkout

> Logs a checkout event in stats logs. That is the event for when a
customer complete a checkout. The info of the items that were in
her session when she completes the checkout are logged in the event.




## OpenAPI

````yaml /openapi/search-v6.yaml put /6/{hashid}/stats/checkout
openapi: 3.0.0
info:
  title: Search API
  contact:
    name: Doofinder Support
    url: https://docs.doofinder.com/
  version: '6.0'
  description: >
    # Introduction

    Search API allows you to perform the search requests you can do on your
    search

    engines using the doofinder layer, directly from your code.

    # Basics

    ## Endpoint

    All requests should be done with `https` protocol in our api location.

    `https://{search_zone}-search.doofinder.com`

    where `{search_zone}` depends on your location, is the geographic zone your
    search engine is located at.

    i.e.: eu1. Also, indicates which host to use in your API calls.

    ## Authentication

    The authentication method for search API requires an api key that could be
    obtained in our

    [management control panel](https://admin.doofinder.com).

    You can generate it in your user account -> Api Keys.

    Example of the generated API Key:

    `eu1-ab46030xza33960aac71a10248489b6c26172f07`

    ### API Token

    You could authenticate with the previous API key in header as a Token. The
    correct way to authenticate is

    to send a HTTP Header with the name `Authorization` and the value `Token
    <API Key>`

    For example, for the key shown above:

    `Authorization: Token eu1-ab46030xza33960aac71a10248489b6c26172f07`

    ## Conventions

    Along most of the code samples you will find placeholders for some common
    variable values. They are:

    - `{hashid}`: The search engine's unique id. i.e.:
    d8fdeab7fce96a19d3fc7b0ca7a1e98b

    - `{token}`: Your personal authentication token obtained in the control
    panel.

    - `{index}`: The index of the data you're searching at. i.e.: product

    - `{id}`: Unique identification of a resource. i.e.: 1234 or HVIUYC
  termsOfService: https://www.doofinder.com/es/terms-and-conditions
  x-logo:
    url: https://admin.doofinder.com/images/logo.svg
    backgroundColor: '#33268C'
    altText: Doofinder Search Engine
servers:
  - url: https://{search_zone}-search.doofinder.com
    variables:
      search_zone:
        enum:
          - eu1
          - us1
          - ap1
        default: eu1
  - url: /
security:
  - api_token: []
tags:
  - name: Search
    description: Search operations.
  - name: Session & Events
    description: Stats operations.
paths:
  /6/{hashid}/stats/checkout:
    put:
      tags:
        - Session & Events
      summary: Logs a checkout
      description: |
        Logs a checkout event in stats logs. That is the event for when a
        customer complete a checkout. The info of the items that were in
        her session when she completes the checkout are logged in the event.
      operationId: checkout_stats
      parameters:
        - $ref: '#/components/parameters/hashid'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LogCheckoutRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatsResponse'
        '400':
          description: >-
            Bad Request — session_id exceeds 32 characters, user_id exceeds 36
            characters, or other validation failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_session_id:
                  summary: session_id too long
                  value:
                    error: session_id should have 32 characters or less
                invalid_user_id:
                  summary: user_id too long
                  value:
                    error: invalid_user_id
                bad_request:
                  summary: Generic validation failure
                  value:
                    error: Bad request
        '403':
          description: >-
            Forbidden — missing or invalid API token, client IP is blocked, or
            CORS `Origin` not allowed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: Missing or invalid API token
                  value:
                    error: forbidden
                banned_ip:
                  summary: Client IP is blocked
                  value:
                    error: banned ip
      deprecated: true
components:
  parameters:
    hashid:
      name: hashid
      in: path
      description: Unique id of a search engine.
      required: true
      schema:
        type: string
  schemas:
    LogCheckoutRequest:
      type: object
      properties:
        session_id:
          $ref: '#/components/schemas/session_id'
        user_id:
          $ref: '#/components/schemas/user_id'
        sources:
          $ref: '#/components/schemas/checkout_sources'
      required:
        - session_id
    StatsResponse:
      title: Stats Response
      description: Response returned over register stat operation.
      type: object
      properties:
        status:
          description: Result of the stats request. i.e. 'registered'
          type: string
      example:
        status: registered
    ErrorResponse:
      type: object
      description: Standard error response returned on all non-200 outcomes.
      properties:
        error:
          type: string
          description: Human-readable error message.
      required:
        - error
    session_id:
      type: string
      description: Identifier of search session
      maxLength: 32
    user_id:
      type: string
      description: Identifier of user
      maxLength: 36
    checkout_sources:
      type: array
      description: >-
        a list with the javascript apps that can be considered "source" of that
        checkout
      items:
        type: string
  securitySchemes:
    api_token:
      type: apiKey
      description: |
        Doofinder API key. Pass it as:
        Authorization: Token <api_key>
      name: Authorization
      in: header

````