# List events (/docs/api/events/list-events)

Events in the order they became visible. Store next_cursor and pass it as after to poll; no event is ever skipped. With resource_id the list is the story of one resource, oldest first: every status it went through, from its creation to its outcome. Filters combine, and the cursor works the same with them.

The operation, from the OpenAPI contract (https://docs.caibopay.app/openapi.json):

```json

{
  "method": "GET",
  "path": "/v1/events",
  "description": "Events in the order they became visible. Store next_cursor and pass it as after to poll; no event is ever skipped. With resource_id the list is the story of one resource, oldest first: every status it went through, from its creation to its outcome. Filters combine, and the cursor works the same with them.",
  "operationId": "listEvents",
  "parameters": [
    {
      "description": "Maximum number of items to return.",
      "in": "query",
      "name": "limit",
      "required": false,
      "schema": {
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      }
    },
    {
      "description": "The next_cursor of the previous page.",
      "in": "query",
      "name": "after",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Only events of this type (payout.completed), or of this family of types when it ends in a dot (payout.). A type the platform does not publish is a 400.",
      "in": "query",
      "name": "type",
      "required": false,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Only events about this resource, by its id: a payout, a pay-in, a funding account, a refund, a withdrawal, a remittance, a settlement, a customer, a beneficiary, a payout batch, a reconciliation exception, a risk decision or a webhook endpoint.",
      "in": "query",
      "name": "resource_id",
      "required": false,
      "schema": {
        "pattern": "^[a-z]+_[0-9a-z]+$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "data": {
                "items": {
                  "$ref": "#/components/schemas/Event"
                },
                "type": "array"
              },
              "has_more": {
                "type": "boolean"
              },
              "next_cursor": {
                "type": "string"
              }
            },
            "required": [
              "data",
              "has_more"
            ],
            "type": "object"
          }
        }
      },
      "description": "OK"
    },
    "400": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "The request is not valid."
    },
    "401": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "The API key is missing or not valid."
    },
    "403": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "The API key lacks the required scope."
    },
    "429": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Too many requests."
    },
    "500": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "An error on our side. Safe to retry with the same Idempotency-Key."
    },
    "503": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Temporarily unavailable or suspended. Safe to retry with the same Idempotency-Key."
    }
  },
  "summary": "List events",
  "tags": [
    "Events"
  ],
  "x-required-scope": "read",
  "x-codeSamples": [
    {
      "lang": "js",
      "label": "Node.js",
      "source": "import { Caibo } from \"caibopay\";\n\nconst caibo = new Caibo(process.env.CAIBO_API_KEY);\n\nfor await (const item of caibo.events.list()) {\n  console.log(item);\n}"
    },
    {
      "lang": "python",
      "label": "Python",
      "source": "import os\n\nimport caibopay\n\nclient = caibopay.Client(os.environ[\"CAIBO_API_KEY\"])\n\nfor item in client.events.list():\n    print(item)"
    },
    {
      "lang": "go",
      "label": "Go",
      "source": "client, err := caibopay.NewClient(os.Getenv(\"CAIBO_API_KEY\"))\nif err != nil {\n\treturn err\n}\nctx := context.Background()\n\nfor item, err := range client.Events.ListAll(ctx, nil) {\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(item)\n}"
    }
  ]
}

```