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

# List Media

> Fetch a list of all media files associated with your account

This API lets you fetch a list of media associated with a given auth\_id.

#### API Endpoint

```text GET theme={null}
https://api.plivo.com/v1/Account/{auth_id}/Media/
```

### Arguments

<table>
  <tbody>
    <tr>
      <td>
        <strong>limit<br />integer</strong>
      </td>

      <td>
        <p>Denotes the number of results per page. The maximum number of results that can be fetched is 20. Defaults to 20.</p>
      </td>
    </tr>

    <tr>
      <td>
        <strong>offset<br />integer</strong>
      </td>

      <td>
        <p>Denotes the number of value items by which the results should be offset. Defaults to 0. Read more about <a href="https://docs.plivo.com/docs/messaging/api/request/pagination">
        offset-based pagination</a>.</p>
      </td>
    </tr>
  </tbody>
</table>

### Returns

Returns a JSON response containing the list of media\_files uploaded or associated with the given user.

<RequestExample>
  ```py Python theme={null}
  import plivo
  client = plivo.RestClient("<auth_id>", "<auth_token>")
  response = client.media.list()
  print(response)
  ```

  ```ruby Ruby theme={null}
  require 'rubygems'
  require 'plivo'

  include Plivo
  include Plivo::Exceptions

  api = RestClient.new("<auth_id>","<auth_token>")
  begin
   response = api.media.list()
   puts response
   rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
  end
  ```

  ```js Node theme={null}
  let plivo = require('plivo');

  let client = new plivo.Client('<auth_id>', '<auth_token>');
  client.media.list().then(
    function (media) {
      console.log("\n============ response ===========\n", media)
    }
  ).catch(function (response) {
    console.log("\n============ Error :: ===========\n", response);
  });
  ```

  ```php PHP theme={null}
  <?php
  require 'vendor/autoload.php';
  use Plivo\RestClient;

  $client = new RestClient("<auth_id>","<auth_token>");
  $client->client->setTimeout(40);

  //List all media
  try {
      $response = $client->media->list();
       print_r($response);
   }
   catch (PlivoRestException $ex) {
       print_r($ex);
   }
  ```

  ```java Java theme={null}
  package com.plivo.api;
  import java.io.IOException;
  import com.plivo.api.exceptions.PlivoRestException;
  import com.plivo.api.models.base.ListResponse;
  import com.plivo.api.models.media.Media;

  public class Test {
    public static void main(String[] args) {
      Plivo.init("<auth_id>", "<auth_token>");
      try {
        ListResponse<Media> p = Media.lister().list();
        System.out.println(p);
      } catch (IOException e) {
        e.printStackTrace();
      } catch (PlivoRestException e) {
        e.printStackTrace();
      }
    }
  }
  ```

  ```csharp .NET theme={null}
  using System;
  using Plivo;
  using Plivo.Exception;

  namespace SdkTestDotnet
  {
      class Program
      {
          static void Main(string[] args)
          {
              var api = new PlivoApi("<auth_id>","<auth_token>");
              try
              {
                  var response = api.Media.List();
                  Console.WriteLine(response);
              }
              catch (PlivoRestException e)
              {
                  Console.WriteLine("Exception: " + e.Message);
              }
          }
      }
  }
  ```

  ```go Go theme={null}
  package main

  import (
  	"fmt"

  	plivo "github.com/plivo/plivo-go/v7"
  )

  func main() {

  	// MAIN ACCOUNT
  	client, err := plivo.NewClient("<auth_id>",
  		"<auth_token>",
  		&plivo.ClientOptions{})
  	if err != nil {
  		panic(err)
  	}

  	// list all media in account
  	listResp, err := client.Media.List(plivo.MediaListParams{Limit: 20, Offset: 0})
  	if err != nil {
  		panic(err)
  	}
  	fmt.Printf("Response: %#v\n", listResp)
  }
  ```

  ```sh cURL theme={null}
  curl -i --user auth_id:auth_token \
    https://api.plivo.com/v1/Account/{auth_id}/Media/
  ```
</RequestExample>

### Response

```json Response theme={null}
{
    "api_id": "<api_id>",
    "meta": {
        "limit": 20,
        "next": "/v1/Account/<auth_id>/Media?offset=20&limit=20",
        "offset": 0,
        "previous": "/v1/Account/<auth_id>/Media?offset=0&limit=20"
        "total_count": 44
    },
    "objects": [
        {
            "content_type": "image/jpeg",
            "file_name": "sample2.jpg",
            "media_id": "<media_id>",
            "size": 113730,
            "upload_time": "2020-02-17T05:46:54.481186Z",
            "media_url": "https://media.plivo.com/Account/<auth_id>/Media/<media_id>"
        },
        .
        .
        .
        .
       {
            "content_type": "application/pdf",
            "file_name": "pdf_sample.pdf",
            "media_id": "<media_id>",
            "size": 309500,
            "upload_time": "2020-02-17T08:32:41.924866Z",
            "media_url": "https://media.plivo.com/Account/<auth_id>/Media/<media_id>"
        }
    ]
}
```
