Periods

What does the include do?

The periods include allows you to retrieve detailed information about different periods within a football match, including regular time, extra time, and penalties. This include provides comprehensive timing data including the current minute, seconds elapsed, period start/end times, and whether the period is currently active (ticking).

Why use periods?

The periods include is essential for:

  • Live match tracking: Display accurate match time with minute and second precision

  • Match state management: Know which period is currently being played

  • Time-based analysis: Analyse events by period (first half, second half, extra time)

  • Broadcast applications: Show precise match timing for live streams

  • Statistical analysis: Break down team performance by match period

  • Injury time tracking: Monitor added time in each period

Requesting periods

To retrieve period information for a fixture, use the following include:

https://api.sportmonks.com/v3/football/fixtures/{fixture_id}
?api_token=YOUR_TOKEN&include=periods

Example: Get periods for Real Madrid vs FC Barcelona (fixture ID: 19439347)

https://api.sportmonks.com/v3/football/fixtures/19439347
?api_token=YOUR_TOKEN&include=periods

Response structure

When you include periods in your request, you'll receive an array of period objects for each match period:

Field descriptions

Field
Type
Description

id

integer

Unique identifier for this period

fixture_id

integer

ID of the fixture this period belongs to

type_id

integer

Type identifier for the period (see Period Types below)

started

integer

UNIX timestamp of when the period started

ended

integer/null

UNIX timestamp of when the period ended (null if ongoing)

counts_from

integer

Minute from which this period starts counting (e.g., 0 for 1st half, 45 for 2nd half)

ticking

boolean

Whether the period is currently active/being played

sort_order

integer

Sorting order of the period (1 = first, 2 = second, etc.)

description

string

Human-readable description of the period

time_added

integer/null

Additional injury/stoppage time added to the period (in minutes)

period_length

integer

Standard length of the period in minutes (usually 45 for regular time)

minutes

integer

Current minute within the match (cumulative)

seconds

integer

Seconds after the current minute (0-59)

has_timer

boolean

Whether detailed timer information (minutes/seconds) is available

Period types

The type_id field indicates what type of period this represents:

Type ID
Description
counts_from
period_length

1

First Half (1ST_HALF)

0

45

2

Second Half (2ND_HALF)

45

45

3

Extra Time - First Half

90

15

4

Extra Time - Second Half

105

15

5

Penalty Shootout

120

Variable

14

Awaiting Extra Time

90

0

16

Extra Time Halftime

105

0

18

Awaiting Penalties

120

0

Understanding period timing

counts_from

This field indicates the starting minute for the period:

  • 1st half: counts_from = 0 (minutes 0-45)

  • 2nd half: counts_from = 45 (minutes 45-90)

  • Extra time 1st: counts_from = 90 (minutes 90-105)

  • Extra time 2nd: counts_from = 105 (minutes 105-120)

minutes and seconds

These fields provide the current match time:

  • minutes: Cumulative minute count from match start (e.g., 47 means 47th minute)

  • seconds: Seconds within current minute (0-59)

Example: minutes = 47, seconds = 23 means the match is at 47:23

ticking

  • true: This period is currently active (match is live in this period)

  • false: This period has ended

time_added (Injury time)

The additional minutes added to the period for stoppages:

  • Usually 1-5 minutes in regular time

  • Shows as "45+2" in match displays when 2 minutes added to 1st half

Current period include

In addition to the periods include, you can use the currentPeriod include for a more convenient way to get only the active period:

This returns only the period that is currently ticking (or null if match hasn't started or has ended).

Nested includes

The periods include supports the following nested includes:

periods.type

Get detailed information about the period type:

periods.events

Get all events that occurred during this specific period:

periods.statistics

Get statistics specific to this period:

Code examples

Python example

JavaScript example

Common use cases

1. Live match timer display

Display accurate live match time with injury time:

2. Period-based statistics

Analyze team performance by period:

3. Match state detection

Determine current match state:

Best practices

  1. Use has_timer to check data availability: Not all matches have detailed timer information. Check has_timer before displaying seconds.

  2. Handle null ended timestamps: For live matches, ended will be null for the current period.

  3. Use currentPeriod for live updates: If you only need the active period, use include=currentPeriod instead of fetching all periods.

  4. Calculate injury time correctly: Display as "45+2" not "47" when showing injury time to users.

  5. Check ticking for live status: The ticking field is the most reliable way to determine if a period is currently active.

  6. Sort by sort_order: Always use sort_order to display periods in chronological order.

  7. Cache completed periods: Period data doesn't change after a period ends. Cache historical periods to reduce API calls.

Summary

The periods include provides comprehensive timing information for all match periods including first half, second half, extra time, and penalties. With fields for current minutes/seconds, injury time, and active status, it enables accurate live match timers, period-based analysis, and match state management. Use currentPeriod for live matches when you only need the active period data.

Last updated

Was this helpful?