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

# Map

> Scrape the list of pages on a website. Send one request and get JSON back. Examples in cURL, TypeScript and Python. A failed call costs nothing.

Best for finding the right page on a site before reading it with scrape. Add search to rank pages about one topic first.

> [!NOTE]
>
> Works without an API key, up to 10 calls a minute and 50 a day per IP. See [Rate limits](https://docs.stophy.dev/rate-limits.md).

## Price

1 credit per call.

See [Pricing](https://docs.stophy.dev/billing.md) for what credits cost.

```bash cURL theme={null}
curl -X POST https://api.stophy.dev/v1/map \
  -H "Authorization: Bearer $STOPHY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://bun.com","search":"sqlite"}'
```

```typescript TypeScript theme={null}
const response = await fetch("https://api.stophy.dev/v1/map", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.STOPHY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ url: "https://bun.com", search: "sqlite" }),
});
console.log(await response.json());
```

```python Python theme={null}
import os

import requests

response = requests.post(
    "https://api.stophy.dev/v1/map",
    headers={"Authorization": f"Bearer {os.environ['STOPHY_API_KEY']}"},
    json={"url": "https://bun.com", "search": "sqlite"},
)
print(response.json())
```

```json 200 theme={null}
{
  "success": true,
  "links": [
    {
      "url": "https://bun.com/reference/node/sqlite/constants/SQLITE_ANALYZE"
    }
  ]
}
```


## OpenAPI

````yaml api-reference/openapi.json POST /v1/map
openapi: 3.1.0
info:
  title: Stophy API
  version: '1'
  description: >-
    Every endpoint is a POST that takes its input as a JSON object body. Unknown
    fields are rejected with 400.


    Responses leave out empty values: null, empty strings, empty objects and
    empty nested lists are not sent.


    Text comes back whole. To get shorter responses, add
    ?maxTextLength=<characters> to the URL. Every text value longer than that is
    cut and ends with …. A screenshot is never cut, and a page whose text was
    cut has isTruncated set to true.


    x-credits is what one call costs. Every call costs the same, whatever it
    returns, unless an operation's description says it costs per 10 results, or
    per second of audio. Then x-credits is the lowest price and x-credits-max
    the most one call can cost. Where an operation takes limit, send it to
    return fewer results and pay for fewer.


    When a response has a cursor, send it back unchanged with the same input to
    get the next page. When it has a page, send the next page number.
servers:
  - url: https://api.stophy.dev
security:
  - apiKey: []
paths:
  /v1/map:
    post:
      summary: Scrape the list of pages on a website
      description: Costs 1 credit per call.
      operationId: map
      parameters:
        - $ref: '#/components/parameters/MaxTextLength'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  description: Any page of the site to map, such as https://bun.com.
                  type: string
                search:
                  description: >-
                    Keep only addresses that mention these words, best matches
                    first, such as pricing.
                  type: string
                  minLength: 1
                sitemap:
                  default: include
                  description: >-
                    include uses the site's sitemaps and its pages. only lists
                    just what the sitemaps name. skip ignores the sitemaps.
                  type: string
                  enum:
                    - skip
                    - include
                    - only
                includeSubdomains:
                  default: true
                  description: >-
                    Also list pages on subdomains, such as docs.bun.com for
                    bun.com.
                  type: boolean
                ignoreQueryParameters:
                  default: true
                  description: List each page once, without its ?query part.
                  type: boolean
                ignoreCache:
                  default: false
                  description: >-
                    Send true to build the list again instead of reusing one
                    made in the last 6 hours.
                  type: boolean
                limit:
                  default: 5000
                  description: The most addresses to return, up to 100000.
                  type: integer
                  minimum: 1
                  maximum: 100000
                timeout:
                  description: >-
                    Stop looking after this many milliseconds and return what
                    was found.
                  type: integer
                  minimum: 1000
                  maximum: 9007199254740991
                location:
                  type: object
                  properties:
                    country:
                      type: string
                    languages:
                      not: {}
                  additionalProperties: false
                auditMetadata:
                  not: {}
                threatProtection:
                  not: {}
              required:
                - url
              additionalProperties: false
            example:
              url: https://bun.com
              search: sqlite
      responses:
        '200':
          description: The data, and the credits this call used.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/RequestId'
            x-credits-used:
              $ref: '#/components/headers/CreditsUsed'
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            x-cache:
              $ref: '#/components/headers/Cache'
            x-cache-age:
              $ref: '#/components/headers/CacheAge'
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  success:
                    type: boolean
                    const: true
                  links:
                    type: array
                    items:
                      type: object
                      additionalProperties: false
                      properties:
                        url:
                          type: string
                        title:
                          type: string
                      required: []
                required:
                  - success
                  - links
        4XX:
          $ref: '#/components/responses/Error'
        5XX:
          $ref: '#/components/responses/Error'
      security:
        - apiKey: []
components:
  parameters:
    MaxTextLength:
      name: maxTextLength
      in: query
      required: false
      description: >-
        Cut every text value in the response to this many characters. A value
        that was cut ends with …, and a page whose text was cut has isTruncated
        set to true. A screenshot is never cut. Leave it out to get the full
        text.
      schema:
        type: integer
        minimum: 1
  headers:
    RequestId:
      description: The request id. Quote it when you report a problem.
      schema:
        type: string
    CreditsUsed:
      description: Credits this call used.
      schema:
        type: integer
    RateLimitLimit:
      description: Requests allowed in the current window.
      schema:
        type: integer
    RateLimitRemaining:
      description: Requests left in the current window.
      schema:
        type: integer
    RateLimitReset:
      description: Unix time in seconds when the current window resets.
      schema:
        type: integer
    Cache:
      description: hit if this result came from the cache, miss if it was fetched live.
      schema:
        type: string
    CacheAge:
      description: Seconds since the returned result was written to the cache.
      schema:
        type: integer
    RetryAfter:
      description: Seconds to wait before retrying.
      schema:
        type: integer
  responses:
    Error:
      description: The request failed. Retry-After says when trying again can help.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/RequestId'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - success
        - error
        - code
      properties:
        success:
          const: false
        error:
          type: string
          description: What went wrong and what to do next.
        code:
          type: string
          enum:
            - apiKeyRequired
            - cliSessionCompleted
            - cliSessionExists
            - cliSessionNotFound
            - forbidden
            - freeLimit
            - insufficientCredits
            - internalError
            - inviteClaimed
            - inviteDisabled
            - inviteExpired
            - inviteUsedUp
            - invalidCliSession
            - invalidCliVerifier
            - invalidRequest
            - jobFinished
            - methodNotAllowed
            - notFound
            - payloadTooLarge
            - profileBusy
            - profileTooLarge
            - rateLimited
            - sourceChanged
            - sourceRefused
            - siteNotRead
            - sourceTimeout
            - sourceUnavailable
            - unauthorized
            - unsupportedMediaType
        retryAfterSeconds:
          type: integer
        signupUrl:
          type: string
          const: https://stophy.dev/signup
          description: >-
            Where a person gets a key. Sent with apiKeyRequired, freeLimit and
            an invalid key.
        signup:
          type: string
          const: POST https://api.stophy.dev/v1/signup
          description: >-
            The call that gets an agent a key with no human. Sent next to
            signupUrl.
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer

````

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