> ## 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.

# Browser task status

> Check a browser task and read its result. Send one request and get JSON back. Examples in cURL, TypeScript and Python. A failed call costs nothing.

result is null while the task runs. When it ends, result says whether the goal was met, why it stopped if not, and the steps taken. A task is kept for 24 hours.

Free.

```bash cURL theme={null}
curl -X POST https://api.stophy.dev/v1/browser/task/status \
  -H "Authorization: Bearer $STOPHY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id":"7c76df71-1d78-4d05-b09c-2f7840b12400"}'
```

```typescript TypeScript theme={null}
const response = await fetch("https://api.stophy.dev/v1/browser/task/status", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.STOPHY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ id: "7c76df71-1d78-4d05-b09c-2f7840b12400" }),
});
console.log(await response.json());
```

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

import requests

response = requests.post(
    "https://api.stophy.dev/v1/browser/task/status",
    headers={"Authorization": f"Bearer {os.environ['STOPHY_API_KEY']}"},
    json={"id": "7c76df71-1d78-4d05-b09c-2f7840b12400"},
)
print(response.json())
```

```json 200 theme={null}
{
  "success": true,
  "data": {
    "status": "done",
    "result": {
      "done": false,
      "reason": "The browser could not run this task. Nothing was charged."
    },
    "creditsUsed": 0
  },
  "creditsUsed": 0,
  "requestId": "742fd075-3678-4a8a-a92f-7b13eccb9209"
}
```


## OpenAPI

````yaml api-reference/openapi.json POST /v1/browser/task/status
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/browser/task/status:
    post:
      summary: Check a browser task and read its result
      description: Costs 0 credits per call.
      operationId: browserTaskStatus
      parameters:
        - $ref: '#/components/parameters/MaxTextLength'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                  description: The id browser.task returned.
              required:
                - id
              additionalProperties: false
      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
                required:
                  - success
                  - data
                  - creditsUsed
                  - requestId
                properties:
                  success:
                    const: true
                  data:
                    type: object
                    additionalProperties: false
                    properties:
                      status:
                        type: string
                        enum:
                          - running
                          - done
                      result:
                        type: object
                        additionalProperties: false
                        properties:
                          done:
                            type: boolean
                          reason:
                            type: string
                          steps:
                            type: array
                            items:
                              type: string
                          url:
                            type: string
                          title:
                            type: string
                          seconds:
                            type: number
                          fields:
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties:
                              anyOf:
                                - anyOf:
                                    - type: string
                                    - type: number
                                    - type: boolean
                                - type: array
                                  items:
                                    anyOf:
                                      - type: string
                                      - type: number
                                      - type: boolean
                          confidence:
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties:
                              type: number
                        required:
                          - done
                      creditsUsed:
                        type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                    required:
                      - status
                      - creditsUsed
                  creditsUsed:
                    type: integer
                  requestId:
                    type: string
        4XX:
          $ref: '#/components/responses/Error'
        5XX:
          $ref: '#/components/responses/Error'
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.