Try the API in your browser
l2pscan.com/api-docs is the live reference for the explorer API. Every endpoint is listed with its parameters and the exact shape of its answer, and each one can be called right there, against the real chain, without writing a line of code.
Nothing on the API can change anything: every operation is a read. You can press any button on that page safely.
Pick the document first
There are two, and the selector at the top switches between them.
REST API is the one you want for new work. Etherscan compatible is the mirror of the Etherscan API, for pointing existing tooling at this chain. They cover the same data in different shapes, so choose the one you intend to build against before you start experimenting.
The explorer API explains the difference in full.
Sending a request
Choose an endpoint from the list on the left. The page shows what it takes and what it returns, with an example response, and a panel where you can fill in the values and send the request.
Fill in the path values first, such as a block number or an address, then any options you want. When you send it, the response you get back is the real answer from the real chain, not a canned sample.
From there you can copy the call as a curl command, or as code for the language you are working in, and paste it straight into your own project.
Where the options go
The paging and filter options are query parameters, appended to the url:
curl -s 'https://l2pscan.com/api/explorer/transactions?take=5&succeeded=false'
If the panel offers you a request body for one of these endpoints, ignore it. Nothing is read from a body on a GET. Put the values in the query string, exactly as in the examples on The explorer API, and the generated curl command will match what actually works.
Finding your bearings
Two calls worth making first, because they tell you whether everything else you see is current.
/api/explorer/status returns the last block the explorer indexed, the chain head and how many blocks lie between them. If that gap is large, the data behind every other endpoint is that far behind as well.
/api/explorer/blocks?take=1 returns the newest block the explorer knows about, which is the quickest sanity check that your request is reaching the right chain.