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

# Get Company's Posts

> - Get posts from a LinkedIn company page.  Pagination is supported to fetch all posts. 

 - 2 credits per call.

```bash cURL theme={null}
curl --request GET \
	--url 'https://live-fetch.p.rapidapi.com/get-company-posts?linkedin_url=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Famazon%2F&start=0&sort_by=top' \
	--header 'x-rapidapi-host: live-fetch.p.rapidapi.com' \
	--header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY'
```

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

url = "https://live-fetch.p.rapidapi.com/get-company-posts"

querystring = {
    "linkedin_url": "https://www.linkedin.com/company/amazon/",
    "start": "0",
    "sort_by": "top"
}

headers = {
    "x-rapidapi-key": "YOUR_RAPIDAPI_KEY",
    "x-rapidapi-host": "live-fetch.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript JavaScript theme={null}
const params = new URLSearchParams({
	linkedin_url: "https://www.linkedin.com/company/amazon/",
	start: "0",
	sort_by: "top"
});

const url = `https://live-fetch.p.rapidapi.com/get-company-posts?${params}`;
const options = {
	method: 'GET',
	headers: {
		'x-rapidapi-key': 'YOUR_RAPIDAPI_KEY',
		'x-rapidapi-host': 'live-fetch.p.rapidapi.com'
	}
};

try {
	const response = await fetch(url, options);
	const result = await response.json();
	console.log(result);
} catch (error) {
	console.error(error);
}
```

```php PHP theme={null}
<?php

$query = http_build_query([
	'linkedin_url' => "https://www.linkedin.com/company/amazon/",
	'start' => "0",
	'sort_by' => "top"
]);

$curl = curl_init();

curl_setopt_array($curl, [
	CURLOPT_URL => "https://live-fetch.p.rapidapi.com/get-company-posts" . "?" . $query,
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_CUSTOMREQUEST => "GET",
	CURLOPT_HTTPHEADER => [
		"x-rapidapi-host: live-fetch.p.rapidapi.com",
		"x-rapidapi-key: YOUR_RAPIDAPI_KEY"
	],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
	echo "cURL Error #:" . $err;
} else {
	echo $response;
}
```

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

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	params := url.Values{}
	params.Add("linkedin_url", "https://www.linkedin.com/company/amazon/")
	params.Add("start", "0")
	params.Add("sort_by", "top")

	req, _ := http.NewRequest("GET", "https://live-fetch.p.rapidapi.com/get-company-posts?"+params.Encode(), nil)

	req.Header.Add("x-rapidapi-key", "YOUR_RAPIDAPI_KEY")
	req.Header.Add("x-rapidapi-host", "live-fetch.p.rapidapi.com")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))
}
```

```java Java theme={null}
HttpRequest request = HttpRequest.newBuilder()
		.uri(URI.create("https://live-fetch.p.rapidapi.com/get-company-posts?linkedin_url=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Famazon%2F&start=0&sort_by=top"))
		.header("x-rapidapi-key", "YOUR_RAPIDAPI_KEY")
		.header("x-rapidapi-host", "live-fetch.p.rapidapi.com")
		.method("GET", HttpRequest.BodyPublishers.noBody())
		.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```


## OpenAPI

````yaml GET /get-company-posts
openapi: 3.0.1
info:
  title: OpenAPI Plant Store
  description: >-
    A sample API that uses a plant store as an example to demonstrate features
    in the OpenAPI specification
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://live-fetch.p.rapidapi.com
security:
  - ApiKeyAuth: []
paths:
  /get-company-posts:
    get:
      description: >-
        - Get posts from a LinkedIn company page.  Pagination is supported to
        fetch all posts. 

         - 2 credits per call.
      parameters:
        - name: linkedin_url
          in: query
          description: ''
          required: true
          schema:
            type: string
            example: https://www.linkedin.com/company/amazon/
        - name: start
          in: query
          required: false
          description: ''
          schema:
            type: integer
            default: 0
        - name: pagination_token
          in: query
          required: false
          description: >-
            Required when fetching the next result page. Please use the token
            from the result of your previous call.
          schema:
            type: string
        - name: sort_by
          in: query
          required: false
          description: 'Possible values: top, recent'
          schema:
            type: string
            enum:
              - top
              - recent
            default: top
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompanyPosts'
        '400':
          description: Invalid linkedin url
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidURL'
        '404':
          description: the url was not found on Linkedin
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    nullable: true
                    example: null
                  message:
                    type: string
                    example: the url was not found on Linkedin
        '503':
          description: System error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SystemError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CompanyPosts:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              images:
                type: array
                items:
                  type: object
                  properties:
                    url:
                      type: string
                      format: uri
                      example: https://media.licdn.com/dms/image/example.png
              num_appreciations:
                type: integer
                example: 32
              num_comments:
                type: integer
                example: 173
              num_empathy:
                type: integer
                example: 139
              num_interests:
                type: integer
                example: 4
              num_likes:
                type: integer
                example: 4084
              num_praises:
                type: integer
                example: 264
              num_reposts:
                type: integer
                example: 68
              posted:
                type: string
                example: '2024-06-06 14:40:25'
              poster:
                type: object
                properties:
                  linkedin_url:
                    type: string
                    format: uri
                    example: https://www.linkedin.com/company/example/
                  name:
                    type: string
                    example: Amazon
                  image_url:
                    type: string
                    example: >-
                      https://media.licdn.com/dms/image/v2/D560BAQGDLy4STCnHbg/company-logo_400_400/B56ZnZxDipI0AY-/0/1760295142304/amazon_logo?e=1795651200&v=beta&t=MM2U6vxjUg1kn1W8coDEJ7I9g7ytqJ4pXkCTv11Bp28
              reshared:
                type: boolean
                example: false
              text:
                type: string
                example: 🏋️‍♂️ Meet Amazon's very own strongman!
              time:
                type: string
                example: 6 days ago
              url:
                type: string
                format: uri
                example: https://www.linkedin.com/posts/example_post
              urn:
                type: string
                example: '7204492333600440320'
              video:
                type: object
                nullable: true
                properties:
                  duration:
                    type: integer
                    example: 70033
                  stream_url:
                    type: string
                    format: uri
                    example: https://dms.licdn.com/playlist/vid/example.mp4
              attributes:
                type: array
                items:
                  type: string
              share_urn:
                type: string
                example: '7523036288531423232'
            required:
              - num_comments
              - text
              - poster
        message:
          type: string
          example: Request successful.
        paging:
          type: object
          properties:
            count:
              type: integer
              example: 50
            pagination_token:
              type: string
              example: 1888681094-1793951641518-76b4cfec69e296eac25a7d5409258046
            start:
              type: integer
              example: 0
      required:
        - data
        - message
        - paging
    InvalidURL:
      type: object
      properties:
        data:
          type: object
          nullable: true
          example: null
        message:
          type: string
          example: 'Bad request: Invalid linkedin_url.'
    SystemError:
      type: object
      properties:
        data:
          type: object
          nullable: true
          example: null
        message:
          type: string
          example: >-
            System error. You will not be charged for this request. We will fix
            it soon!
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-rapidapi-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.