The Code for America API

Read more at https://github.com/codeforamerica/cfapi.

Endpoints:

Organizations

Retrieve a list of organizations, also called brigades.

Endpoint

/api/organizations

/api/organizations?param=value&param2=value2

Url parameters

q (string)
A search term by which results will be filtered:

/api/organizations?q=code%20for

searches content of the name property.

per_page (integer)
The number of results to return per page:

/api/organizations?per_page=5

Organization properties
You can add any of the Organization properties as a parameter and the API will filter by organizations that have that property.

Response Properties

pages
Dictionary of pagination links, optionally including first, prev, next, and last.
objects
List of individual organizations.

Sample Request

http://api.codeforamerica.org/api/organizations

Sample Response

{
  "pages": {
    "next": …,
    "last": …
  },
  "objects": [
   {
     "type": "Brigade",
     "name": "Open Oakland",
     …
   },
   {
     "type": "Code for All",
     "name": "Code for Berlin",
     …
   },
   …
  ]
}

Sample Request with query params

http://api.codeforamerica.org/api/organizations?type=Brigade

Sample Response

{
  "pages": {
    "next": …,
    "last": …
  },
  "objects": [
   {
     "type": "Brigade, Code for All",
     "name": "OK Lab Hamburg",
     …
   },
   {
     "type": "Brigade",
     "name": "Code for Puerto Rico",
     …
   },
   …
  ]
}

Organizations GeoJSON

Retrieve a list of organizations, in GeoJSON format for geographic applications.

Endpoint

/api/organizations.geojson

Response Properties

type
FeatureCollection
features
List of feature objects with these properties:
type
Feature
id
Unique identifier for organization.
geometry
Point geometry object with organization location.
properties
Feature properties, selected from properties for a single organization.

Sample Request

http://api.codeforamerica.org/api/organizations.geojson

Sample Response

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "id": "Open-Oakland",
      "geometry": {
        "type": "Point",
        "coordinates": [ -122.2711, 37.8044 ]
      },
      "properties": {
        "name": "Open Oakland",
        "website": "http://openoakland.org/",
        "city": "Oakland, CA",
        …
      }
    },
    …
  ]
}

One Organization

Retrieve a single organization.

Endpoint

/api/organizations/{organization id}

Organization Properties

id
Code for America API id
name
Offical name.
website
Informational website.
city
Home city of the organization.
latitude
Geographic latitude, in degrees.
longitude
Geographic longitude, in degrees.
api_url
Link to complete API information for this organization.
started_on
Optional start data for the organization.
current_events
Selection of current event dictionaries.
all_events
Link to API information for all organization events.
events_url
URL source for event list.
current_projects
The three most recently updated projects of this organization.
all_projects
Link to API information for all organization projects.
projects_list_url
URL source for projects list.
current_stories
Selection of current story dictionaries.
all_stories
Link to API information for all organization stories.
rss
URL source for stories list.

Sample Request

http://api.codeforamerica.org/api/organizations/Open-Oakland

Sample Response

{
  "type": "Brigade",
  "name": "Open Oakland",
  "id" : "Open-Oakland",
  "website": "http://openoakland.org/",
  "city": "Oakland, CA",
  "latitude": 37.8044,
  "longitude": -122.2711,
  "api_url": "http://api.codeforamerica.org/api/organizations/Open-Oakland",
  "started_on": "2012-12-25",

  "current_events": [ … ],
  "all_events": "http://api.codeforamerica.org/api/organizations/Open-Oakland/events",
  "events_url": "http://www.meetup.com/OpenOakland/",

  "current_projects": [ … ],
  "all_projects": "http://api.codeforamerica.org/api/organizations/Open-Oakland/projects",
  "projects_list_url": "https://docs.google.com/spreadsheet/pub?key=0AgNZYWcpRBQ7dHRnTUJtd3QtYkR5bk5lUmpNMDlpSEE&single=true&gid=0&output=csv",

  "current_stories": [ … ],
  "all_stories": "http://api.codeforamerica.org/api/organizations/Open-Oakland/stories",
  "rss": ""
}

Projects

Retrieve a list of projects. Projects are ordered by most recent update.

Endpoints

/api/projects
/api/projects?param=value&param2=value2
/api/organizations/{organization id}/projects

Url parameters

q (string)
A search term by which results will be filtered:

/api/projects?q=bicycle
/api/organizations/Code-for-San-Francisco/projects?q=elections

searches content of the name, description, categories, github_details and status properties.

