Skip to content

Instantly share code, notes, and snippets.

@teknogeek
Forked from NSExceptional/SnapchatMemories.md
Created July 8, 2016 15:45
Show Gist options
  • Save teknogeek/5f209e940b66206cc08c326f3a325676 to your computer and use it in GitHub Desktop.
Save teknogeek/5f209e940b66206cc08c326f3a325676 to your computer and use it in GitHub Desktop.
Basic documentation on the new Memories API

Alrighty, so Memories:

  • First uploaded to storage.googleapis.com/snallery-m/a1ca9af0-be6b-4874-a6a1-8e30823ae0cf/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx with the following query parameters:

  • GoogleAccessId: GOOGMR536EIHHSJL2KAK

  • Expires: 14679XXXXX

  • Signature: base64 string

The thumbnail is uploaded to storage.googleapis.com/snallery-t/a1ca9af0-be6b-4874-a6a1-8e30823ae0cf/yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy with the same queries. HTTP method is PUT for both


When you first open memories, it'll POST to /gallery/sync with a json param like:

{
  "last_seqnum": 230,
  "page_size": 100
}

which responds with:

{
	"last_seqnum": 230,
	"highest_seqnum": 230,
	"entries": [],
	"has_more": false,
	"user_settings": {
		"story_auto_saving": false,
		"auto_save_to_camera_roll": false,
		"backup_on_cellular": false,
		"private_gallery_enabled": false,
		"top_secret_private_gallery_enabled": false,
		"save_to_private_gallery_by_default": false,
		"snap_save_option": "MEMORIES",
		"entries_to_prefetch_grid": 18,
		"entries_to_prefetch_browse": 2,
		"min_media_cache_size": 104857600,
		"media_cache_percentage": 0.2
	},
	"service_status_code": 2000,
	"quota": {
		"unlimited": false,
		"snap_number": {
			"remaining": 99770,
			"total": 100000
		}
	}
}

Then they POST to /gallery/add_snaps with a json param something like this:

{
  "snaps": [
    {
      "overlay": "{\"filters\":{\"reverse_motion_filter_selected\":false,\"reverse_motion_filter_enabled\":false,\"info_filters\":[{\"type\":\"DATE\",\"date\":{\"type\":\"TIME\"}}],\"visual_filters\":[{\"type\":\"INSTASNAP\"},{\"type\":\"MISS_ETIKATE\"},{\"type\":\"GREYSCALE\"}]},\"audio_disabled\":false}",
      "orientation": 0,
      "backlog_total": 452,
      "media_type": 0,
      "snap_id": "C794499B-2208-4C65-9A89-C88520990DF6",
      "thumbnail_md5hash": "aSjyDQ6inGfchTjwJF/YAA==",
      "width": 750,
      "backlog_index": 249,
      "size": 81552,
      "media_md5hash": "aSjyDQ6inGfchTjwJF/YAA==",
      "source": {
        "type": 1,
        "camera_roll_id": "2BB00682-F286-482A-BD26-BF0C9A325F25/G0/001"
      },
      "height": 1270,
      "duration": 3,
      "encryption": "{\"encryption_iv\":\"p8\\/kk8B9RC1ZgzR6zR4k8w==\",\"encryption_key\":\"P13Wq2qrXEkWfqoabmYku6Xjsc8+cgQnEdF+uDe1S4o=\",\"encrypted\":false}",
      "media_id": "C794499B-2208-4C65-9A89-C88520990DF6",
      "time_zone": "America/Chicago",
      "create_time": 1426540041000
    }
  ]
}

which responds with:

{
	"snaps": [{
		"snap_id": "C794499B-2208-4C65-9A89-C88520990DF6",
		"status_code": 2000,
		"media_uploaded": false,
		"media_url": "https://storage.googleapis.com/snallery-m/a1ca9af0-be6b-4874-a6a1-8e30823ae0cf/0411b564-e966-4f4a-a8e5-8af4378a68e0?GoogleAccessId\u003dGOOGMR536EIHHSJL2KAK\u0026Expires\u003d1467994634\u0026Signature\u003dd0whKZ%2B6AxXwUpkXUXpXUdQCcS4%3D",
		"thumbnail_url": "https://storage.googleapis.com/snallery-t/a1ca9af0-be6b-4874-a6a1-8e30823ae0cf/8b933727-058c-4ba0-a9f4-00884c7866af?GoogleAccessId\u003dGOOGMR536EIHHSJL2KAK\u0026Expires\u003d1467994634\u0026Signature\u003dSCY3CQS5OdM14n3gkb2mHgRKdrw%3D"
	}],
	"last_seqnum": 249,
	"service_status_code": 2000,
	"quota": {
		"unlimited": false,
		"snap_number": {
			"remaining": 99751,
			"total": 100000
		}
	}
}

Then they POST to /gallery/update_entries with a json param like:

{
  "entries": [
    {
      "entry_id": "C794499B-2208-4C65-9A89-C88520990DF6",
      "seq_num": 0,
      "is_private": false,
      "snap_ids": [
        "C794499B-2208-4C65-9A89-C88520990DF6"
      ],
      "create_time": 1426540041000
    }
  ]
}

which responds with:

{
	"entries": [{
		"entry_id": "C794499B-2208-4C65-9A89-C88520990DF6",
		"seq_num": 250,
		"status_code": 2000
	}],
	"last_seqnum": 250,
	"service_status_code": 2000,
	"quota": {
		"unlimited": false,
		"snap_number": {
			"remaining": 99750,
			"total": 100000
		}
	}
}

At some point they POST to /gallery/client_config with the default params and it responds with:

{
	"default_queries": ["Filter"],
	"blocked_tags": ["cloud"],
	"service_status_code": 2000
}

And at some point they'll POST to /gallery/upload_tags with a json param like:

{
  "snap_tags_list": [
    {
      "snap_id": "4002FE04-21D4-496A-B627-8C4A2EC69F3C",
      "tag_version": 2,
      "tags": "{\"meta_tag_list\":[],\"time_tag_list\":[\"2016\",\"May\",\"Thursday\"],\"visual_tag_to_confidence_map\":{\"Selfie\":1,\"beard\":0.9770902,\"sweater\":0.1725622,\"sweatshirt\":0.1725622,\"clothes\":0.1725622,\"person\":0.1763911},\"language_id\":\"English\"}"
    },
    {
      "snap_id": "BDC50458-67B3-4EF5-8DB1-6BCE272E82B1",
      "tag_version": 2,
      "tags": "{\"meta_tag_list\":[],\"time_tag_list\":[\"2016\",\"June\",\"Saturday\",\"weekend\"],\"visual_tag_to_confidence_map\":{\"Eskimo dog\":0.764585,\"animal\":0.764585,\"husky\":0.764585,\"dog\":0.764585},\"tag_cluster\":\"animal\",\"language_id\":\"English\"}"
    },
    etc... there were lots
  ]
}

which responds with:

{
	"snaps": [{
		"snap_id": "4002FE04-21D4-496A-B627-8C4A2EC69F3C",
		"status_code": 4006
	}, {
		"snap_id": "BDC50458-67B3-4EF5-8DB1-6BCE272E82B1",
		"status_code": 4006
	}, etc],
	"service_status_code": 2001
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment