REST API: List all files in repo (like git ls-files) (BB-9449)

Issue #8316 open
Aslak Hellesøy
created an issue

There is a "manifest" REST API endpoint for this that is undocumented and seemingly broken. I found it via the apigee browser:


(The apigee API browser suggests a trailing slash, which didn't work).

Anyway, this will only list the files at the root of the repository. I don't know if it's possible to make it behave recursively.

Is there another way to list all files in a repo (for a given revision)? We'd very much like to support Bitbucket in, but we need this functionality to do so.

Comments (14)

  1. Jonathan Mooring staff

    Hi Aslak,

    Thanks for reaching out regarding possible integrations with Cucumber Pro. The manifest endpoint is something of a relic from the past and, as you noted, is not particularly useful.

    We're actively developing our v2 API, with plans to add better source browsing endpoints. While this work is on our roadmap, we don't have a hard release date for it at this time.

    In the meantime, I can point you to an internal endpoint that we use with our quick file search feature (press f at any time while browsing a repo to jump to a particular file). This endpoint is unsupported and is subject to change or deletion at any point. With that in mind, the URL format is as follows:!api/1.0/repositories/atlassian/morec/directory/

    Hope this helps,

  2. Aslak Hellesøy reporter

    Thanks a lot Jon!

    I'll try out the internal API. We're actually using another part of it already to save a file - discovered it by editing a file via the web interface :-)

    Looking forward to trying out the 2.0 API when it comes.

  3. Aslak Hellesøy reporter

    Jon, is there a way to specify a revision or branch? It looks to me like this will always give you the head of the default (master) branch.

    History is a central concept for us, so we'd like to see what files existed in the past for a particular revision if possible.

  4. Aslak Hellesøy reporter

    One more question. The returned document has two properties:

    limit: 10000,
    isLastPage: true

    I assume this means that the document will never contain more than 10000 files, and if there are more files in the repo, isLastPage will be false.

    My question is - how do I find out where to get the next page? Will there be some header or extra document property to tell me this?


  5. Llie

    And the date of the revision of the blob please. I used to simply scrape the HTML of my src/tip page, but with the new dynamically generated HTML this no longer works.

  6. Alex Ivkin

    This issue has to be solved. Without getting an easy access to the tree one is forced to recursively scan all files and folders using the src/ namespace . That is slow and triggers rate limiting for big repositories.
    Github API supports trees natively via
    There is an internal bitbucket API that does exactly whats needed -!api/internal/repositories/[user]/[repo]/tree/[commit]/
    Please make a public clone!

  7. Log in to comment