per_page (integer)
The number of results to return per page:

/api/projects?per_page=5

Project properties
You can add any of the Project properties as a parameter and the API will filter by projects that have that property. You can also request projects based on organization properties such as:

/api/projects?organization_type=Brigade
/api/projects?organization_city=San%20Francisco,%20CA

Response Properties

pages
Dictionary of pagination links, optionally including first, prev, next, and last.
objects
List of individual projects.

Sample Request

http://api.codeforamerica.org/api/projects

Sample Response

{
  "pages": {
    "next": …,
    "last": …
  },
  "objects": [
  {
    "id": 1,
    "name": "cityvoice",
    "link_url": "http://www.cityvoiceapp.com/",
    "code_url": "https://github.com/codeforamerica/cityvoice",
    "api_url": "http://api.codeforamerica.org/api/projects/1",
    "categories": "community engagement, housing",
    "description": "A place-based call-in system for gathering and sharing community feedback",
    "github_details": { … },
    "organization": { … },
    "organization_name": "Code for America",
    "tags": ["community engagement", "housing"],
    "type": "web service",
    "status": "In Progress",
    "issues": [ … ],
    "commit_status": "success"
  },
  {
    "id": 2,
    "name": "Adopt-a-Thingie",
    …
  },
   …
  ]
}

Sample Request with query params

http://api.codeforamerica.org/api/projects?categories=Knowledge&organization_type=Brigade

Sample Response

{
  "pages": {
    "next": …,
    "last": …
  },
  "objects": [
  {
    "id": 1,
    "name": "myPhillyRising",
    "link_url": "http://www.myphillyrising.com/",
    "code_url": "https://github.com/openplans/myphillyrising/",
    "api_url": "http://api.codeforamerica.org/api/projects/74",
    "categories": "Knowledge",
    "description": "myPhillyRising",
    "github_details": { … },
    "organization": {
        "name": "Philly",
        "type": "Brigade, Code for All"
    },
    "organization_name": "Philly",
    "tags": ["neighborhoods", "news"],
    "type": "",
    "status": "",
    "issues": [ … ],
    "commit_status": "success"
  },
  {
    "id": 2,
    "name": "LocalWiki",
    …
  },
   …
  ]
}

One Project

Retrieve a single project.

Endpoint

/api/projects/{project id}

Project Properties

id
Numeric ID.
name
Name.
languages
A list of programming langauges used in the project
link_url
Homepage.
code_url
Source code URL, e.g. a Github repository.
categories
String with comma-separated list of categories.
description
Prose description.
api_url
Link to complete API information for this project.
organization
Dictionary of organization details.
organization_name
Name of organization.
type
String type.
github_details
Dictionary of Github-specific information, for projects hosted on Github.
status
String with short description of project status.
issues
A list of project issues.
commit_status
The status of the latest commit. More info

Sample Request

http://api.codeforamerica.org/api/projects/1

Sample Response

{
  "id": 1,
  "name": "cityvoice",
  "link_url": "http://www.cityvoiceapp.com/",
  "code_url": "https://github.com/codeforamerica/cityvoice",
  "api_url": "http://api.codeforamerica.org/api/projects/1",
  "categories": "community engagement, housing",
  "status": "In Progress",
  "description": "A place-based call-in system for gathering and sharing community feedback",
  "organization": { … },
  "organization_name": "Code for America",
  "tags": ["community engagement", "housing"],
  "type": "web service",
  "github_details":
  {
    "id": 10515516,
    "contributors": [ … ],
    "contributors_url": "https://api.github.com/repos/codeforamerica/cityvoice/contributors",
    "created_at": "2013-06-06T00:12:30Z",
    "description": "A place-based call-in system for gathering and sharing community feedback",
    "forks_count": 18,
    "homepage": "http://www.cityvoiceapp.com/",
    "html_url": "https://github.com/codeforamerica/cityvoice",
    "name": "cityvoice",
    "open_issues": 38,
    "owner": { … },
    "participation": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 18, 13, 0, 0, 83, 20, 11, 25, 63, 66 ],
    "project_needs": [],
    "pushed_at": "2014-03-29T20:03:41Z",
    "updated_at": "2014-03-29T20:03:41Z",
    "watchers_count": 14
  }
  "issues": [
    {
    "id": 1,
    "title": "Consider using Universal Analytics for Google Analytics",
    "api_url": "http://codeforamerica.org/api/issues/193",
    "body": "Google has officially released Universal Analytics about 2 months ago, …",
    "html_url": "https://github.com/codeforamerica/cityvoice/issues/193",
    "labels": [
      {
        "color": "84b6eb",
        "name": "enhancement",
        "url": "https://api.github.com/repos/codeforamerica/cityvoice/labels/enhancement"
      }
    ],
    "project": { … },
    "project_name": "cityvoice",
    },
    { … }
  ],
  "languages" : [
    "Python",
    "CSS",
    "HTML"
  ]
}

