---
updatedAt: 2025-10-02T22:24:59.000Z
agentTools:
  projectIndex: https://developer.bill.com/v2/llms.txt
---

# Get a bill attachment

Get a document attached to a bill. In your request, set `id` as the bill ID. The value begins with `00n`.

In the response, a `fileUrl` value is generated, which includes an `id`. Use the returned `id` in a subsequent GET request for downloading the bill attachment. Set `--output` as a file name and extension. For example, `bill-attachment.pdf`.

**Note**: Set the correct file extension in your GET request. For example, you cannot download a PNG file as a PDF.

```
curl 'https://api-stage.bill.com/DownloadBillDocumentServlet?id={fileUrl_id}&billId={bill_id}&pageNumber={page_number}' \
--output {file_name} \
--header 'sessionId: {session_id}'
```

# OpenAPI definition

````json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Organization | Basic operations",
    "version": "2.0",
    "description": "BILL is a cloud-based cash flow management system for an organization's Accounts Payable (AP) and Accounts Receivable (AR) automation.\n * **AP**: Automate workflows to pay vendors bills at scale for the goods and services they provide. Pay vendors with a wide range of payment methods. Generate vendor credits, bill credits, and payment disbursement reports.\n * **AR**: Automate workflows to get paid by customers at scale for the goods and services you provide. Generate and send invoices on a schedule, generate customer and invoice credits, and seamlessly charge authorized customers.\n * **Organization**: Manage your bank accounts (for sending and receiving payments), users (with user roles), and sync with your choice of accounting software.\n\nIntegrate with the BILL API to send and receive payments for your business. See [Support Center](https://help.bill.com/hc/en-us) for resources about using the BILL web app.",
    "contact": {
      "email": "developerprogram@hq.bill.com"
    }
  },
  "servers": [
    {
      "url": "https://api-stage.bill.com/api/v2",
      "description": "Sandbox base URL"
    }
  ],
  "x-readme": {
    "samples-languages": [
      "curl",
      "java",
      "javascript",
      "python",
      "ruby"
    ],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "paths": {
    "/GetDocuments.json": {
      "post": {
        "summary": "Get a bill attachment",
        "operationId": "org-basic-getdocuments",
        "description": "Get a document attached to a bill. In your request, set `id` as the bill ID. The value begins with `00n`.\n\nIn the response, a `fileUrl` value is generated, which includes an `id`. Use the returned `id` in a subsequent GET request for downloading the bill attachment. Set `--output` as a file name and extension. For example, `bill-attachment.pdf`.\n\n**Note**: Set the correct file extension in your GET request. For example, you cannot download a PNG file as a PDF.\n\n```\ncurl 'https://api-stage.bill.com/DownloadBillDocumentServlet?id={fileUrl_id}&billId={bill_id}&pageNumber={page_number}' \\\n--output {file_name} \\\n--header 'sessionId: {session_id}'\n```",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetDocumentsResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "devKey",
                  "sessionId",
                  "data"
                ],
                "properties": {
                  "devKey": {
                    "type": "string",
                    "description": "Developer key generated with your BILL developer account"
                  },
                  "sessionId": {
                    "type": "string",
                    "description": "API session ID generated with [`/v2/Login.json`](ref:auth-login)"
                  },
                  "data": {
                    "$ref": "#/components/schemas/GetDocumentsRequest"
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Basic operations"
        ]
      },
      "parameters": []
    }
  },
  "components": {
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error_code": {
            "type": "string",
            "description": "Error code (only when `response_status` is `1`)"
          },
          "error_message": {
            "type": "string",
            "description": "Error message (only when `response_status` is `1`)"
          }
        }
      },
      "GetDocumentsRequest": {
        "type": "object",
        "required": [
          "id",
          "start",
          "max"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "BILL-generated ID of the bill. The value begins with `00n`."
          },
          "start": {
            "type": "number",
            "default": 0,
            "description": "Set as `0`."
          },
          "max": {
            "type": "number",
            "default": 99,
            "description": "Set as `99`."
          }
        }
      },
      "GetDocumentsResponse": {
        "type": "object",
        "properties": {
          "response_status": {
            "type": "integer",
            "description": "Response status.\n* `0`: Success response\n* `1`: Error response. Only `error_code` and `error_message` is returned in `response_data`."
          },
          "response_message": {
            "type": "string",
            "description": "Response status.\n* `Success`: Success response\n* `Error`: Error response. Only `error_code` and `error_message` is returned in `response_data`."
          },
          "response_data": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/ErrorResponse"
              }
            ],
            "properties": {
              "documents": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "entity": {
                      "type": "string",
                      "description": "Object type. Set as `Document`."
                    },
                    "id": {
                      "type": "string",
                      "description": "BILL-generated ID of the attachment. The value begins with `00h`. Use this value in a subsequent GET request for downloading the attachment."
                    },
                    "fileName": {
                      "type": "string",
                      "description": "Attachment file name"
                    },
                    "createdDate": {
                      "type": "string",
                      "description": "Created date and time"
                    },
                    "numPages": {
                      "type": "number",
                      "description": "Number of pages in the attachment"
                    },
                    "fileUrl": {
                      "type": "string",
                      "description": "File URL. Use the returned `id` value in a subsequent GET request for downloading the attachment."
                    },
                    "scanStatus": {
                      "type": "string",
                      "description": "Set as `clean` if BILL has sucecssfully scanned your attachment"
                    }
                  }
                }
              },
              "numPages": {
                "type": "number",
                "description": "Total number of documents attached to the bill"
              }
            }
          }
        }
      }
    }
  }
}
````