Skip to content

My API documentation writing sample

klevi23 edited this page Feb 17, 2024 · 12 revisions

This is Kfir's API technical writing portfolio.

Sample Stripe API document

Introduction to the Stripe API

What is Stripe;

What is this API all about;

Use this API for X purpose, i.e. financial services of online store;

How to connect to the Stripe API

To connect to the Stripe API, you need to use the https://api.stripe.com base url.

You also need to register for an account on stripe.com, to be able to get full access.

How to authenticate to the Stripe API

Go to the Stripe website.

Search for "API Keys."

Go to Developers > API Keys.

Copy the hidden secret key.

Note that Stripe API supports various types of authentication, like Bearer: "Authentication: Bearer sk_test_51OeymSI4kExMG4nltVyfmFoNoX0sM8x6EoFHUWiVOKNGW4nrQgWpgEsmuHP2OjqEQAOyifV8nkkbF8fIiA2jqV5Y00p66DUJs0"

Requests and responses of the Stripe API

Explain the requests that the developer may use and what he can expect as responses. 200: OK 400: Bad Request

Functionality

Explain to the developer what he can do with the Stripe API:

As a developer you can use the Stripe API to:

  • Check balance of a credit card

Balance

You can use the balance request to find out what the available expense amount on a particular credit card is.

A GET operation is possible only for this request!

The endpoint for this operation is:

{{baseUrl}}/v1/balance

Responses

Responses will return standard codes.

Response code 200: OK

{ "object": "balance", "available": [ { "amount": 0, "currency": "usd", "source_types": { "card": 0 } } ], "livemode": false, "pending": [ { "amount": 0, "currency": "usd", "source_types": { "card": 0 } } ] }

Parameters

Parameter1:

This is when you should use it;

This is the type of the parameter (Int, String, etc);

This is an optional/mandatory parameter;

This parameter has/does not have prefixed values;

This is an example of the use of this parameter;

etc

Parameter1 response

Response code 400: Bad Request

{ "error": { "code": "parameter_unknown", "doc_url": "https://stripe.com/docs/error-codes/parameter-unknown", "message": "Received unknown parameter: hahaha", "param": "hahaha", "request_log_url": "https://dashboard.stripe.com/test/logs/req_KgXeaZp4oefYbl?t=1708168678", "type": "invalid_request_error" } }