Events

Retrieve a list of events.

Endpoints

/api/events
/api/events/upcoming_events
/api/events/past_events
/api/organizations/{organization id}/events
/api/organizations/{organization id}/upcoming_events
/api/organizations/{organization id}/past_events

Url parameters

per_page (integer)
The number of results to return per page:

/api/events?per_page=5

Event properties
You can add any of the Event properties as a parameter and the API will filter by events that have that property. You can also request events based on organization properties such as:

/api/events?organization_type=Brigade
/api/events?organization_city=San%20Francisco,%20CA

Response Properties

pages
Dictionary of pagination links, optionally including first, prev, next, and last.
objects
List of individual events.
total
The total count of objects.

Event filters

upcoming_events
Only returns events happening in the future.
past_events
Only returns events that have already happened.

Sample Request

http://api.codeforamerica.org/api/events

Sample Response

{
  "pages": {
    "next": …,
    "last": …
  },
  "objects": [
  {
    "id": 1,
    "name": "OpenOakland Civic Hack Night",
    "description": "<p>Join us for our weekly civic hack sessions inside City Hall.</p>",
    "event_url": "http://www.meetup.com/OpenOakland/events/qbjtcgytdbfb/",
    "api_url": "http://api.codeforamerica.org/api/events/1",
    "location": null,
    "start_time": "2015-02-03 18:30:00 -0800",
    "end_time": null,
    "organization": { … },
    "organization_name": "Open Oakland",
    "created_at": "2013-06-04 20:31:29"
  },
  {
    "id": 2,
    "name": "Get Out There And Do Something",
    …
  },
   …
  ]
}

One Event

Retrieve a single event.

Endpoint

/api/events/{event id}

Event Properties

id
Numeric ID.
name
Name.
description
Description.
event_url
Link to page about event.
api_url
Link to complete API information for this event.
location
Optional location. Sometimes missing, and must be found in description.
start_time
Start time. In YYYY-MM-DD HH:MM:SS ZZZZ format, local to event if possible.
end_time
Optional end time. In YYYY-MM-DD HH:MM:SS ZZZZ format, local to event if possible.
organization
Dictionary of organization details.
organization_name
Name of organization.

Sample Request

http://api.codeforamerica.org/api/events/1

Sample Response

{
  "id": 1,
  "name": "OpenOakland Civic Hack Night",
  "description": "<p>Join us for our weekly civic hack sessions inside City Hall.</p>",
  "event_url": "http://www.meetup.com/OpenOakland/events/qbjtcgytdbfb/",
  "api_url": "http://api.codeforamerica.org/api/events/1",
  "location": null,
  "start_time": "2015-02-03 18:30:00 -0800",
  "end_time": null,
  "organization": { … },
  "organization_name": "Open Oakland",
  "created_at": "2013-06-04 20:31:29"
}

Stories

Retrieve a list of stories.

Endpoints

/api/stories
/api/organizations/{organization id}/stories

Url parameters

per_page (integer)
The number of results to return per page:

/api/stories?per_page=5

Story properties
You can add any of the Story properties as a parameter and the API will filter by stories that have that property. You can also request stories based on organization properties such as:

/api/events?organization_type=Brigade
/api/events?organization_city=San%20Francisco,%20CA

Response Properties

pages
Dictionary of pagination links, optionally including first, prev, next, and last.
objects
List of individual stories.

Sample Request

http://api.codeforamerica.org/api/stories

Sample Response

{
  "pages": {
    "next": …,
    "last": …
  },
  "objects": [
  {
    "id": 1,
    "title": "Here Are Our Values",
    "link": "http://www.codeforamerica.org/blog/2014/03/27/here-are-our-values/",
    "organization": { … },
    "organization_name": "Code for San Francisco",
    "type": "blog"
  },
  {
    "id": 2,
    "name": "Get Out There And Do Something",
    …
  },
   …
  ]
}

One Story

Retrieve a single story.

Endpoint

/api/stories/{story id}

Story Properties

