An unofficial Instagram RESTful API. easy to fetch any feed and interact with Instagram (like, follow, etc.) with JWT token implementation.
If you login with your instagram credentials on /auth/login and get Checkpoint required, please provide IMAP credentials to process authentication
error like problem #1 over and over again. Consider using an alternative login with the Instagram sessionid cookie which you can get in this tutorial or this one.
Warning This project uses the nsmle/instagram-user-feed library instead of pgrimaud/instagram-user-feed now onwards. Because some of the features developed and used in this project have not been accepted and I'm still trying to make changes to some of the features that might break.
If you are having trouble with this, you can delete lines 35-60 and replace line 69 to:
"pgrimaud/instagram-user-feed": "^6.16.4" // Or to a higher version, See: https://github.com/pgrimaud/instagram-user-feed/releasesin your
composer.json
file. Or if you have a solution to an existing problem, you can open an issue or make a pull request.
If you like and find this app useful, please give your support by starring in this repository, or make a donation via Saweria or :
A big thank you to Pierre Grimaud for creating a very useful instagram-user-feed library.
Help contribute to solving problems in instagram-user-feed or sponsors to Pierre Grimaud to keep this beloved library alive and well 🙏.
Please take a look at the Igramapi Roadmap to see what features will be implemented next or what fixes are coming.
git clone https://github.com/nsmle/igramapi.git
- Open your terminal and go to your working directory.
- Clone this repository
git clone https://github.com/nsmle/igramapi.git
- Go to folder
cd igramapi
- Install dependencies
composer install
- Create environment variable
cp .env.example .env
- Generate app key inside
.env
filephp artisan key:generate
- Generate
JWT_SECRET
key in.env
filephp artisan jwt:generate-key
- Start local server
php artisan serve
- Open link
http://localhost:8000/
to see available endpoints list
Please see your app BASEURL to see documentations, or you can see https://igramapi.fiki.tech/. Or you can also read the Endpoints bellow.
See your BASEURL and custom your APP_URL in .env
file.
<BASEURL>/v1
v1
is semantic version of this application in .env file.
Method | Endpoint | Auth |
---|---|---|
POST |
/auth/login | No |
POST |
/auth/login/alternative | No |
GET |
/user | Yes |
GET |
/user/{userId} | Yes |
POST |
/user/{userId}/follow | Yes |
POST |
/user/{userId}/unfollow | Yes |
GET |
/reels/{userId} | Yes |
Note Replace
<BASEAPIURL>
in example with your app base api url. You can also replace it with https://igramapi.fiki.tech/v1 as an illustration when in production.You can also send jwt token via cookie/query instead of token header. E.g in Curl:
curl -X <METHOD> "<BASEURL>/<VERSION>/<PATH>" -H "Content-Type: <CONTENT_TYPE>" -d "<DATA>" -b "token=<YOUR_JWT_TOKEN>"The jwt token contains the Instagram session id, csrf token cookie and along with some other information.
- ENDPOINT
/auth/login
- METHOD
POST
- BODY
{ "username" : "YOUR_INSTAGRAM_USERNAME", "password" : "YOUR_INSTAGRAM_PASSWORD" }
- EXAMPLE
curl -X POST "<BASEAPIURL>/auth/login" -H "Content-Type: application/json" -d '{ "username": "YOUR_INSTAGRAM_USERNAME", "password": "YOUR_INSTAGRAM_PASSWORD" }'
- ENDPOINT
/auth/login/alternative
- METHOD
POST
- BODY
- Required
{ "value" : "YOUR_INSTAGRAM_SESSIONID_VALUE", "expires" : "YOUR_INSTAGRAM_SESSIONID_EXPIRES" }
- Optional
{ "name": "sessionid", "domain" : "YOUR_INSTAGRAM_SESSIONID_DOMAIN | .instagram.com", "path": "YOUR_INSTAGRAM_SESSIONID_PATH | /", }
- Required
- EXAMPLE
curl -X POST "<BASEAPIURL>/auth/login/alternative" -H "Content-Type: application/json" -d '{ "name": "sessionid", "value": "YOUR_INSTAGRAM_SESSIONID_VALUE", "domain": ".instagram.com", "path": "/", "expires": "YOUR_INSTAGRAM_SESSIONID_EXPIRES" }'
- ENDPOINT
/user
- METHOD
GET
- EXAMPLE
curl -X GET "<BASEAPIURL>/user" -H "Authorization: Bearer {token}" -H "Content-Type: application/json"
- ENDPOINT
/user/{userId|username}
- METHOD
GET
- EXAMPLE
curl -X GET "<BASEAPIURL>/user/{userId|username}" -H "Authorization: Bearer {token}" -H "Content-Type: application/json"
- ENDPOINT
/user/{userId|username}/follow
- METHOD
POST
- EXAMPLE
curl -X GET "<BASEAPIURL>/user/{userId|username}/follow" -H "Authorization: Bearer {token}" -H "Content-Type: application/json"
- ENDPOINT
/user/{userId|username}/unfollow
- METHOD
POST
- EXAMPLE
curl -X GET "<BASEAPIURL>/user/{userId|username}/unfollow" -H "Authorization: Bearer {token}" -H "Content-Type: application/json"
- ENDPOINT
- get reels
/reels/{userId|username}
- get next reels
/reels/{userId|username}?cursor={maxId}
- get reels
- METHOD
GET
- EXAMPLE
curl -X GET "<BASEAPIURL>/reels/{userId|username}" -H "Authorization: Bearer {token}" -H "Content-Type: application/json"
Contributions of any kind welcome!
I currently made this project for personal purposes. I decided to share it here to help anyone with the same needs. If you have any feedback to improve it, You found a bug, You need a new feature/endpoint. You can create an issue if needed and feel free to make a suggestion, or open a PR!
Licensed under the terms of the MIT License. Following the instagram-user-feed License. Use it wisely and don't abuse it!