experiments with the OpenRTB API specification, found at http://openrtb.info
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This repository contains OCaml code to validate requests and responses as specified by OpenRTB, in Version 2.0 of the specification. The specification is formalized using ATD, in file openrtb.atd. The tool atdgen generates OCaml serializer and deserializers from this specification. To validate a request contained in file request-file.js :

$ ./validate -request request-file.js

To validate a response in file response-file.js :

$ ./validate -response response-file.js

Secondly, the repository contains all of the examples contained in Version 2.0 document. In several cases, the examples were modified to conform to the specification, or vice-versa. See details below.

Finally, the repository contains an SCGI "bidder" server, in which the details of request de-serialization and response serlialization are abstracted away. This server can be deployed behind any web server which supports the SCGI protocol, e.g. Apache or Nginx. The file test_bidder.ml implements a dummy bidder, which returns the same minimalistic response, independent of the request. Deploying it behind Nginx, on uri /test-bidder/, on port 8080, and on the same host as the web server, requires the following stanza in the Nginx's configuration file:

location /test-bidder/ {
    include scgi_params;

To start the bidder:

$ ./test_bidder -p 8080 &

To make a request, assuming you do so from the same host as the web server:

$ curl --data-binary @simple-banner.js http://localhost/test-bidder/

Why is EigenDog doing this?

We want to learn more about the RTB ecosystem, of which scalable predictive modeling is a significant component.


To build openrtb, you'll need:

Note that each of these may have additional dependencies, namely lwt and ATD

Modifications to Specification and Examples

We made the following changes to the draft specification:

  • removed the keywords field whenever it has a sibling field content, as the latter also contains the keywords field
  • replaced the keyword field with its plural form keywords , and represented it by a list of strings rather than an optional, comma-separated string.
  • represented privacypolicy by a boolean, rather than an integer, following the video example.
  • represented boxingallowed by a boolean, rather than an integer, following the video example.
  • represented protocol by array of integers rather than a single integer, following the video example.

In addition, we made the following changes to the examples:

  • simple-banner.js:

    • changed at to string
    • changed id to string
  • expandable-creative.js:

    • changed at to string
  • video.js:

    • changed at to string
    • in companionad , removed banner field label
    • changed api to array
    • changed season to string
  • response-win-vast-inline.js:

    • added impid field