{
  "openapi": "3.0.3",
  "info": {
    "title": "Maps API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.olostep.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "Authorization": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer authentication header of the form Bearer <token>, where <token> is your auth token."
      }
    }
  },
  "paths": {
    "/v1/maps/{map_id}": {
      "get": {
        "summary": "Get Map",
        "description": "Retrieve a previously completed map by its ID.",
        "security": [
          {
            "Authorization": []
          }
        ],
        "parameters": [
          {
            "name": "map_id",
            "in": "path",
            "required": true,
            "description": "Unique identifier for the map to be retrieved.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with the map object.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Unique identifier for this map"
                    },
                    "urls_count": {
                      "type": "integer",
                      "description": "Number of URLs in the current response"
                    },
                    "urls": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Array of URLs found on the page"
                    },
                    "cursor": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pagination cursor to retrieve the next set of URLs. If null, all URLs have been retrieved."
                    },
                    "credits_consumed": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Number of credits consumed by this request. Populated after execution completes. Credits are the source of truth for billing."
                    },
                    "cost_usd": {
                      "type": "number",
                      "nullable": true,
                      "description": "Estimated cost in USD for this request. Populated after execution completes. Calculated from credits consumed and your plan rate \u2014 99% accurate, but credits_consumed is the authoritative value."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid API Key"
          },
          "404": {
            "description": "Map Not Found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/v1/maps": {
      "post": {
        "summary": "Get all the urls on a certain website",
        "description": "This endpoint allows users to get all the urls on a certain website. It can take up to 120 seconds for complex websites. For large websites, results are paginated using cursor-based pagination.",
        "security": [
          {
            "Authorization": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "The URL of the website for which you want the links"
                  },
                  "search_query": {
                    "type": "string",
                    "description": "An optional search query to sort the links by search relevance."
                  },
                  "top_n": {
                    "type": "number",
                    "description": "An optional number to limit to only top n links for a search query."
                  },
                  "include_subdomain": {
                    "type": "boolean",
                    "description": "Include subdomains of the given URL. `true` by default."
                  },
                  "include_urls": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "URL path patterns to include using glob syntax. For example: `/blog/**` to only include blog URLs. Only URLs matching these patterns will be returned."
                  },
                  "exclude_urls": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "URL path patterns to exclude using glob syntax. For example: `/careers/**`. Excluded URLs will supersede included URLs."
                  },
                  "cursor": {
                    "type": "string",
                    "description": "OPTIONAL: Pagination cursor from a previous response. When provided, returns the next set of URLs from where the previous request left off due to response size limit."
                  }
                },
                "required": [
                  "url"
                ]
              },
              "examples": {
                "basic": {
                  "value": {
                    "url": "https://docs.olostep.com"
                  }
                },
                "withFilters": {
                  "value": {
                    "url": "https://docs.olostep.com",
                    "include_urls": [
                      "/api-reference/**"
                    ],
                    "exclude_urls": [
                      "/api-reference/deprecated/**"
                    ]
                  }
                },
                "withCursor": {
                  "value": {
                    "cursor": "abc123_xyz456"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response with URLs found on the page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "urls_count",
                    "urls"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Unique identifier for this map"
                    },
                    "urls_count": {
                      "type": "integer",
                      "description": "Number of URLs in the current response"
                    },
                    "urls": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Array of URLs found on the page"
                    },
                    "cursor": {
                      "type": "string",
                      "description": "Pagination cursor to retrieve the next set of URLs limited due to 10MB size limit. If null or not present, all URLs have been retrieved."
                    },
                    "credits_consumed": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Number of credits consumed by this request. Populated after execution completes. Credits are the source of truth for billing."
                    },
                    "cost_usd": {
                      "type": "number",
                      "nullable": true,
                      "description": "Estimated cost in USD for this request. Populated after execution completes. Calculated from credits consumed and your plan rate \u2014 99% accurate, but credits_consumed is the authoritative value."
                    }
                  }
                },
                "examples": {
                  "basicResponse": {
                    "value": {
                      "id": "map_abc123",
                      "urls_count": 22,
                      "urls": [
                        "https://docs.olostep.com/api-reference/batches/create",
                        "https://docs.olostep.com/api-reference/batches/info",
                        "https://docs.olostep.com/api-reference/batches/items"
                      ]
                    }
                  },
                  "cursorResponse": {
                    "value": {
                      "id": "map_abc123",
                      "urls_count": 15,
                      "urls": [
                        "https://docs.olostep.com/api-reference/crawls/create",
                        "https://docs.olostep.com/api-reference/crawls/info",
                        "https://docs.olostep.com/api-reference/crawls/pages"
                      ],
                      "cursor": "abc123_def789"
                    }
                  },
                  "allRetrievedResponse": {
                    "value": {
                      "id": "map_abc123",
                      "urls_count": 10,
                      "urls": [
                        "https://docs.olostep.com/features/maps",
                        "https://docs.olostep.com/get-started/authentication",
                        "https://docs.olostep.com/get-started/welcome"
                      ],
                      "cursor": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request due to incorrect or missing parameters."
          },
          "401": {
            "description": "Unauthorized access due to missing or invalid API token."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    }
  }
}