id
Numeric ID.
title
Title.
link
Link.
organization
Dictionary of organization details.
organization_name
Name of organization.
type
Type of story

Sample Request

http://api.codeforamerica.org/api/stories/1

Sample Response

{
  "id": 1,
  "title": "Here Are Our Values",
  "link": "http://www.codeforamerica.org/blog/2014/03/27/here-are-our-values/",
  "organization": { … },
  "organization_name": "Code for San Francisco",
  "type": "blog"
}

Issues

Retrieve a list of project issues.

Endpoints

/api/issues
/api/issues/labels/{label name(s)}

Url parameters

per_page (integer)
The number of results to return per page:

/api/issues?per_page=5

Issue properties
You can add any of the Issue properties as a parameter and the API will filter by issues that have that property. You can also request issues based on organization properties such as:

/api/issues?organization_type=Brigade
/api/issues?organization_city=San%20Francisco,%20CA

Or by project properties such as:

/api/issues?project_name=communities
/api/issues?project_status=beta

Response Properties

pages
Dictionary of pagination links, optionally including first, prev, next, and last.
objects
List of individual issues.

Issue filters

labels (comma separated)
Return issues that have at least one of the given labels

Sample Request

http://api.codeforamerica.org/api/issues

Sample Response

{
  "pages": {
    "next": …,
    "last": …
  },
  "objects": [
  {
    "id": 1,
    "title": "Write some tests",
    "api_url": "http://codeforamerica.org/api/issues/2",
    "body": "Start writing tests. ",
    "html_url": "https://github.com/sfbrigade/ballot_initiatives/issues/7",
    "labels": [
      {
        "color": "84b6eb",
        "name": "enhancement",
        "url": "https://api.github.com/repos/sfbrigade/ballot_initiatives/labels/enhancement"
      }
    ],
    "project": { … },
    "project_name": "ballot_initiatives",
  },
  {
    "id": 2,
    "title": "Import SFGOV data set",
    …
  },
  …
  ]
}

Sample Request with labels filter

http://api.codeforamerica.org/api/issues/labels/enhancement

Sample Response

{
  "pages": {
    "next": …,
    "last": …
  },
  "objects": [
  {
    "id": 1,
    "title": "Write some tests",
    "api_url": "http://codeforamerica.org/api/issues/2",
    "body": "Start writing tests. ",
    "html_url": "https://github.com/sfbrigade/ballot_initiatives/issues/7",
    "labels": [
      {
        "color": "84b6eb",
        "name": "enhancement",
        "url": "https://api.github.com/repos/sfbrigade/ballot_initiatives/labels/enhancement"
      }
    ],
    "project": { … },
    "project_name": "ballot_initiatives",
  },
  {
    "id": 2,
    "title": "help for non-service residents",
    "labels": [
      {
        "color": "84b6eb",
        "name": "enhancement",
        "url": "https://api.github.com/repos/open-austin/austin-recycles/labels/enhancement"
      },
      {
        "color": "fef2c0",
        "name": "hack",
        "url": "https://api.github.com/repos/open-austin/austin-recycles/labels/hack"
      }
    ]
    …
  },
  …
  ]
}

Sample Request with Parameters

http://api.codeforamerica.org/api/issues?organization_type=Code for All

Sample Response

[
    {
      api_url: "http://localhost:5000/api/issues/27",
      body: "",
      html_url: "https://github.com/CfABrigadePhiladelphia/laddr/issues/34",
      id: 27,
      labels: [ ... ],
      project: { ... },
      title: "create admin UI on profile page for promoting other users' account level"
    }
    , ...
  ]

One Issue

Retrieve a single issue.

Endpoint

/api/issues/{issue id}

Issue Properties

id
Numeric ID.
title
Title.
body
Body.
api_url
API URL.
html_url
Github URL.
labels
Array of issue labels dictionaries
project_name
Name of project
project
Dictionary of project details.

Sample Request

http://api.codeforamerica.org/api/issues/1

Sample Response

{
  "id": 1,
  "title": "Write some tests",
  "api_url": "http://codeforamerica.org/api/issues/2",
  "body": "Start writing tests. ",
  "html_url": "https://github.com/sfbrigade/ballot_initiatives/issues/7",
  "labels": [
      {
          "color": "84b6eb",
          "name": "enhancement",
          "url": "https://api.github.com/repos/sfbrigade/ballot_initiatives/labels/enhancement"
      }
  ],
  "project": { … },
  "project_name": "ballot_initiatives",
}