1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065
|
---
swagger: '2.0'
################################################################################
# API Information #
################################################################################
info:
version: v1
title: Instagram API
description: |
The first version of the Instagram API is an exciting step forward towards
making it easier for users to have open access to their data. We created it
so that you can surface the amazing content Instagram users share every
second, in fun and innovative ways.
Build something great!
Once you've
[registered your client](http://instagram.com/developer/register/) it's easy
to start requesting data from Instagram.
All endpoints are only accessible via https and are located at
`api.instagram.com`. For instance: you can grab the most popular photos at
the moment by accessing the following URL with your client ID
(replace CLIENT-ID with your own):
```
https://api.instagram.com/v1/media/popular?client_id=CLIENT-ID
```
You're best off using an access_token for the authenticated user for each
endpoint, though many endpoints don't require it.
In some cases an access_token will give you more access to information, and
in all cases, it means that you are operating under a per-access_token limit
vs. the same limit for your single client_id.
## Limits
Be nice. If you're sending too many requests too quickly, we'll send back a
`503` error code (server unavailable).
You are limited to 5000 requests per hour per `access_token` or `client_id`
overall. Practically, this means you should (when possible) authenticate
users so that limits are well outside the reach of a given user.
## Deleting Objects
We do our best to have all our URLs be
[RESTful](http://en.wikipedia.org/wiki/Representational_state_transfer).
Every endpoint (URL) may support one of four different http verbs. GET
requests fetch information about an object, POST requests create objects,
PUT requests update objects, and finally DELETE requests will delete
objects.
Since many old browsers don't support PUT or DELETE, we've made it easy to
fake PUTs and DELETEs. All you have to do is do a POST with _method=PUT or
_method=DELETE as a parameter and we will treat it as if you used PUT or
DELETE respectively.
## Structure
### The Envelope
Every response is contained by an envelope. That is, each response has a
predictable set of keys with which you can expect to interact:
```json
{
"meta": {
"code": 200
},
"data": {
...
},
"pagination": {
"next_url": "...",
"next_max_id": "13872296"
}
}
```
#### META
The meta key is used to communicate extra information about the response to
the developer. If all goes well, you'll only ever see a code key with value
200. However, sometimes things go wrong, and in that case you might see a
response like:
```json
{
"meta": {
"error_type": "OAuthException",
"code": 400,
"error_message": "..."
}
}
```
#### DATA
The data key is the meat of the response. It may be a list or dictionary,
but either way this is where you'll find the data you requested.
#### PAGINATION
Sometimes you just can't get enough. For this reason, we've provided a
convenient way to access more data in any request for sequential data.
Simply call the url in the next_url parameter and we'll respond with the
next set of data.
```json
{
...
"pagination": {
"next_url": "https://api.instagram.com/v1/tags/puppy/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&max_id=13872296",
"next_max_id": "13872296"
}
}
```
On views where pagination is present, we also support the "count" parameter.
Simply set this to the number of items you'd like to receive. Note that the
default values should be fine for most applications - but if you decide to
increase this number there is a maximum value defined on each endpoint.
### JSONP
If you're writing an AJAX application, and you'd like to wrap our response
with a callback, all you have to do is specify a callback parameter with
any API call:
```
https://api.instagram.com/v1/tags/coffee/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&callback=callbackFunction
```
Would respond with:
```js
callbackFunction({
...
});
```
termsOfService: http://instagram.com/about/legal/terms/api
################################################################################
# Host, Base Path, Schemes and Content Types #
################################################################################
host: api.instagram.com
basePath: /v1
schemes:
- https
produces:
- application/json
consumes:
- application/json
################################################################################
# Tags #
################################################################################
tags:
- name: Users
- name: Relationships
description: |
Relationships are expressed using the following terms:
**outgoing_status**: Your relationship to the user. Can be "follows",
"requested", "none".
**incoming_status**: A user's relationship to you. Can be "followed_by",
"requested_by", "blocked_by_you", "none".
- name: Media
description: |
At this time, uploading via the API is not possible. We made a conscious
choice not to add this for the following reasons:
* Instagram is about your life on the go – we hope to encourage photos
from within the app.
* We want to fight spam & low quality photos. Once we allow uploading
from other sources, it's harder to control what comes into the Instagram
ecosystem. All this being said, we're working on ways to ensure users
have a consistent and high-quality experience on our platform.
- name: Commnts
- name: Likes
- name: Tags
- name: Location
- name: Subscribtions
################################################################################
# Security #
################################################################################
securityDefinitions:
oauth:
type: oauth2
flow: implicit
authorizationUrl: https://instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token
scopes:
basic: |
to read any and all data related to a user (e.g. following/followed-by
lists, photos, etc.) (granted by default)
comments: to create or delete comments on a user’s behalf
relationships: to follow and unfollow users on a user’s behalf
likes: to like and unlike items on a user’s behalf
key:
type: apiKey
in: query
name: access_token
security:
- oauth:
- basic
- comments
- relationships
- likes
- key: []
################################################################################
# Parameters #
################################################################################
parameters:
user-id:
name: user-id
in: path
description: The user identifier number
type: number
required: true
tag-name:
name: tag-name
in: path
description: Tag name
type: string
required: true
################################################################################
# Paths #
################################################################################
paths:
/users/{user-id}:
parameters:
- $ref: '#/parameters/user-id'
get:
security:
- key: []
- oauth:
- basic
tags:
- Users
description: Get basic information about a user.
responses:
200:
description: The user object
schema:
type: object
properties:
data:
$ref: '#/definitions/User'
/users/self/feed:
get:
tags:
- Users
description: See the authenticated user's feed.
parameters:
- name: count
in: query
description: Count of media to return.
type: integer
- name: max_id
in: query
description: Return media earlier than this max_id.s
type: integer
- name: min_id
in: query
description: Return media later than this min_id.
type: integer
responses:
200:
description: OK
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Media'
/users/{user-id}/media/recent:
parameters:
- $ref: '#/parameters/user-id'
get:
tags:
- Users
responses:
200:
description: |
Get the most recent media published by a user. To get the most recent
media published by the owner of the access token, you can use `self`
instead of the `user-id`.
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Media'
parameters:
- name: count
in: query
description: Count of media to return.
type: integer
- name: max_timestamp
in: query
description: Return media before this UNIX timestamp.
type: integer
- name: min_timestamp
in: query
description: Return media after this UNIX timestamp.
type: integer
- name: min_id
in: query
description: Return media later than this min_id.
type: string
- name: max_id
in: query
description: Return media earlier than this max_id.
type: string
/users/self/media/liked:
get:
tags:
- Users
description: |
See the list of media liked by the authenticated user.
Private media is returned as long as the authenticated user
has permissionto view that media. Liked media lists are only
available for the currently authenticated user.
responses:
200:
description: OK
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Media'
parameters:
- name: count
in: query
description: Count of media to return.
type: integer
- name: max_like_id
in: query
description: Return media liked before this id.
type: integer
/users/search:
get:
tags:
- Users
description: Search for a user by name.
parameters:
- name: q
in: query
description: A query string
type: string
required: true
- name: count
in: query
description: Number of users to return.
type: string
responses:
200:
description: OK
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/MiniProfile'
/users/{user-id}/follows:
parameters:
- $ref: '#/parameters/user-id'
get:
tags:
- Relationships
description: Get the list of users this user follows.
responses:
200:
description: OK
schema:
properties:
data:
type: array
items:
$ref: '#/definitions/MiniProfile'
/users/{user-id}/followed-by:
parameters:
- $ref: '#/parameters/user-id'
get:
tags:
- Relationships
description: Get the list of users this user is followed by.
responses:
200:
description: OK
schema:
properties:
data:
type: array
items:
$ref: '#/definitions/MiniProfile'
/users/self/requested-by:
get:
tags:
- Relationships
description: |
List the users who have requested this user's permission to follow.
responses:
200:
description: OK
schema:
properties:
meta:
properties:
code:
type: integer
data:
type: array
items:
$ref: '#/definitions/MiniProfile'
/users/{user-id}/relationship:
parameters:
- $ref: '#/parameters/user-id'
post:
tags:
- Relationships
description: |
Modify the relationship between the current user and thetarget user.
security:
- oauth:
- relationships
parameters:
- name: action
in: body
description: One of follow/unfollow/block/unblock/approve/ignore.
schema:
type: string
enum:
- follow
- unfollow
- block
- unblock
- approve
responses:
200:
description: OK
schema:
properties:
data:
type: array
items:
$ref: '#/definitions/MiniProfile'
/media/{media-id}:
parameters:
- name: media-id
in: path
description: The media ID
type: integer
required: true
get:
tags:
- Media
description: |
Get information about a media object.
The returned type key will allow you to differentiate between `image`
and `video` media.
Note: if you authenticate with an OAuth Token, you will receive the
`user_has_liked` key which quickly tells you whether the current user
has liked this media item.
responses:
200:
description: OK
schema:
$ref: '#/definitions/Media'
/media1/{shortcode}: #FIXME: correct path is /media/{shortcode}
parameters:
- name: shortcode
in: path
description: The media shortcode
type: string
required: true
get:
tags:
- Media
description: |
This endpoint returns the same response as **GET** `/media/media-id`.
A media object's shortcode can be found in its shortlink URL.
An example shortlink is `http://instagram.com/p/D/`
Its corresponding shortcode is D.
responses:
200:
description: OK
schema:
$ref: '#/definitions/Media'
/media/search:
get:
tags:
- Media
description: |
Search for media in a given area. The default time span is set to 5
days. The time span must not exceed 7 days. Defaults time stamps cover
the last 5 days. Can return mix of image and video types.
parameters:
- name: LAT
description: |
Latitude of the center search coordinate. If used, lng is required.
type: number
in: query
- name: MIN_TIMESTAMP
description: |
A unix timestamp. All media returned will be taken later than
this timestamp.
type: integer
in: query
- name: LNG
description: |
Longitude of the center search coordinate. If used, lat is required.
type: number
in: query
- name: MAX_TIMESTAMP
description: |
A unix timestamp. All media returned will be taken earlier than this
timestamp.
type: integer
in: query
- name: DISTANCE
description: Default is 1km (distance=1000), max distance is 5km.
type: integer
maximum: 5000
default: 1000
in: query
responses:
200:
description: OK
schema:
type: object
description: List of all media with added `distance` property
properties:
data:
type: array
items:
allOf:
- $ref: '#/definitions/Media'
-
properties:
distance:
type: number
/media/popular:
get:
tags:
- Media
description: |
Get a list of what media is most popular at the moment.
Can return mix of image and video types.
responses:
200:
description: OK
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Media'
/media/{media-id}/comments:
parameters:
- name: media-id
in: path
description: Media ID
type: integer
required: true
get:
tags:
- Comments
description: |
Get a list of recent comments on a media object.
responses:
200:
description: OK
schema:
properties:
meta:
properties:
code:
type: number
data:
type: array
items:
$ref: '#/definitions/Comment'
post:
tags:
- Comments
- Media
description: |
Create a comment on a media object with the following rules:
* The total length of the comment cannot exceed 300 characters.
* The comment cannot contain more than 4 hashtags.
* The comment cannot contain more than 1 URL.
* The comment cannot consist of all capital letters.
security:
- oauth:
- comments
parameters:
- name: TEXT
description: |
Text to post as a comment on the media object as specified in
media-id.
in: body
schema:
type: number
responses:
200:
description: OK
schema:
type: object
properties:
meta:
properties:
code:
type: number
data:
type: object
delete:
tags:
- Comments
description: |
Remove a comment either on the authenticated user's media object or
authored by the authenticated user.
responses:
200:
description: OK
schema:
type: object
properties:
meta:
properties:
code:
type: number
data:
type: object
/media/{media-id}/likes:
parameters:
- name: media-id
in: path
description: Media ID
type: integer
required: true
get:
tags:
- Likes
- Media
description: |
Get a list of users who have liked this media.
responses:
200:
description: OK
schema:
properties:
meta:
properties:
code:
type: number
data:
type: array
items:
$ref: '#/definitions/Like'
post:
tags:
- Likes
description: Set a like on this media by the currently authenticated user.
security:
- oauth:
- comments
responses:
200:
description: OK
schema:
type: object
properties:
meta:
properties:
code:
type: number
data:
type: object
delete:
tags:
- Likes
description: |
Remove a like on this media by the currently authenticated user.
responses:
200:
description: OK
schema:
type: object
properties:
meta:
properties:
code:
type: number
data:
type: object
/tags/{tag-name}:
parameters:
- $ref: '#/parameters/tag-name'
get:
tags:
- Tags
description: Get information about a tag object.
responses:
200:
description: OK
schema:
$ref: '#/definitions/Tag'
/tags/{tag-name}/media/recent:
parameters:
- $ref: '#/parameters/tag-name'
get:
tags:
- Tags
description: |
Get a list of recently tagged media. Use the `max_tag_id` and
`min_tag_id` parameters in the pagination response to paginate through
these objects.
responses:
200:
description: OK
schema:
properties:
data:
type: array
items:
$ref: '#/definitions/Tag'
/tags/search:
get:
tags:
- Tags
parameters:
- name: q
description: |
A valid tag name without a leading #. (eg. snowy, nofilter)
in: query
type: string
responses:
200:
description: OK
schema:
type: object
properties:
meta:
properties:
code:
type: integer
data:
type: array
items:
$ref: '#/definitions/Tag'
/locations/{location-id}:
parameters:
- name: location-id
description: Location ID
in: path
type: integer
required: true
get:
tags:
- Location
description: Get information about a location.
responses:
200:
description: OK
schema:
type: object
properties:
data:
$ref: '#/definitions/Location'
/locations/{location-id}/media/recent:
parameters:
- name: location-id
description: Location ID
in: path
type: integer
required: true
get:
tags:
- Location
- Media
description: Get a list of recent media objects from a given location.
parameters:
- name: max_timestamp
in: query
description: Return media before this UNIX timestamp.
type: integer
- name: min_timestamp
in: query
description: Return media after this UNIX timestamp.
type: integer
- name: min_id
in: query
description: Return media later than this min_id.
type: string
- name: max_id
in: query
description: Return media earlier than this max_id.
type: string
responses:
200:
description: OK
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Media'
/locations/search:
get:
tags:
- Location
description: Search for a location by geographic coordinate.
parameters:
- name: distance
in: query
description: Default is 1000m (distance=1000), max distance is 5000.
type: integer
- name: facebook_places_id
in: query
description: |
Returns a location mapped off of a Facebook places id. If used, a
Foursquare id and lat, lng are not required.
type: integer
- name: foursquare_id
in: query
description: |
returns a location mapped off of a foursquare v1 api location id.
If used, you are not required to use lat and lng. Note that this
method is deprecated; you should use the new foursquare IDs with V2
of their API.
type: integer
- name: lat
in: query
description: |
atitude of the center search coordinate. If used, lng is required.
type: number
- name: lng
in: query
description: |
ongitude of the center search coordinate. If used, lat is required.
type: number
- name: foursquare_v2_id
in: query
description: |
Returns a location mapped off of a foursquare v2 api location id. If
used, you are not required to use lat and lng.
type: integer
responses:
200:
description: OK
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Location'
/geographies/{geo-id}/media/recent:
parameters:
- name: geo-id
in: path
description: Geolocation ID
type: integer
required: true
get:
description: |
Get recent media from a geography subscription that you created.
**Note**: You can only access Geographies that were explicitly created
by your OAuth client. Check the Geography Subscriptions section of the
[real-time updates page](https://instagram.com/developer/realtime/).
When you create a subscription to some geography
that you define, you will be returned a unique geo-id that can be used
in this query. To backfill photos from the location covered by this
geography, use the [media search endpoint
](https://instagram.com/developer/endpoints/media/).
parameters:
- name: count
in: query
description: Max number of media to return.
type: integer
- name: min_id
in: query
description: Return media before this `min_id`.
type: integer
responses:
200:
description: OK
################################################################################
# Definitions #
################################################################################
definitions:
User:
type: object
properties:
id:
type: integer
username:
type: string
full_name:
type: string
profile_picture:
type: string
bio:
type: string
website:
type: string
counts:
type: object
properties:
media:
type: integer
follows:
type: integer
follwed_by:
type: integer
Media:
type: object
properties:
created_time:
description: Epoc time (ms)
type: integer
type:
type: string
filter:
type: string
tags:
type: array
items:
$ref: '#/definitions/Tag'
id:
type: integer
user:
$ref: '#/definitions/MiniProfile'
users_in_photo:
type: array
items:
$ref: '#/definitions/MiniProfile'
location:
$ref: '#/definitions/Location'
comments::
type: object
properties:
count:
type: integer
data:
type: array
items:
$ref: '#/definitions/Comment'
likes:
type: object
properties:
count:
type: integer
data:
type: array
items:
$ref: '#/definitions/MiniProfile'
images:
properties:
low_resolution:
$ref: '#/definitions/Image'
thumbnail:
$ref: '#/definitions/Image'
standard_resolution:
$ref: '#/definitions/Image'
videos:
properties:
low_resolution:
$ref: '#/definitions/Image'
standard_resolution:
$ref: '#/definitions/Image'
Location:
type: object
properties:
id:
type: string
name:
type: string
latitude:
type: number
longitude:
type: number
Comment:
type: object
properties:
id:
type: string
created_time:
type: string
text:
type: string
from:
$ref: '#/definitions/MiniProfile'
Like:
type: object
properties:
user_name:
type: string
first_name:
type: string
# x-go-name: NoName
last_name:
type: string
type:
type: string
id:
type: string
Tag:
type: object
properties:
media_count:
type: integer
name:
type: string
Image:
type: object
properties:
width:
type: integer
height:
type: integer
url:
type: string
MiniProfile:
type: object
description: A shorter version of User for likes array
properties:
user_name:
type: string
full_name:
type: string
id:
type: integer
profile_picture:
type: string
|