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

> ## Agent Instructions
> Call https://api.feyn.ai only; the hosts behind it are not public.
> Authenticate with a workspace API key in the Authorization header: `Authorization: Bearer fn_...`. Keep keys server-side.
> For chat completions, use the official OpenAI SDK with base_url https://api.feyn.ai/v1 and a model ID from GET /v1/models.
> On 429, wait for the Retry-After header before retrying. Failed requests are not charged.

# Write a score

> Upsert a named value on a trace.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/scores
openapi: 3.1.0
info:
  title: Feyn API
  version: 1.0.0
  description: Fine-tuned models, chat completions, traces and scores on api.feyn.ai.
servers:
  - url: https://api.feyn.ai
security:
  - bearerAuth: []
paths:
  /v1/scores:
    post:
      summary: Write a score
      description: Upsert a named value on a trace.
      parameters:
        - name: X-Feyn-Project
          in: header
          required: true
          description: The project's key (`projectKey`).
          schema:
            type: string
          example: inbox-triage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - traceKey
                - name
                - value
              properties:
                traceKey:
                  type: string
                  description: The trace's `traceKey`.
                name:
                  type: string
                  description: A score name defined on the project.
                value:
                  oneOf:
                    - type: number
                    - type: string
                    - type: boolean
                  description: Must match the score's type.
            example:
              traceKey: run_123:decide
              name: notify
              value: true
      responses:
        '201':
          $ref: '#/components/responses/Id'
        '400':
          $ref: '#/components/responses/Error'
        '401':
          $ref: '#/components/responses/Error'
        '503':
          $ref: '#/components/responses/Error'
components:
  responses:
    Id:
      description: The stored row's id.
      content:
        application/json:
          schema:
            type: object
            properties:
              id:
                type: string
    Error:
      description: An error. See the errors guide for each status.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
              enum:
                - invalid_request_error
                - auth_error
                - billing_error
                - permission_error
                - rate_limit_error
                - api_error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A workspace API key (`fn_...`).

````

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