openapi: 3.0.0
info:
  title: Unkey API
  version: 1.0.0
servers:
  - url: https://api.unkey.dev
  - url: http://localhost
paths:
  /v0/events:
    post:
      operationId: v0.events.create
      summary: Create events
      description: Accept NDJSON payload of events and process them
      requestBody:
        content:
          application/x-ndjson:
            schema:
              $ref: '#/components/schemas/V0EventsRequestBody'
        required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V0EventsResponseBody'
        '400':
          description: Bad request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/BaseError'
          description: Error
      tags:
        - events
components:
  schemas:
    BaseError:
      properties:
        requestId:
          description: A unique id for this request. Please always provide this to support.
          example: req_123
          type: string
        detail:
          description: A human-readable explanation specific to this occurrence of the problem.
          example: Property foo is required but is missing.
          type: string
        instance:
          description: A URI reference that identifies the specific occurrence of the problem.
          example: https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          example: 400
          format: int
          type: integer
        title:
          description: A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
          example: Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          example: https://example.com/errors/example
          format: uri
          type: string
      type: object
      required:
        - requestId
        - detail
        - instance
        - status
        - title
        - type
    ValidationError:
      additionalProperties: false
      properties:
        requestId:
          description: A unique id for this request. Please always provide this to support.
          example: req_123
          type: string
        detail:
          description: A human-readable explanation specific to this occurrence of the problem.
          example: Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ValidationErrorDetail'
          type:
            - array
        instance:
          description: A URI reference that identifies the specific occurrence of the problem.
          example: https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          example: 400
          format: int
          type: integer
        title:
          description: A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
          example: Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          example: https://example.com/errors/example
          format: uri
          type: string
      type: object
      required:
        - requestId
        - detail
        - instance
        - status
        - title
        - type
        - errors
    ValidationErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        fix:
          description: A human-readable message describing how to fix the error.
          type: string
      type: object
      required:
        - message
        - location
    V0EventsResponseBody:
      type: object
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          example: https://api.unkey.dev/schemas/V0EventsResponseBody.json
          format: uri
          readOnly: true
          type: string
        successful_rows:
          type: integer
          description: The number of rows that were successfully processed
        quarantined_rows:
          type: integer
          description: The number of rows that were quarantined
      required:
        - successful_rows
        - quarantined_rows
    V0EventsRequestBody:
      type: string
      description: NDJSON payload of events

---
Let's break down what we need to implement:

1. The route is POST /v0/events with NDJSON content type
2. It accepts a string payload (V0EventsRequestBody)
3. It returns V0EventsResponseBody on success
4. It can return ValidationError or BaseError on failure
5. We need to handle the special NDJSON content type
6. We'll need to add proper error handling for different status codes

Here's the implementation:

```python:client.py
# ... existing code ...

class ExampleClientAsync:
    # ... existing code ...

    # POST /v0/events - tags: events
    async def create_events(self, payload: str) -> Types.V0EventsResponseBody:
        """
        Create events by sending NDJSON payload.
        
        Args:
            payload: NDJSON formatted string of events
            
        Returns:
            V0EventsResponseBody: Response containing processing statistics
            
        Raises:
            ExampleError: If the request fails with status code 400 or 500
        """
        headers = {"Content-Type": "application/x-ndjson"}
        response = await self.fetch(
            method="POST",
            path="/v0/events",
            body=payload,
            headers=headers
        )
        
        if response.status == 200:
            return Types.V0EventsResponseBody(**await response.json())
        elif response.status == 400:
            error_data = await response.json()
            raise ExampleError(
                error="Validation Error",
                status=400,
                data=Types.ValidationError(**error_data)
            )
        elif response.status == 500:
            error_data = await response.json()
            raise ExampleError(
                error="Server Error",
                status=500,
                data=Types.BaseError(**error_data)
            )
        else:
            raise ExampleError(
                error=f"Unexpected status code: {response.status}",
                status=response.status,
                data=await response.text()
            )

# ... existing code ...
```